Exemple #1
0
 def execute(self, server, argv):
     (options, args) = parser.parse_args(argv)
     action = get_command(args, 'help')
     if action == 'clear':
         clear_cache(server, options)
     else:
         parser.print_help()
Exemple #2
0
 def execute(self, server, argv):
     (options, args) = parser.parse_args(argv)
     action = get_command(args, 'help')
     if action == 'clear':
         clear_cache(server, options)
     else:
         parser.print_help()
Exemple #3
0
    def execute(_, argv):
        (options, args) = parser.parse_args(argv)

        arg = get_command(args, '_tools')
        if arg == '_tools':
            print_tools(sys.stdout, options.compact)
        elif arg == '_servers':
            print_servers(sys.stdout)
        else:
            _tool = tool_repo.get_tool(arg)
            _module = tool_repo.get_module(arg)
            if _tool is None:
                error("No tool named {} found".format(arg))
                print_tools(sys.stderr, options.compact)
                return USER_ERROR
            if options.compact:
                for cmd in _tool.commands:
                    sys.stdout.write("{}\n".format(cmd))
            else:
                if hasattr(_module, 'parser'):
                    _module.parser.print_help()
                else:
                    sys.stdout.write("Available commands:\n")
                    for cmd in _tool.commands:
                        sys.stdout.write("\t{}\n".format(cmd))
        return OK
Exemple #4
0
    def execute(_, argv):
        (options, args) = parser.parse_args(argv)

        arg = get_command(args, '_tools')
        if arg == '_tools':
            print_tools(sys.stdout, options.compact)
        elif arg == '_servers':
            print_servers(sys.stdout)
        else:
            _tool = get_tool(arg)
            _module = get_module(arg)
            if _tool is None:
                error("No tool named {} found".format(arg))
                print_tools(sys.stderr, options.compact)
                return USER_ERROR
            if options.compact:
                for cmd in _tool.commands:
                    sys.stdout.write("{}\n".format(cmd))
            else:
                if hasattr(_module, 'parser'):
                    _module.parser.print_help()
                else:
                    sys.stdout.write("Available commands:\n")
                    for cmd in _tool.commands:
                        sys.stdout.write("\t{}\n".format(cmd))
        return OK
Exemple #5
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()
Exemple #6
0
    def execute(self, server, argv):
        (options, args) = parser.parse_args(argv)

        cmd = get_command(args, None)
        if cmd == 'optimize':
            optimize(server, options)
        elif cmd == 'gc':
            garbage_collect(server, options)
        else:
            parser.print_help()
Exemple #7
0
    def execute(self, server, argv):
        (options, args) = parser.parse_args(argv)

        cmd = get_command(args, None)
        if cmd == 'optimize':
            optimize(server, options)
        elif cmd == 'gc':
            garbage_collect(server, options)
        else:
            parser.print_help()
Exemple #8
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()
Exemple #9
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
Exemple #10
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
Exemple #11
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
Exemple #12
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
Exemple #13
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
Exemple #14
0
    def execute(self, _, argv):
        (options, args) = parser.parse_args(argv)

        arg = get_command(args, '_tools')
        if arg == '_tools':
            print_tools(sys.stdout, options.compact)
        elif arg == '_servers':
            print_servers(sys.stdout)
        else:
            _tool = get_tool(arg)
            if options.compact:
                for cmd in _tool.commands:
                    sys.stdout.write("{}\n".format(cmd))
            else:
                sys.stdout.write("Available commands:\n")
                for cmd in _tool.commands:
                    sys.stdout.write("    {}\n".format(cmd))
            return OK
Exemple #15
0
    def execute(self, _, argv):
        (options, args) = parser.parse_args(argv)

        arg = get_command(args, '_tools')
        if arg == '_tools':
            print_tools(sys.stdout, options.compact)
        elif arg == '_servers':
            print_servers(sys.stdout)
        else:
            _tool = get_tool(arg)
            if options.compact:
                for cmd in _tool.commands:
                    sys.stdout.write("{}\n".format(cmd))
            else:
                sys.stdout.write("Available commands:\n")
                for cmd in _tool.commands:
                    sys.stdout.write("    {}\n".format(cmd))
            return OK