示例#1
0
 def print_topics(self, header, cmds, cmdlen, maxcol):
     if cmds:
         print('List of dbshell commands:')
         rows = [['?', 'Show help.']]
         for cmd in cmds:
             doc = getattr(self, 'do_' + cmd).__doc__
             if doc:
                 rows.append([cmd, doc])
         utils.print_table(rows)
         print()
示例#2
0
    def list_(self, args):
        opts = utils.CommandOptions(args)
        client = YamcsClient(**opts.client_kwargs)
        archive = client.get_archive(opts.instance)

        rows = [['NAME']]
        for table in archive.list_tables():
            rows.append([
                table.name,
            ])
        utils.print_table(rows)
示例#3
0
    def list_(self, args):
        opts = utils.CommandOptions(args)
        client = YamcsClient(**opts.client_kwargs)
        mdb = client.get_mdb(opts.instance)

        rows = [['NAME', 'DESCRIPTION']]
        for algorithm in mdb.list_algorithms():
            rows.append([
                algorithm.qualified_name,
                algorithm.description,
            ])
        utils.print_table(rows)
示例#4
0
    def list_(self, args):
        opts = utils.CommandOptions(args)
        client = YamcsClient(**opts.client_kwargs)

        rows = [['NAME', 'STATE', 'MISSION TIME']]
        for instance in client.list_instances():
            rows.append([
                instance.name,
                instance.state,
                instance.mission_time,
            ])
        utils.print_table(rows)
示例#5
0
    def list_(self, args):
        opts = utils.CommandOptions(args)
        client = YamcsClient(**opts.client_kwargs)

        rows = [['NAME', 'CLASS', 'STATUS']]
        for service in client.list_services(opts.instance):
            rows.append([
                service.name,
                service.class_name,
                service.state,
            ])
        utils.print_table(rows)
示例#6
0
    def list_(self, args):
        opts = utils.CommandOptions(args)
        client = YamcsClient(**opts.client_kwargs)
        mdb = client.get_mdb(opts.instance)

        rows = [['NAME', 'DATA SOURCE']]
        for parameter in mdb.list_parameters():
            rows.append([
                parameter.qualified_name,
                parameter.data_source,
            ])
        utils.print_table(rows)
示例#7
0
    def list_(self, args):
        opts = utils.CommandOptions(args)
        client = YamcsClient(**opts.client_kwargs)
        mdb = client.get_mdb(opts.instance)

        rows = [['NAME', 'DESCRIPTION', 'ABSTRACT']]
        for command in mdb.list_commands():
            rows.append([
                command.qualified_name,
                command.description,
                command.abstract,
            ])
        utils.print_table(rows)
示例#8
0
    def list_(self, args):
        opts = utils.CommandOptions(args)
        client = YamcsClient(**opts.client_kwargs)

        rows = [['ID', 'USER', 'APPLICATION', 'LOGIN']]
        for client in client.list_clients():
            rows.append([
                client.id,
                client.username,
                client.application_name,
                client.login_time,
            ])
        utils.print_table(rows)
示例#9
0
    def list_(self, args):
        opts = utils.CommandOptions(args)
        client = YamcsClient(**opts.client_kwargs)

        rows = [['NAME', 'CLASS', 'STATUS', 'IN', 'OUT']]
        for link in client.list_data_links(opts.instance):
            rows.append([
                link.name,
                link.class_name,
                link.status,
                link.in_count,
                link.out_count,
            ])
        utils.print_table(rows)
示例#10
0
    def list_(self, args):
        opts = utils.CommandOptions(args)
        client = YamcsClient(**opts.client_kwargs)

        rows = [[
            'NAME', 'TYPE', 'OWNER', 'PERSISTENT', 'MISSION TIME', 'STATE'
        ]]
        for processor in client.list_processors(opts.instance):
            rows.append([
                processor.name,
                processor.type,
                processor.owner,
                processor.persistent,
                processor.mission_time,
                processor.state,
            ])
        utils.print_table(rows)
示例#11
0
    def ls(self, args):
        opts = utils.CommandOptions(args)
        client = storage.Client(**opts.client_kwargs)

        if args.bucket:
            if '://' in args.bucket:
                bucket_name, prefix = args.bucket.split('://', 1)
            else:
                bucket_name = args.bucket
                prefix = None

            delimiter = '/'
            if args.recurse:
                delimiter = None

            listing = client.list_objects(opts.instance,
                                          bucket_name=bucket_name,
                                          delimiter=delimiter,
                                          prefix=prefix)
            rows = []
            for prefix in listing.prefixes:
                url = '{}://{}'.format(bucket_name, prefix)
                if args.long:
                    rows.append(['0', '', url])
                else:
                    rows.append([url])

            for obj in listing.objects:
                url = '{}://{}'.format(bucket_name, obj.name)
                if args.long:
                    rows.append(
                        [str(obj.size),
                         to_isostring(obj.created), url])
                else:
                    rows.append([url])

            utils.print_table(rows)
        else:
            for bucket in client.list_buckets(opts.instance):
                print(bucket.name)