Bug 1190857

Summary: hammer pagination output should be disabled by default or respect terminal size
Product: Red Hat Satellite Reporter: Mike McCune <mmccune>
Component: HammerAssignee: Tomas Strachota <tstrachota>
Status: CLOSED CURRENTRELEASE QA Contact: Tazim Kolhar <tkolhar>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.1.0CC: bbuckingham, bkearney, chrobert, cwelton, pgervase, sthirugn, tkolhar
Target Milestone: UnspecifiedKeywords: Triaged, Unconfirmed
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
URL: http://projects.theforeman.org/issues/10534
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-08-12 13:59:28 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Mike McCune 2015-02-09 19:31:41 UTC
Most if not all Linux/Unix commands do not have pagination built in by default and users rely on pipes to more/less to control the page size of output.

By default hammer ships with a very small 25 line pagination setting which is bothersome as a user who wants to view more input.

Most users outside of an actual 80x25 line terminal will have way more screen real-estate beyond the 25 we ship with now.

There is also no argument available to disable paging so users are forced to know to edit a config file to adjust this value.

Ideally the pagination would be disabled entirely by default and could optionally be turned on.

Currently we have to advocate users putting in arbitrarily large values to 'disable' pagination, eg:

  :per_page: 9999

Comment 1 RHEL Program Management 2015-02-09 19:33:15 UTC
Since this issue was entered in Red Hat Bugzilla, the release flag has been
set to ? to ensure that it is properly evaluated for this release.

Comment 3 Mike McCune 2015-02-09 23:32:40 UTC
CONFIG FILE:

/etc/hammer/cli_config.yml

update :per_page


:ui:
  :interactive: true
  :per_page: 9999
  :history_file: '~/.foreman/history'

Comment 7 Tomas Strachota 2015-05-18 13:18:45 UTC
Created redmine issue http://projects.theforeman.org/issues/10534 from this bug

Comment 8 Bryan Kearney 2015-05-26 10:04:08 UTC
Moving to POST since upstream bug http://projects.theforeman.org/issues/10534 has been closed
-------------
Anonymous
Applied in changeset commit:hammer-cli-foreman|135c18b56f642554707571fc5a58708706089bb6.

Comment 12 Tazim Kolhar 2015-05-28 10:04:09 UTC
VERIFIED:
# rpm -qa | grep foreman
foreman-1.7.2.25-1.el7sat.noarch
ruby193-rubygem-foreman-tasks-0.6.12.5-1.el7sat.noarch
ruby193-rubygem-foreman_gutterball-0.0.1.9-1.el7sat.noarch
hp-ml150g6-01.rhts.eng.bos.redhat.com-foreman-proxy-client-1.0-1.noarch
ruby193-rubygem-foreman_docker-1.2.0.14-1.el7sat.noarch
foreman-debug-1.7.2.25-1.el7sat.noarch
foreman-ovirt-1.7.2.25-1.el7sat.noarch
ruby193-rubygem-foreman-redhat_access-0.1.0-1.el7sat.noarch
rubygem-hammer_cli_foreman_bootdisk-0.1.2.7-1.el7sat.noarch
rubygem-hammer_cli_foreman_docker-0.0.3.6-1.el7sat.noarch
foreman-selinux-1.7.2.13-1.el7sat.noarch
ruby193-rubygem-foreman_bootdisk-4.0.2.13-1.el7sat.noarch
foreman-vmware-1.7.2.25-1.el7sat.noarch
ruby193-rubygem-foreman_hooks-0.3.7-2.el7sat.noarch
rubygem-hammer_cli_foreman_discovery-0.0.1.10-1.el7sat.noarch
foreman-proxy-1.7.2.4-1.el7sat.noarch
hp-ml150g6-01.rhts.eng.bos.redhat.com-foreman-client-1.0-1.noarch
hp-ml150g6-01.rhts.eng.bos.redhat.com-foreman-proxy-1.0-2.noarch
foreman-gce-1.7.2.25-1.el7sat.noarch
rubygem-hammer_cli_foreman-0.1.4.12-1.el7sat.noarch
foreman-compute-1.7.2.25-1.el7sat.noarch
ruby193-rubygem-foreman_discovery-2.0.0.14-1.el7sat.noarch
rubygem-hammer_cli_foreman_tasks-0.0.3.4-1.el7sat.noarch
foreman-libvirt-1.7.2.25-1.el7sat.noarch
foreman-postgresql-1.7.2.25-1.el7sat.noarch

steps:
# cat cli_config.yml 
:ui:
  :interactive: true
  :per_page: 9999
  :history_file: '~/.foreman/history'

per_page updated

Comment 13 Tomas Strachota 2015-05-28 11:47:08 UTC
Per irc discussion with Tazim, switching back to ON_QA as it has shown up the steps actually verified something different.

Correct steps:
1. create $enough resources of some type (e.g. hosts, architectures), where $enough is number higher than value of your :per_page: setting
2. use hammer to list resources of that type (e.g. hammer host list)
3. hammer should show all resources in the system

Additional checks:
1) when you use `hammer host list --per-page=5` only first 5 items are shown
2) when you use `hammer host list --per-page=5 --page=2` only second 5 items are shown
3) when you use `hammer host list --page=2` only second page is shown, respecting :per_page: setting from the config file

Comment 14 Tazim Kolhar 2015-05-29 07:16:19 UTC
VERIFIED:
 rpm -qa | grep foreman
foreman-1.7.2.25-1.el7sat.noarch
ruby193-rubygem-foreman-tasks-0.6.12.5-1.el7sat.noarch
ruby193-rubygem-foreman_gutterball-0.0.1.9-1.el7sat.noarch
hp-ml150g6-01.rhts.eng.bos.redhat.com-foreman-proxy-client-1.0-1.noarch
ruby193-rubygem-foreman_docker-1.2.0.14-1.el7sat.noarch
foreman-debug-1.7.2.25-1.el7sat.noarch
foreman-ovirt-1.7.2.25-1.el7sat.noarch
ruby193-rubygem-foreman-redhat_access-0.1.0-1.el7sat.noarch
rubygem-hammer_cli_foreman_bootdisk-0.1.2.7-1.el7sat.noarch
rubygem-hammer_cli_foreman_docker-0.0.3.6-1.el7sat.noarch
foreman-selinux-1.7.2.13-1.el7sat.noarch
ruby193-rubygem-foreman_bootdisk-4.0.2.13-1.el7sat.noarch
foreman-vmware-1.7.2.25-1.el7sat.noarch
ruby193-rubygem-foreman_hooks-0.3.7-2.el7sat.noarch
rubygem-hammer_cli_foreman_discovery-0.0.1.10-1.el7sat.noarch
foreman-proxy-1.7.2.4-1.el7sat.noarch
hp-ml150g6-01.rhts.eng.bos.redhat.com-foreman-client-1.0-1.noarch
hp-ml150g6-01.rhts.eng.bos.redhat.com-foreman-proxy-1.0-2.noarch
foreman-gce-1.7.2.25-1.el7sat.noarch
rubygem-hammer_cli_foreman-0.1.4.12-1.el7sat.noarch
foreman-compute-1.7.2.25-1.el7sat.noarch
ruby193-rubygem-foreman_discovery-2.0.0.14-1.el7sat.noarch
rubygem-hammer_cli_foreman_tasks-0.0.3.4-1.el7sat.noarch
foreman-libvirt-1.7.2.25-1.el7sat.noarch
foreman-postgresql-1.7.2.25-1.el7sat.noarch

steps:

# hammer host list --per-page=5
[Foreman] Username: admin
[Foreman] Password for admin: 
---|------------------------------------------|---------------------------------------------------------------|------------|-------------|------------------
ID | NAME                                     | OPERATING SYSTEM                                              | HOST GROUP | IP          | MAC              
---|------------------------------------------|---------------------------------------------------------------|------------|-------------|------------------
9  | acuxupi.dpw8denxxa                       | 䫡椭膀呗砷斆䤶缻嶒꿙訔䫫疜谗諎㯀츤ۓ㩣겥㟕 9                  |            |             | ee:a8:42:7c:ad:33
4  | chcuuyjjsdldjzpty.1txbkggv6x             | ℵ㠡ﵐ飋㿚쥔箵顚簂烾䖳䃾꾰頾ﵳЭ㐷赴慁㷅妙㯀呍ⰈចணƗ嵓 2901 |            |             | 46:cc:7f:a8:b3:02
1  | hp-sl2x170zg6-02.rhts.eng.bos.redhat.com |                                                               |            |             |                  
2  | hp-sl2x170zg6-02.rhts.eng.bos.redhat.com | RHEL Server 7.1                                               |            | 10.16.66.31 | 00:25:b3:20:34:f4
8  | ljayvyxkpjczvdlovsy.gioat1xyht           | 稯玛웤贛缕璛秔涁혴쌩Ⳑ㤁掭맻犠ힶ眈㛊㶞ꊛ뚎졿唼揚琌 4106       |            |             | 41:c1:b7:f9:df:54
---|------------------------------------------|---------------------------------------------------------------|------------|-------------|------------------
List next page? (Y/n): n

# hammer host list --per-page=5 --page=2
[Foreman] Username: admin
[Foreman] Password for admin: 
---|----------------------------------|------------------------------------------------------|---------------|---------------|------------------
ID | NAME                             | OPERATING SYSTEM                                     | HOST GROUP    | IP            | MAC              
---|----------------------------------|------------------------------------------------------|---------------|---------------|------------------
7  | r.dd9u6dqlyb                     | Ế迼䊋Ⴁ폂秤꼧甀辷谽鈊뀻覮ꜘ観ѐꯚ呄꿨ஓ踸酋涺붻 807 |               |               | 2f:cd:b6:e5:d8:fc
11 | test1.rhts.eng.bos.redhat.com    | RedHat 6.6                                           | test_host_grp | 192.168.100.4 | 52:54:00:67:ac:d5
10 | testhost.rhts.eng.bos.redhat.com | RedHat 6.6                                           | test_host_grp | 192.168.100.2 | 52:54:00:65:de:8d
5  | zutsaiaadnokvspfkjsnk.vuorndju8l | 嬫 61                                                |               |               | ad:de:c5:38:94:8d
---|----------------------------------|------------------------------------------------------|---------------|---------------|------------------


# hammer host list --page=2
[Foreman] Username: admin
[Foreman] Password for admin: 
---|------------------------------------------|------------------|------------|-------------|------------------
ID | NAME                                     | OPERATING SYSTEM | HOST GROUP | IP          | MAC              
---|------------------------------------------|------------------|------------|-------------|------------------
2  | hp-sl2x170zg6-02.rhts.eng.bos.redhat.com | RHEL Server 7.1  |            | 10.16.66.31 | 00:25:b3:20:34:f4
1  | hp-sl2x170zg6-02.rhts.eng.bos.redhat.com |                  |            |             |                  
---|------------------------------------------|------------------|------------|-------------|------------------
List next page? (Y/n): y
---|--------------------------------|---------------------------------------------------------|------------|----|------------------
ID | NAME                           | OPERATING SYSTEM                                        | HOST GROUP | IP | MAC              
---|--------------------------------|---------------------------------------------------------|------------|----|------------------
8  | ljayvyxkpjczvdlovsy.gioat1xyht | 稯玛웤贛缕璛秔涁혴쌩Ⳑ㤁掭맻犠ힶ眈㛊㶞ꊛ뚎졿唼揚琌 4106 |            |    | 41:c1:b7:f9:df:54
7  | r.dd9u6dqlyb                   | Ế迼䊋Ⴁ폂秤꼧甀辷谽鈊뀻覮ꜘ観ѐꯚ呄꿨ஓ踸酋涺붻 807    |            |    | 2f:cd:b6:e5:d8:fc
---|--------------------------------|---------------------------------------------------------|------------|----|------------------
List next page? (Y/n): n

Comment 16 Tazim Kolhar 2015-06-01 12:36:13 UTC
VERIFIED:
# rpm -qa | grep foreman
foreman-1.7.2.25-1.el7sat.noarch
ruby193-rubygem-foreman-tasks-0.6.12.5-1.el7sat.noarch
ruby193-rubygem-foreman_gutterball-0.0.1.9-1.el7sat.noarch
hp-ml150g6-01.rhts.eng.bos.redhat.com-foreman-proxy-client-1.0-1.noarch
ruby193-rubygem-foreman_docker-1.2.0.14-1.el7sat.noarch
foreman-debug-1.7.2.25-1.el7sat.noarch
foreman-ovirt-1.7.2.25-1.el7sat.noarch
ruby193-rubygem-foreman-redhat_access-0.1.0-1.el7sat.noarch
rubygem-hammer_cli_foreman_bootdisk-0.1.2.7-1.el7sat.noarch
rubygem-hammer_cli_foreman_docker-0.0.3.6-1.el7sat.noarch
foreman-selinux-1.7.2.13-1.el7sat.noarch
ruby193-rubygem-foreman_bootdisk-4.0.2.13-1.el7sat.noarch
foreman-vmware-1.7.2.25-1.el7sat.noarch
ruby193-rubygem-foreman_hooks-0.3.7-2.el7sat.noarch
rubygem-hammer_cli_foreman_discovery-0.0.1.10-1.el7sat.noarch
foreman-proxy-1.7.2.4-1.el7sat.noarch
hp-ml150g6-01.rhts.eng.bos.redhat.com-foreman-client-1.0-1.noarch
hp-ml150g6-01.rhts.eng.bos.redhat.com-foreman-proxy-1.0-2.noarch
foreman-gce-1.7.2.25-1.el7sat.noarch
rubygem-hammer_cli_foreman-0.1.4.12-1.el7sat.noarch
foreman-compute-1.7.2.25-1.el7sat.noarch
ruby193-rubygem-foreman_discovery-2.0.0.14-1.el7sat.noarch
rubygem-hammer_cli_foreman_tasks-0.0.3.4-1.el7sat.noarch
foreman-libvirt-1.7.2.25-1.el7sat.noarch
foreman-postgresql-1.7.2.25-1.el7sat.noarch


steps:
# hammer host list --per-page=4
[Foreman] Username: admin
[Foreman] Password for admin: changeme

---|----------------------------------------|------------------|---------------|----------------|------------------
ID | NAME                                   | OPERATING SYSTEM | HOST GROUP    | IP             | MAC              
---|----------------------------------------|------------------|---------------|----------------|------------------
2  | dell-pe1955-02.rhts.eng.bos.redhat.com | RHEL Server 7.1  |               | 10.16.65.123   | 00:14:22:74:d6:d8
1  | ibm-hs21-04.lab.bos.redhat.com         | RHEL Server 7.1  |               | 10.16.45.161   | 00:1b:21:29:e3:d4
5  | test1.lab.bos.redhat.com               | RedHat 6.6       | test_host_grp | 192.168.100.9  | 52:54:00:4c:69:db
6  | test2.lab.bos.redhat.com               | RedHat 6.6       | test_host_grp | 192.168.100.11 | 52:54:00:08:95:f0
---|----------------------------------------|------------------|---------------|----------------|------------------


# hammer host list --per-page=2 --page=2
[Foreman] Username: admin
[Foreman] Password for admin: 
---|--------------------------|------------------|---------------|----------------|------------------
ID | NAME                     | OPERATING SYSTEM | HOST GROUP    | IP             | MAC              
---|--------------------------|------------------|---------------|----------------|------------------
5  | test1.lab.bos.redhat.com | RedHat 6.6       | test_host_grp | 192.168.100.9  | 52:54:00:4c:69:db
6  | test2.lab.bos.redhat.com | RedHat 6.6       | test_host_grp | 192.168.100.11 | 52:54:00:08:95:f0
---|--------------------------|------------------|---------------|----------------|------------------


# hammer host list --page=2
[Foreman] Username: admin
[Foreman] Password for admin: changeme

---|--------------------------|------------------|---------------|----------------|------------------
ID | NAME                     | OPERATING SYSTEM | HOST GROUP    | IP             | MAC              
---|--------------------------|------------------|---------------|----------------|------------------
5  | test1.lab.bos.redhat.com | RedHat 6.6       | test_host_grp | 192.168.100.9  | 52:54:00:4c:69:db
6  | test2.lab.bos.redhat.com | RedHat 6.6       | test_host_grp | 192.168.100.11 | 52:54:00:08:95:f0
---|--------------------------|------------------|---------------|----------------|------------------

Comment 17 Bryan Kearney 2015-08-11 13:24:47 UTC
This bug is slated to be released with Satellite 6.1.

Comment 18 Bryan Kearney 2015-08-12 13:59:28 UTC
This bug was fixed in version 6.1.1 of Satellite which was released on 12 August, 2015.