Beispiel #1
0
 def execute(self, server, argv):
     options, args = parser.parse_args(argv)
     action = get_command(args, "list")
     groupname = get_argument(args)
     if action == "list":
         return list_groups(server, options)
     elif action == "create":
         return create_group(server, options, groupname)
     if action == "adduser":
         username = get_argument(args, 3)
         return add_user(server, options, groupname, username)
     else:
         parser.print_help()
         return USER_ERROR
Beispiel #2
0
 def execute(self, server, argv):
     options, args = parser.parse_args(argv)
     action = get_command(args, 'list')
     groupname = get_argument(args)
     if action == 'list':
         return list_groups(server, options)
     elif action == 'create':
         return create_group(server, options, groupname)
     if action == 'adduser':
         username = get_argument(args, 3)
         return add_user(server, options, groupname, username)
     else:
         parser.print_help()
         return USER_ERROR
Beispiel #3
0
 def execute(server, argv):
     options, args = parser.parse_args(argv)
     action = get_action(args, 'list')
     actionarg = get_argument(args)
     if action == 'list' or action == 'ls':
         return list_users(server, options)
     elif action == 'create':
         return create_user(server, options, actionarg)
     elif action == 'setprop':
         username = actionarg
         propstring = get_argument(argv, 3)
         props = parse_properties(propstring)
         return set_profile_properties(server, options, username, props)
     else:
         parser.print_help()
         return USER_ERROR
Beispiel #4
0
    def execute(self, server, argv):
        options, args = parser.parse_args(argv)

        action = get_action(args, default='list')
        actionarg = get_argument(args)

        if action == 'list' or action == 'ls':
            return list_packages(server, options)
        elif actionarg is None:
            parser.print_help()
            return USER_ERROR
        elif action == 'build':
            return build_package(server, options, actionarg)
        elif action == 'install':
            return install_package(server, options, actionarg)
        elif action == 'uninstall':
            return uninstall_package(server, options, actionarg)
        elif action == 'download':
            return download_package(server, options, actionarg)
        elif action == 'upload':
            return upload_package(server, options, actionarg)
        elif action == 'promote':
            target_server_name = options.target_server
            if target_server_name is None:
                error("Missing target server, use -t flag.")
                return USER_ERROR
            target_server = self.config.get_server(target_server_name)
            return promote_package(server, target_server, options, actionarg)
        else:
            sys.stderr.write(
                'error: Unknown package action {a}\n'.format(a=action))
            return USER_ERROR
Beispiel #5
0
 def execute(self, server, argv):
     options, args = parser.parse_args(argv)
     action = get_command(args, 'list')
     actionarg = get_argument(args)
     if action == 'list' or action == 'ls':
         return list_users(server, options)
     elif action == 'create':
         return create_user(server, options, actionarg)
     elif action == 'setprop':
         username = actionarg
         propstring = get_argument(argv, 3)
         props = parse_properties(propstring)
         return set_profile_properties(server, options, username, props)
     else:
         parser.print_help()
         return USER_ERROR
Beispiel #6
0
 def execute(self, server, argv):
     options, args = parser.parse_args(argv)
     cmd = get_command(args, 'help')
     path = get_argument(args)
     if cmd == 'activate':
         activate(server, options, path)
     else:
         parser.print_help()
Beispiel #7
0
    def execute(self, server, argv):
        (options, args) = parser.parse_args(argv)

        action = get_command(args, 'list')
        actionarg = get_argument(args)
        if action == 'all':
            list_all_jobs(server)
        elif action == 'pending':
            list_pending_jobs(server)
        else:
            parser.print_help()
Beispiel #8
0
    def execute(self, server, argv):
        (options, args) = parser.parse_args(argv)

        action = get_command(args, 'list')
        actionarg = get_argument(args)
        if action == 'list' or action == 'ls':
            return list_bundles(server, options)
        elif action == 'start':
            return start_bundle(server, actionarg, options)
        elif action == 'stop':
            return stop_bundle(server, actionarg, options)
        else:
            sys.stderr.write('error: Unknown {t} action {a}\n'.format(t=self.name, a=action))
            return -2