Example #1
0
    def __init__(self, node, command=None, commands=None,
                 # set to False if not set explicitly here
                 forever = None,
                 # set to True if not set explicitly here
                 critical = None,
                 # an optional list of local files
                 # to install remotely in the dir where the script is run
                 includes = None,
                 *args, **kwds):
        self.node = node
        if command is None and commands is None:
            print("WARNING: SshJobScript requires either command or commands")
            self.commands = [ "echo", "misformed", "SshJobScript"]
        elif command and commands:
            print("WARNING: SshJobScript created with command and commands - keeping the latter")
            self.commands = commands
        elif command:
            self.commands = [ command ]
        else:
            # allow to pass empty subcommands so one can use if-expressions there
            self.commands = [ x for x in commands if x]

        self.includes = [] if includes is None else includes
        # set defaults to pass to upper level
        forever = forever if forever is not None else False
        critical = critical if critical is not None else True
        AbstractJob.__init__(self, forever=forever, critical=critical, *args, **kwds)
Example #2
0
 def __init__(self, node, localpaths, remotepath,
              # set to False if not set explicitly here
              forever = None,
              # set to True if not set explicitly here
              critical = None,
              # asyncssh's SFTP client get option
              preserve = False, recurse = False, follow_symlinks = False,
              # this goes to AbstractJob
              *args, **kwds):
     self.node = node
     self.localpaths = localpaths
     self.remotepath = remotepath
     # set defaults to pass to upper level
     forever = forever if forever is not None else False
     critical = critical if critical is not None else True
     self.preserve = preserve
     self.recurse = recurse
     self.follow_symlinks = follow_symlinks
     AbstractJob.__init__(self, forever=forever, critical=critical, *args, **kwds)
Example #3
0
 def __init__(self, node, command=None, commands=None,
              # set to False if not set explicitly here
              forever = None,
              # set to True if not set explicitly here
              critical = None,
              *args, **kwds):
     self.node = node
     if command is None and commands is None:
         print("WARNING: SshJob requires either command or commands")
         self.commands = [ "echo", "misformed", "SshJob"]
     elif command and commands:
         print("WARNING: SshJob created with command and commands - keeping the latter")
         self.commands = commands
     elif command:
         self.commands = [ command ]
     else:
         # allow to pass empty subcommands so one can use if-expressions there
         self.commands = [ x for x in commands if x]
     # set defaults to pass to upper level
     forever = forever if forever is not None else False
     critical = critical if critical is not None else True
     AbstractJob.__init__(self, forever=forever, critical=critical, *args, **kwds)