Beispiel #1
0
def main(args, settings_path=None):
    """
    Main Entry Point.
    """
    import argparse
    parser = argparse.ArgumentParser(\
            usage='%(prog)s [options] command\n\nVersion\n  %(prog)s version ' \
                + str(__version__))
    parser.add_argument('--version', action='version',
                        version='%(prog)s ' + str(__version__))
    parser.add_argument('-c', '--cloud', dest='cloud', default='vmware')
    parser.add_argument('-u', '--user', dest='user', default='vagrant')
    parser.add_argument('-p', '--password', dest='password', default='vagrant')
    parser.add_argument('-k', '--keyfile', dest='keyfile',
        default=os.path.join(os.getenv('HOME'), '.ssh/vagrant_rsa'))
    build_subcommands_parser(parser, sys.modules[__name__])

    if len(args) <= 1:
        parser.print_help()
        sys.exit(1)
    options = parser.parse_args(args[1:])
    fab.env.user = options.user
    fab.env.password = options.password
    fab.env.key_filename = options.keyfile

    global CLOUD_BACKEND
    CLOUD_BACKEND = _load_backend('tero.%s.Backend' % options.cloud)

    if not settings_path:
        settings_path = '/etc/tero/config'
    settings = imp.load_source('settings', settings_path)

    # Filter out options with are not part of the function prototype.
    func_args = filter_subcommand_args(options.func, options)
    options.func(**func_args)
Beispiel #2
0
def main():
    """
    Main Entry Point
    """
    import __main__

    parser = argparse.ArgumentParser(
        usage='%(prog)s [options] command\n\nVersion\n  %(prog)s version '
        + str(tero.__version__),
        formatter_class=argparse.RawTextHelpFormatter)
    parser.add_argument('--version', action='version',
        version='%(prog)s ' + str(tero.__version__))
    tero.build_subcommands_parser(parser, __main__)
    args = parser.parse_args()

    # Filter out options with are not part of the function prototype.
    func_args = tero.filter_subcommand_args(args.func, args)
    args.func(**func_args)
Beispiel #3
0
def main():
    """
    Main Entry Point
    """
    import __main__

    parser = argparse.ArgumentParser(
        usage='%(prog)s [options] command\n\nVersion\n  %(prog)s version '
        + str(tero.__version__),
        formatter_class=argparse.RawTextHelpFormatter)
    parser.add_argument('--version', action='version',
        version='%(prog)s ' + str(tero.__version__))
    tero.build_subcommands_parser(parser, __main__)
    args = parser.parse_args()

    # Filter out options with are not part of the function prototype.
    func_args = tero.filter_subcommand_args(args.func, args)
    args.func(**func_args)
Beispiel #4
0
def main(args, settings_path=None):
    """
    Main Entry Point.
    """
    import argparse
    parser = argparse.ArgumentParser(\
            usage='%(prog)s [options] command\n\nVersion\n  %(prog)s version ' \
                + str(__version__))
    parser.add_argument('--version',
                        action='version',
                        version='%(prog)s ' + str(__version__))
    parser.add_argument('-c', '--cloud', dest='cloud', default='vmware')
    parser.add_argument('-u', '--user', dest='user', default='vagrant')
    parser.add_argument('-p', '--password', dest='password', default='vagrant')
    parser.add_argument('-k',
                        '--keyfile',
                        dest='keyfile',
                        default=os.path.join(os.getenv('HOME'),
                                             '.ssh/vagrant_rsa'))
    if args and args[0].endswith('dintegrity'):
        from .setup import integrity
        build_subcommands_parser(parser, integrity)
    else:
        build_subcommands_parser(parser, sys.modules[__name__])

    if len(args) <= 1:
        parser.print_help()
        sys.exit(1)
    options = parser.parse_args(args[1:])
    fab.env.user = options.user
    fab.env.password = options.password
    fab.env.key_filename = options.keyfile

    global CLOUD_BACKEND
    CLOUD_BACKEND = _load_backend('tero.%s.Backend' % options.cloud)

    if not settings_path and os.path.exists('/etc/tero/config'):
        settings_path = '/etc/tero/config'
    if settings_path:
        settings = imp.load_source('settings', settings_path)

    # Filter out options with are not part of the function prototype.
    func_args = filter_subcommand_args(options.func, options)
    options.func(**func_args)