コード例 #1
0
ファイル: ldap.py プロジェクト: UPCnet/gummanager.cli
    def list_users(self, **kwargs):
        """
            Prints a list of all the users of the branch specified by <branch-name>, sorted by username
            You can filter the results (case insensitive) with the --filter=<text> option
        """

        branch_name = getOptionFrom(kwargs, 'branch-name', None)
        u_filter = getOptionFrom(kwargs, 'filter', default=None)

        users = run_recipe_without_confirmation(
            self.Server.list_users,
            branch_name,
            filter=u_filter
        )

        table = GUMTable(hrules='FRAME')
        table.from_dict_list(
            users,
            formatters={
                'name': highlighter(default='bold_yellow')
            },
            titles={
                'name': 'Username',
                'sn': 'SN'
            })
        print table.sorted('name')
コード例 #2
0
ファイル: max.py プロジェクト: UPCnet/gummanager.cli
    def list_instances(self, **kwargs):
        """
            Lists all existing max instances.

            This list will include instances that are not actually running and instances
            that are not even loaded on supervisor, for example old instances that are
            pending to delete.
        """
        maxserver = self.Server
        instances = maxserver.get_instances()
        table = GUMTable()
        table.from_dict_list(
            instances,
            hide=["circus_tcp", "mongo_database"],
            formatters={
                'name': highlighter(default='bold_yellow'),
            },
            titles={
                'name': 'Name',
                'port_index': 'Index',
                'server': 'Server access',
                'ldap': 'Ldap configuration',
                'circus': ' Circus'
            })
        print table.sorted('port_index')
コード例 #3
0
ファイル: genweb.py プロジェクト: UPCnet/gummanager.cli
 def list_instances(self, **kwargs):
     instances = self.Server.get_instances()
     table = GUMTable()
     table.from_dict_list(
         instances,
         formatters={
             'environment': highlighter(default='bold_yellow'),
         },
         titles={
             'name': 'Name',
         })
     print table.sorted('environment')
コード例 #4
0
ファイル: max.py プロジェクト: UPCnet/gummanager.cli
    def status(self, **kwargs):
        """
            Lists status for one or all active max instances.

            The status listed here is the status reported by supervisor. There's
            a special status 'not found'. Instances on this state are  that are created,
            but already not loaded into supervisor.
        """
        instance_name = getOptionFrom(kwargs, 'instance-name', default='all')

        oauth = self.Server
        instances = oauth.get_instances()
        if instance_name != 'all':
            instances = [instance for instance in instances if instance['name'] == instance_name]

        statuses = []
        for instance in instances:
            status = oauth.get_status(instance['name'])
            statuses.append(status)

        table = GUMTable()
        table.from_dict_list(
            statuses,
            formatters={
                'name': highlighter(default='bold_yellow'),
                'status': highlighter(values={
                    'running': 'green',
                    'unknown': 'red',
                    'down': 'red',
                    'backoff': 'red',
                    'fatal': 'red',
                    'not found': 'cyan',
                    'stopped': 'red'}

                )
            },
            titles={
                'name': 'Name',
                'status': 'Status',
                'pid': 'PID',
                'uptime': 'Started',
                'server': 'Server access'
            })
        print table.sorted('name')
コード例 #5
0
ファイル: ldap.py プロジェクト: UPCnet/gummanager.cli
    def list_branches(self, **kwargs):
        """
            Prints a list of all the branches on the ldap server
            For each branch, a count of users and groups is displayed
        """
        branches = run_recipe_without_confirmation(
            self.Server.list_branches
        )

        table = GUMTable()
        table.from_dict_list(
            branches,
            formatters={
                'groups': get_length,
                'users': get_length
            },
            titles={
                'name': 'Name',
                'groups': 'Groups',
                'users': 'Users'
            })
        print table.sorted('name')