Listing more than 20 Lifecycle Environments with hammer

Latest response

For organizations with more than 20 lifecycle environments, does anyone know a way to force hammer to display more than 20?
Example:

# hammer lifecycle-environment list --organization-label MLB_BNSF
---|---------------------|--------
ID | NAME                | PRIOR
---|---------------------|--------
62 | MLB_BNSF_SI_G54_ZAB | Library
50 | MLB_BNSF_SI_G54_TST | Library
78 | MLB_BNSF_SI_G54_RMP | Library
58 | MLB_BNSF_SI_G54_RHS | Library
66 | MLB_BNSF_SI_G54_ORA | Library
74 | MLB_BNSF_SI_G54_OEM | Library
54 | MLB_BNSF_SI_G54_MGT | Library
70 | MLB_BNSF_SI_G54_MDB | Library
46 | MLB_BNSF_SI_G54_JHQ | Library
42 | MLB_BNSF_SI_G54_JDC | Library
38 | MLB_BNSF_SI_G54_APP | Library
61 | MLB_BNSF_SI_G53_ZAB | Library
49 | MLB_BNSF_SI_G53_TST | Library
77 | MLB_BNSF_SI_G53_RMP | Library
57 | MLB_BNSF_SI_G53_RHS | Library
65 | MLB_BNSF_SI_G53_ORA | Library
73 | MLB_BNSF_SI_G53_OEM | Library
53 | MLB_BNSF_SI_G53_MGT | Library
69 | MLB_BNSF_SI_G53_MDB | Library
45 | MLB_BNSF_SI_G53_JHQ | Library
---|---------------------|--------

We have way more than what hammer is showing us.

Andy

Responses

Interesting.. the command will tell you to use --per-page, but those options aren't available

# hammer lifecycle-environment list --organization-id 1
---|---------|--------
ID | NAME    | PRIOR  
---|---------|--------
3  | PROD    | LAB    
1  | Library |        
2  | LAB     | Library
12 | 9       | Library
11 | 8       | Library
10 | 7       | Library
9  | 6       | Library
8  | 5       | Library
7  | 4       | Library
6  | 3       | Library
5  | 2       | Library
22 | 19      | Library
21 | 18      | Library
20 | 17      | Library
19 | 16      | Library
18 | 15      | Library
17 | 14      | Library
16 | 13      | Library
15 | 12      | Library
14 | 11      | Library
---|---------|--------
Page 1 of 2 (use --page and --per-page for navigation)

# hammer --per-page 100 lifecycle-environment list --organization-id 1
Error: Unrecognised option '--per-page'

See: 'hammer --help'

I don't even get the "Page 1 of ..." line at the bottom:

# hammer lifecycle-environment list --organization-id 6
---|---------------------|--------
ID | NAME                | PRIOR
---|---------------------|--------
62 | MLB_BNSF_SI_G54_ZAB | Library
50 | MLB_BNSF_SI_G54_TST | Library
78 | MLB_BNSF_SI_G54_RMP | Library
58 | MLB_BNSF_SI_G54_RHS | Library
66 | MLB_BNSF_SI_G54_ORA | Library
74 | MLB_BNSF_SI_G54_OEM | Library
54 | MLB_BNSF_SI_G54_MGT | Library
70 | MLB_BNSF_SI_G54_MDB | Library
46 | MLB_BNSF_SI_G54_JHQ | Library
42 | MLB_BNSF_SI_G54_JDC | Library
38 | MLB_BNSF_SI_G54_APP | Library
61 | MLB_BNSF_SI_G53_ZAB | Library
49 | MLB_BNSF_SI_G53_TST | Library
77 | MLB_BNSF_SI_G53_RMP | Library
57 | MLB_BNSF_SI_G53_RHS | Library
65 | MLB_BNSF_SI_G53_ORA | Library
73 | MLB_BNSF_SI_G53_OEM | Library
53 | MLB_BNSF_SI_G53_MGT | Library
69 | MLB_BNSF_SI_G53_MDB | Library
45 | MLB_BNSF_SI_G53_JHQ | Library
---|---------------------|--------

Maybe we have different Satellite versions? I'm on version 6.1.9.

hammer version:

# hammer --version
hammer (0.1.4.13)
 * hammer_cli_foreman (0.1.4.15)
 * hammer_cli_foreman_bootdisk (0.1.2.7)
 * hammer_cli_foreman_discovery (0.0.1.10)
 * hammer_cli_foreman_docker (unknown version)
 * hammer_cli_gutterball (0.0.1.3)
 * hammer_cli_import (0.10.20)

No mention of page options in hammer --help, either:

# hammer --help
Usage:
    hammer [OPTIONS] SUBCOMMAND [ARG] ...

Parameters:
 SUBCOMMAND                    subcommand
 [ARG] ...                     subcommand arguments

Subcommands:
 activation-key                Manipulate activation keys.
 architecture                  Manipulate architectures.
 auth                          Foreman connection login/logout.
 auth-source                   Manipulate auth sources.
 bootdisk                      Download boot disks
 capsule                       Manipulate capsule
 compute-resource              Manipulate compute resources.
 content-host                  Manipulate content hosts on the server
 content-report                View Content Reports
 content-view                  Manipulate content views.
 discovery                     Manipulate discovered hosts.
 discovery_rule                Manipulate discovered rules.
 docker                        Manipulate docker content
 domain                        Manipulate domains.
 environment                   Manipulate environments.
 erratum                       Manipulate errata
 fact                          Search facts.
 filter                        Manage permission filters.
 global-parameter              Manipulate global parameters.
 gpg                           Manipulate GPG Key actions on the server
 host                          Manipulate hosts.
 host-collection               Manipulate host collections
 hostgroup                     Manipulate hostgroups.
 import                        Import data exported from a Red Hat Satellite 5 instance
 lifecycle-environment         Manipulate lifecycle_environments on the server
 location                      Manipulate locations.
 medium                        Manipulate installation media.
 model                         Manipulate hardware models.
 organization                  Manipulate organizations
 os                            Manipulate operating system.
 package                       Manipulate packages.
 package-group                 Manipulate package groups
 partition-table               Manipulate partition tables.
 ping                          Get the status of the server
 product                       Manipulate products.
 proxy                         Manipulate smart proxies.
 puppet-class                  Search puppet modules.
 puppet-module                 View Puppet Module details.
 report                        Browse and read reports.
 repository                    Manipulate repositories
 repository-set                Manipulate repository sets on the server
 role                          Manage user roles.
 sc-param                      Manipulate smart class parameters.
 shell                         Interactive shell
 subnet                        Manipulate subnets.
 subscription                  Manipulate subscriptions.
 sync-plan                     Manipulate sync plans
 task                          Tasks related actions.
 template                      Manipulate config templates.
 user                          Manipulate users.
 user-group                    Manage user groups.

Options:
 --autocomplete LINE           Get list of possible endings
 --csv                         Output as CSV (same as --output=csv)
 --csv-separator SEPARATOR     Character to separate the values
 --interactive INTERACTIVE     Explicitly turn interactive mode on/off
                               One of true/false, yes/no, 1/0.
 --output ADAPTER              Set output format. One of [base, table, silent, csv, yaml, json]
 --show-ids                    Show ids of associated resources
 --version                     show version
 -c, --config CFG_FILE         path to custom config file
 -d, --debug                   show debugging output
 -h, --help                    print help
 -p, --password PASSWORD       password to access the remote system
 -r, --reload-cache            force reload of Apipie cache
 -s, --server SERVER           remote system address
 -u, --username USERNAME       username to access the remote system
 -v, --verbose                 be verbose

On Satellite 6.2

# hammer --version
hammer (0.5.1.11)

But this looks like a bug or maybe RFE. I'd open a bz on http://bugzilla.redhat.com for it

Found the answer from a previous bugzilla: (https://bugzilla.redhat.com/show_bug.cgi?id=1247781) It's a configurable in /etc/hammer/cli_config.yml:

# cat /etc/hammer/cli_config.yml
:ui:
  :interactive: true
  :per_page: 20
  :history_file: '~/.foreman/history'


# enable/disable color output of logger in Clamp commands
:watch_plain: false

:log_dir: '~/.foreman/log'
:log_level: 'error'
:log_api_calls: false
#:log_owner: 'foreman'
#:log_group: 'foreman'
#:log_size: 5 #MB

Thanks for leading me there, Will, and for promptly replying to my question.

Andy

I have one more update on this in case someone is also running into this. The --page and --per-page options are available on some hammer list commands but not on hammer lifecycle-environment list, even though it guides you to use the options in the output.

Red hat opened a bugzilla on this for me at https://bugzilla.redhat.com/show_bug.cgi?id=1368590

Andy

I am running into this myself this week. I am surprised the fixes didn't show up in 6.2.9.

Seems to also be an issue with the host package list:

hammer> host package list --host server1.example.com --per-page 100 Error: Unrecognised option '--per-page'

See: ' host package list --help'

Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.