Exemplo n.º 1
0
 def take_action(self, parsed_args):
     self.log.debug('take_action(%s)' % parsed_args)
     client = self.app.client_manager.congressclient
     results = client.list_datasources()
     datasource_id = utils.get_resource_id_from_name(
         parsed_args.datasource, results)
     client.request_refresh(datasource_id, {})
 def take_action(self, parsed_args):
     self.log.debug('take_action(%s)' % parsed_args)
     client = self.app.client_manager.congressclient
     results = client.list_datasources()
     datasource_id = utils.get_resource_id_from_name(
         parsed_args.datasource, results)
     client.request_refresh(datasource_id, {})
Exemplo n.º 3
0
 def take_action(self, parsed_args):
     self.log.debug('take_action(%s)' % parsed_args)
     client = self.app.client_manager.congressclient
     results = client.list_policy_rules(parsed_args.policy_name)
     rule_id = utils.get_resource_id_from_name(parsed_args.rule_id, results)
     data = client.show_policy_rule(parsed_args.policy_name, rule_id)
     return zip(*sorted(six.iteritems(data)))
Exemplo n.º 4
0
 def take_action(self, parsed_args):
     self.log.debug('take_action(%s)' % parsed_args)
     client = self.app.client_manager.congressclient
     results = client.list_policy_rules(parsed_args.policy_name)
     rule_id = utils.get_resource_id_from_name(
         parsed_args.rule_id, results)
     client.delete_policy_rule(parsed_args.policy_name, rule_id)
Exemplo n.º 5
0
 def take_action(self, parsed_args):
     self.log.debug('take_action(%s)' % parsed_args)
     client = self.app.client_manager.congressclient
     results = client.list_policy()
     policy_id = utils.get_resource_id_from_name(
         parsed_args.policy_name, results)
     data = client.show_policy(policy_id)
     return zip(*sorted(six.iteritems(data)))
    def take_action(self, parsed_args):
        self.log.debug('take_action(%s)' % parsed_args)
        client = self.app.client_manager.congressclient

        results = client.list_datasources()
        datasource_id = utils.get_resource_id_from_name(
            parsed_args.datasource_name, results)

        data = client.list_datasource_status(datasource_id)
        return zip(*sorted(six.iteritems(data)))
 def take_action(self, parsed_args):
     self.log.debug('take_action(%s)' % parsed_args)
     client = self.app.client_manager.congressclient
     results = client.list_datasources()
     datasource_id = utils.get_resource_id_from_name(
         parsed_args.datasource_name, results)
     data = client.show_datasource_table_schema(datasource_id,
                                                parsed_args.table_name)
     columns = ['name', 'description']
     return (columns, (utils.get_dict_properties(s, columns)
                       for s in data['columns']))
Exemplo n.º 8
0
 def take_action(self, parsed_args):
     self.log.debug('take_action(%s)' % parsed_args)
     # set default max-width
     if parsed_args.max_width == 0:
         parsed_args.max_width = 80
     client = self.app.client_manager.congressclient
     results = client.list_policy_rules(parsed_args.policy_name)
     rule_id = utils.get_resource_id_from_name(
         parsed_args.rule_id, results)
     data = client.show_policy_rule(parsed_args.policy_name, rule_id)
     return zip(*sorted(six.iteritems(data)))
 def take_action(self, parsed_args):
     self.log.debug('take_action(%s)' % parsed_args)
     client = self.app.client_manager.congressclient
     results = client.list_datasources()
     datasource_id = utils.get_resource_id_from_name(
         parsed_args.datasource_name, results)
     data = client.list_datasource_tables(datasource_id)['results']
     columns = ['id']
     formatters = {'DatasourceTables': utils.format_list}
     return (columns,
             (utils.get_dict_properties(s, columns,
                                        formatters=formatters)
              for s in data))
Exemplo n.º 10
0
 def take_action(self, parsed_args):
     self.log.debug('take_action(%s)' % parsed_args)
     client = self.app.client_manager.congressclient
     results = client.list_datasources()
     datasource_id = utils.get_resource_id_from_name(
         parsed_args.datasource_name, results)
     data = client.show_datasource_table_schema(
         datasource_id,
         parsed_args.table_name)
     columns = ['name', 'description']
     return (columns,
             (utils.get_dict_properties(s, columns)
              for s in data['columns']))
Exemplo n.º 11
0
 def take_action(self, parsed_args):
     self.log.debug('take_action(%s)' % parsed_args)
     client = self.app.client_manager.congressclient
     try:
         datasource_id = parsed_args.datasource
         client.delete_datasource(datasource_id)
     except Exception:
         # for backwards compatibility with pre-Ocata congress server,
         # try old method of explicit conversion from name to UUID
         results = client.list_datasources()
         datasource_id = utils.get_resource_id_from_name(
             parsed_args.datasource, results)
         client.delete_datasource(datasource_id)
Exemplo n.º 12
0
 def take_action(self, parsed_args):
     self.log.debug('take_action(%s)' % parsed_args)
     client = self.app.client_manager.congressclient
     try:
         datasource_id = parsed_args.datasource
         client.delete_datasource(datasource_id)
     except Exception:
         # for backwards compatibility with pre-Ocata congress server,
         # try old method of explicit conversion from name to UUID
         results = client.list_datasources()
         datasource_id = utils.get_resource_id_from_name(
             parsed_args.datasource, results)
         client.delete_datasource(datasource_id)
Exemplo n.º 13
0
 def take_action(self, parsed_args):
     self.log.debug('take_action(%s)' % parsed_args)
     client = self.app.client_manager.congressclient
     results = client.list_datasources()
     datasource_id = utils.get_resource_id_from_name(
         parsed_args.datasource_name, results)
     data = client.list_datasource_tables(datasource_id)['results']
     columns = ['id']
     formatters = {'DatasourceTables': utils.format_list}
     return (columns, (utils.get_dict_properties(s,
                                                 columns,
                                                 formatters=formatters)
                       for s in data))
Exemplo n.º 14
0
 def take_action(self, parsed_args):
     self.log.debug('take_action(%s)' % parsed_args)
     client = self.app.client_manager.congressclient
     results = client.list_datasources()
     datasource_id = utils.get_resource_id_from_name(
         parsed_args.datasource_name, results)
     data = client.show_datasource_schema(datasource_id)
     formatters = {'columns': utils.format_long_dict_list}
     newdata = [{'table': x['table_id'],
                 'columns': x['columns']}
                for x in data['tables']]
     columns = ['table', 'columns']
     return (columns,
             (utils.get_dict_properties(s, columns,
                                        formatters=formatters)
              for s in newdata))
Exemplo n.º 15
0
    def take_action(self, parsed_args):
        self.log.debug('take_action(%s)' % parsed_args)
        client = self.app.client_manager.congressclient

        results = client.list_datasources()
        datasource_id = utils.get_resource_id_from_name(
            parsed_args.datasource_name, results)
        results = client.list_datasource_rows(datasource_id,
                                              parsed_args.table)['results']
        if results:
            columns = client.show_datasource_table_schema(
                datasource_id, parsed_args.table)['columns']
            columns = [col['name'] for col in columns]
        else:
            columns = ['data']  # doesn't matter because the rows are empty
        return (columns, (x['data'] for x in results))
Exemplo n.º 16
0
    def take_action(self, parsed_args):
        self.log.debug('take_action(%s)' % parsed_args)
        client = self.app.client_manager.congressclient

        results = client.list_datasources()
        datasource_id = utils.get_resource_id_from_name(
            parsed_args.datasource_name, results)
        results = client.list_datasource_rows(datasource_id,
                                              parsed_args.table)['results']
        if results:
            columns = client.show_datasource_table_schema(
                datasource_id, parsed_args.table)['columns']
            columns = [col['name'] for col in columns]
        else:
            columns = ['data']  # doesn't matter because the rows are empty
        return (columns, (x['data'] for x in results))
Exemplo n.º 17
0
 def take_action(self, parsed_args):
     self.log.debug('take_action(%s)' % parsed_args)
     client = self.app.client_manager.congressclient
     results = client.list_datasources()
     datasource_id = utils.get_resource_id_from_name(
         parsed_args.datasource_name, results)
     data = client.show_datasource_schema(datasource_id)
     formatters = {'columns': utils.format_long_dict_list}
     newdata = [{
         'table': x['table_id'],
         'columns': x['columns']
     } for x in data['tables']]
     columns = ['table', 'columns']
     return (columns, (utils.get_dict_properties(s,
                                                 columns,
                                                 formatters=formatters)
                       for s in newdata))
Exemplo n.º 18
0
    def take_action(self, parsed_args):
        self.log.debug('take_action(%s)' % parsed_args)
        # as we know output it's long, limit column length here
        if parsed_args.max_width == 0:
            parsed_args.max_width = 40

        client = self.app.client_manager.congressclient

        results = client.list_datasources()
        datasource_id = utils.get_resource_id_from_name(
            parsed_args.datasource_name, results)

        data = client.list_datasource_actions(datasource_id)
        formatters = {'args': utils.format_long_dict_list}
        newdata = [{'action': x['name'],
                    'args': x['args'],
                    'description': x['description']}
                   for x in data['results']]
        columns = ['action', 'args', 'description']
        return (columns, (utils.get_dict_properties(s,
                                                    columns,
                                                    formatters=formatters)
                for s in newdata))
Exemplo n.º 19
0
    def take_action(self, parsed_args):
        self.log.debug('take_action(%s)' % parsed_args)
        # as we know output it's long, limit column length here
        if parsed_args.max_width == 0:
            parsed_args.max_width = 40

        client = self.app.client_manager.congressclient

        results = client.list_datasources()
        datasource_id = utils.get_resource_id_from_name(
            parsed_args.datasource_name, results)

        data = client.list_datasource_actions(datasource_id)
        formatters = {'args': utils.format_long_dict_list}
        newdata = [{
            'action': x['name'],
            'args': x['args'],
            'description': x['description']
        } for x in data['results']]
        columns = ['action', 'args', 'description']
        return (columns, (utils.get_dict_properties(s,
                                                    columns,
                                                    formatters=formatters)
                          for s in newdata))
Exemplo n.º 20
0
 def take_action(self, parsed_args):
     self.log.debug('take_action(%s)' % parsed_args)
     client = self.app.client_manager.congressclient
     results = client.list_policy_rules(parsed_args.policy_name)
     rule_id = utils.get_resource_id_from_name(parsed_args.rule_id, results)
     client.delete_policy_rule(parsed_args.policy_name, rule_id)