Skip to content

Need a way to list agents from the command line with filtering. #982

@ajzobro

Description

@ajzobro

It would be great if there was a way to list the agents meeting various criteria such as filtering by regular expression on provision_type, location, name, comment, status.

The listing should be able to output as a single-name-per-line like ls -1 for easy looping, and display a nice table view in other cases with user-specifiable fields, as well as a summary of the results rather than a list or table.

testflinger list-agents --help
usage: testflinger list-agents [-h] [-1] [--summary]
                               [--status {online,offline,maintenance,waiting,setup,provision,firmware_update,test,allocate,reserve,cleanup}]
                               [--filter-name FILTER_NAME] [--filter-queues FILTER_QUEUES]
                               [--filter-location FILTER_LOCATION]
                               [--filter-provision_type FILTER_PROVISION_TYPE]
                               [--filter-comment FILTER_COMMENT] [--fields FIELDS]

options:
  -h, --help            show this help message and exit
  -1                    Single agent name per line (suitable for piping)
  --summary             Show summary of online/offline agent counts
  --status {online,offline,maintenance,waiting,setup,provision,firmware_update,test,allocate,reserve,cleanup}
                        Filter agents by status (gross: online/offline/maintenance or fine: waiting, setup,
                        provision, firmware_update, test, allocate, reserve, cleanup)
  --filter-name FILTER_NAME
                        Filter agents by name (regex)
  --filter-queues FILTER_QUEUES
                        Filter agents by queues (regex, matches any queue)
  --filter-location FILTER_LOCATION
                        Filter agents by location (regex)
  --filter-provision_type FILTER_PROVISION_TYPE
                        Filter agents by provision_type (regex)
  --filter-comment FILTER_COMMENT
                        Filter agents by comment (regex)
  --fields FIELDS       Fields to display in the agent table (comma-separated). Available fields: name,
                        status, location, provision_type, comment, job_id, queues. Default:
                        name,status,location,provision_type,comment

See list-agents branch.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions