Пример #1
0
def main():
    opts = parse_arguments()

    level = logging.INFO
    if opts.debug:
        level = logging.DEBUG

    if opts.quiet:
        level = logging.ERROR

    logging.basicConfig(level=level)

    logging.debug('starting...')

    opts.verify = not opts.no_verify

    logging.debug('options: %r', opts)
    try:
        commands = {
            'deployment': deps.do_main,
            'admission': devadm.do_main,
            'authentication': devauth.do_main,
            'device': device.do_main,
            'artifact': artifacts.do_main,
            'inventory': inventory.do_main,
            'client':  client.do_main,
            'user':  user.do_main,
        }
        run_command(opts.command, commands, opts)
    except ClientError as rerr:
        logging.error('request failed: %s', rerr)
    except CommandNotSupportedError:
        logging.error('incomplete or unsupported command, see --help')
Пример #2
0
def main():
    opts = parse_arguments()

    level = logging.INFO
    if opts.debug:
        level = logging.DEBUG

    logging.basicConfig(level=level)

    logging.debug('starting...')

    opts.verify = not opts.no_verify

    logging.debug('options: %r', opts)
    try:
        commands = {
            'deployment': deps.do_main,
            'admission': devadm.do_main,
            'authentication': devauth.do_main,
            'device': device.do_main,
            'artifact': artifacts.do_main,
            'inventory': inventory.do_main,
            'client': client.do_main,
            'user': user.do_main,
        }
        run_command(opts.command, commands, opts)
    except ClientError as rerr:
        logging.error('request failed: %s', rerr)
    except CommandNotSupportedError:
        logging.error('incomplete or unsupported command, see --help')
Пример #3
0
def do_device(opts):
    commands = {
        'show': device_show,
        'group': device_group,
        'list': devices_list,
    }
    run_command(opts.invdevcommand, commands, opts)
Пример #4
0
def do_main(opts):
    commands = {
        'list': list_device_auths,
        'accept': lambda o: set_device_auth_status(o, 'accepted'),
        'reject': lambda o: set_device_auth_status(o, 'rejected'),
        'show': show_device_auth,
    }
    run_command(opts.admcommand, commands, opts)
Пример #5
0
def do_main(opts):
    commands = {
        'list': list_device_auths,
        'accept': lambda o: set_device_auth_status(o, 'accepted'),
        'reject': lambda o: set_device_auth_status(o, 'rejected'),
        'show': show_device_auth,
    }
    run_command(opts.admcommand, commands, opts)
Пример #6
0
def do_main(opts):
    commands = {
        'list': list_devices,
        'count': count_devices,
        'show': show_device,
        'delete': delete_device,
    }
    run_command(opts.authcommand, commands, opts)
Пример #7
0
def do_main(opts):
    commands = {
        'list': list_devices,
        'count': count_devices,
        'show': show_device,
        'delete': delete_device,
    }
    run_command(opts.authcommand, commands, opts)
Пример #8
0
def do_main(opts):
    logging.debug('user opts: %r', opts)
    cmds = {
        'login': do_user_login,
        'token': do_user_token,
        'initial-login': do_user_login_initial,
        'initial': do_user_create_initial,
        'list': list_users,
    }
    run_command(opts.usercommand, cmds, opts)
Пример #9
0
def do_main(opts):
    logging.debug('user opts: %r', opts)
    cmds = {
        'login': do_user_login,
        'token': do_user_token,
        'initial-login': do_user_login_initial,
        'initial': do_user_create_initial,
        'list': list_users,
    }
    run_command(opts.usercommand, cmds, opts)
Пример #10
0
def do_main(opts):
    commands = {
        'authorize': do_authorize,
        'key': do_key,
        'update': do_update,
        'token': do_token,
        'inventory': do_inventory,
        'fake-update': do_fake_update
    }
    run_command(opts.devcommand, commands, opts)
Пример #11
0
def do_main(opts):
    commands = {
        'authorize': do_authorize,
        'key': do_key,
        'update': do_update,
        'token': do_token,
        'inventory': do_inventory,
        'fake-update': do_fake_update
    }
    run_command(opts.devcommand, commands, opts)
Пример #12
0
def do_main(opts):
    logging.debug('artifacts opts: %r', opts)
    cmds = {
        'find': None,
        'list': do_artifacts_list,
        'add': do_artifacts_artifact_add,
        'show': do_artifacts_show,
        'remove': None,
        'download': do_artifacts_download,
    }
    run_command(opts.artcommand, cmds, opts)
Пример #13
0
def do_main(opts):
    logging.debug('deployment opts: %r', opts)
    cmds = {
        'add': do_deployments_add,
        'devices': do_deployments_devices,
        'find': do_deployments_find,
        'logs': do_deployments_logs,
        'stats': do_deployments_stats,
        'status': do_deployments_status,
    }
    run_command(opts.depcommand, cmds, opts)
Пример #14
0
def do_main(opts):
    logging.debug('deployment opts: %r', opts)
    cmds = {
        'add': do_deployments_add,
        'devices': do_deployments_devices,
        'find': do_deployments_find,
        'logs': do_deployments_logs,
        'stats': do_deployments_stats,
        'status': do_deployments_status,
    }
    run_command(opts.depcommand, cmds, opts)
Пример #15
0
def do_group(opts):
    commands = {
        'list': group_list,
        'show': group_show,
    }
    run_command(opts.invgrcommand, commands, opts)
Пример #16
0
def do_main(opts):
    commands = {
        'group': do_group,
        'device': do_device,
    }
    run_command(opts.invcommand, commands, opts)