[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Func-list] getfile from the command-line

        In the spirit of "release early and release often" here is some code I 
put together a few hours ago :) .  It is a command module for the "getfile" 
function so that it can be used from the shell.

  Func 0.28 or newer

  Put the file in /-pythonlibdir-/func/overlord/cmd_modules/

  func (minions) getfile -l localdir -r remotefile

       I tested this on exactly one setup with a overlord (RHEL6.3) and five 
minions (some RHEL5.8, some 6.3).  It worked fine.  Anyone else feel like 
testing it out?

getfile command line
Based on "copyfile command line" by RedHat, Inc
Modifications are Copyright Marcus Lauer (ml1100 nyu edu) and released under the GNU Public License

Copyright for the GPL code used in this project can be found below.
copyfile command line

Copyright 2007, Red Hat, Inc

This software may be freely redistributed under the terms of the GNU
general public license.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

import optparse
import os
import pprint
import stat
import xmlrpclib

from func.overlord import base_command
from func.overlord import client

class CopyFile(base_command.BaseCommand):
    name = "getfile"
    usage = "\n  getfile -l localdir -r remotesource\n    remotesource = file to download from the specified minions\n    localdir = directory in which to put the downloaded files"
    summary = "get a file from minions"

    def addOptions(self):
        self.parser.add_option("-l", "--localdir", dest="localdir",
        self.parser.add_option("-r", "--remotesource", dest="remotesource",

    def handleOptions(self, options):

    def do(self, args):
        if not self.options.localdir or not self.options.remotesource:

        self.server_spec = self.parentCommand.server_spec

        return self.overlord_obj.local.getfile.get(self.options.remotesource, self.options.localdir)

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]