Exemplo n.º 1
0
def run_command(verbspace, internal_verbspaces, config, *args, **kwargs):
#===============================================================================
    """
    Run a command after parsing the command line arguments provided.
    """
    # Parse the command line.
    parser = VoltCLIParser(verbspace)
    command = parser.parse(*args)

    # Initialize utility function options according to parsed options.
    utility.set_verbose(command.opts.verbose)
    utility.set_debug(  command.opts.debug)
    if hasattr(command.opts, 'dryrun'):
        utility.set_dryrun( command.opts.dryrun)

    # Run the command. Pass along kwargs. This allows verbs calling other verbs
    # to add keyword arguments like "classpath".
    runner = VerbRunner(command, verbspace, internal_verbspaces, config, **kwargs)
    runner.execute()
Exemplo n.º 2
0
def run_command(verbspace, internal_verbspaces, config, *args, **kwargs):
#===============================================================================
    """
    Run a command after parsing the command line arguments provided.
    """
    # Parse the command line.
    parser = VoltCLIParser(verbspace)
    command = parser.parse(*args)

    # Initialize utility function options according to parsed options.
    utility.set_verbose(command.opts.verbose)
    utility.set_debug(  command.opts.debug)
    if hasattr(command.opts, 'dryrun'):
        utility.set_dryrun( command.opts.dryrun)

    # Run the command. Pass along kwargs. This allows verbs calling other verbs
    # to add keyword arguments like "classpath".
    runner = VerbRunner(command, verbspace, internal_verbspaces, config, **kwargs)
    runner.execute()
Exemplo n.º 3
0
def run_command(verbspace, internal_verbspaces, config, *args, **kwargs):
    #===============================================================================
    """
    Run a command after parsing the command line arguments provided.
    """
    # Parse the command line.
    parser = VoltCLIParser(verbspace)
    command = parser.parse(*args)
    """
    Read username/password from txt file
    """
    if hasattr(command.opts,
               'credentials') and command.opts.credentials is not None:
        credentials = command.opts.credentials
        try:
            credentialsFile = open(credentials, "r")
        except IOError:
            print("Credentials file not found or permission denied.")
        else:
            content = ""
            for line in credentialsFile:
                content += line
            user, usr, password, pswd = content.replace(':', ' ').split()
            command.opts.username = usr
            command.opts.password = pswd
            credentialsFile.close()

    # Initialize utility function options according to parsed options.
    utility.set_verbose(command.opts.verbose)
    utility.set_debug(command.opts.debug)
    if hasattr(command.opts, 'dryrun'):
        utility.set_dryrun(command.opts.dryrun)

    # Run the command. Pass along kwargs. This allows verbs calling other verbs
    # to add keyword arguments like "classpath".
    runner = VerbRunner(command, verbspace, internal_verbspaces, config,
                        **kwargs)
    runner.execute()