Bug 1305055

Summary: [Sat6] hammer content-view filter rule list shows only 20 entries
Product: Red Hat Satellite Reporter: Stuart Auchterlonie <sauchter>
Component: Content ManagementAssignee: Andrew Kofink <akofink>
Status: CLOSED ERRATA QA Contact: Adam Ruzicka <aruzicka>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.1.6CC: aruzicka, bbuckingham, bkearney, cwelton, mmccune, sthirugn, tstrachota
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
URL: http://projects.theforeman.org/issues/15274
Whiteboard:
Fixed In Version: rubygem-hammer_cli_foreman-0.5.1.9-1 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-07-27 11:13:53 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:
Bug Depends On:    
Bug Blocks: 1316897    

Description Stuart Auchterlonie 2016-02-05 13:32:26 UTC
Description of problem:

Trying to view the rules for a filter via hammer results
in showing only 20 entries.

--full-results appears to be unimplemented

Version-Release number of selected component (if applicable):

Sat 6.1.6

How reproducible:

100%

Steps to Reproduce:
- Create a content view filter with more than 20 entries
1. hammer --username=admin --password=<password> content-view filter create --organization=org-example --content-view='filter test' --name='test_filter' --inclusion=true --type=rpm
2. hammer --username=admin --password=<password> content-view filter rule create --organization=org-example --content-view='filter test' --content-view-filter='test_filter' --name a 
3. Repeat the above until you have > 20
4. hammer --username=admin --password=<password> content-view filter rule list --organization=org-example --content-view='filter test' --content-view-filter='test_filter'

Actual results:

Only 20 rules are show

Expected results:

As the default across hammer seems to be 20 items per page,
we should implement `--full-results` so that all results 
can be returned.

Additional info:

See also https://bugzilla.redhat.com/show_bug.cgi?id=1202050
which implemented this for `hammer content-view list` and
`hammer puppet-module list`

Same applies to filter list, there is no --full-results implemented

Comment 5 Andrew Kofink 2016-03-07 15:26:24 UTC
Tested in upstream (hammer_cli_katello 0.0.23, hammer_cli_foreman 0.6.0) and in Satellite 6 (tfm-rubygem-katello-3.0.0.4-1.el7sat.noarch). Unable to reproduce.

Comment 6 Tazim Kolhar 2016-03-22 07:26:15 UTC
FAILEDQA:

# rpm -qa | grep foreman
tfm-rubygem-foreman_gutterball-0.0.1-6.el7sat.noarch
ibm-x3550m3-09.lab.eng.brq.redhat.com-foreman-proxy-1.0-1.noarch
foreman-selinux-1.11.0-1.el7sat.noarch
tfm-rubygem-foreman_theme_satellite-0.1.2-1.el7sat.noarch
tfm-rubygem-hammer_cli_foreman-0.5.1.2-1.el7sat.noarch
tfm-rubygem-foreman_openscap-0.5.3.0-1.el7sat.noarch
ibm-x3550m3-09.lab.eng.brq.redhat.com-foreman-client-1.0-1.noarch
tfm-rubygem-hammer_cli_foreman_tasks-0.0.10-2.el7sat.noarch
foreman-compute-1.11.0.6-1.el7sat.noarch
tfm-rubygem-foreman_bootdisk-6.1.0-1.el7sat.noarch
foreman-gce-1.11.0.6-1.el7sat.noarch
foreman-postgresql-1.11.0.6-1.el7sat.noarch
foreman-proxy-1.11.0.1-1.el7sat.noarch
foreman-installer-1.11.0.0-1.el7sat.noarch
tfm-rubygem-foreman-tasks-0.7.14.1-1.el7sat.noarch
foreman-vmware-1.11.0.6-1.el7sat.noarch
foreman-debug-1.11.0.6-1.el7sat.noarch
tfm-rubygem-foreman_hooks-0.3.9-2.el7sat.noarch
foreman-discovery-image-3.0.5-3.el7sat.noarch
tfm-rubygem-hammer_cli_foreman_bootdisk-0.1.3-4.el7sat.noarch
foreman-1.11.0.6-1.el7sat.noarch
foreman-ovirt-1.11.0.6-1.el7sat.noarch
foreman-libvirt-1.11.0.6-1.el7sat.noarch
tfm-rubygem-foreman_discovery-5.0.0.1-1.el7sat.noarch
foreman-installer-katello-3.0.0.3-1.el7sat.noarch
tfm-rubygem-hammer_cli_foreman_docker-0.0.3-5.el7sat.noarch
tfm-rubygem-foreman_docker-2.0.1-1.el7sat.noarch
tfm-rubygem-foreman-redhat_access-1.0.1-1.el7sat.noarch
ibm-x3550m3-09.lab.eng.brq.redhat.com-foreman-proxy-client-1.0-1.noarch
puppet-foreman_scap_client-0.3.3-10.el7sat.noarch
tfm-rubygem-foreman_remote_execution-0.3.0.1-1.el7sat.noarch

Steps:
1. Content View filter rule list
# hammer -v -d content-view filter rule list --help
[ INFO 2016-03-22 08:23:50 Init] Initialization of Hammer CLI (0.5.1.3) has started...
[DEBUG 2016-03-22 08:23:50 Init] Running at ruby 2.2.2-p95
[ INFO 2016-03-22 08:23:50 Init] Configuration from the file /etc/hammer/cli_config.yml has been loaded
[ INFO 2016-03-22 08:23:50 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman.yml has been loaded
[ INFO 2016-03-22 08:23:50 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman_bootdisk.yml has been loaded
[ INFO 2016-03-22 08:23:50 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman_docker.yml has been loaded
[ INFO 2016-03-22 08:23:50 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman_tasks.yml has been loaded
[ INFO 2016-03-22 08:23:50 Init] Configuration from the file /etc/hammer/cli.modules.d/gutterball.yml has been loaded
[ INFO 2016-03-22 08:23:50 Init] Configuration from the file /etc/hammer/cli.modules.d/import.yml has been loaded
[ INFO 2016-03-22 08:23:50 Init] Configuration from the file /etc/hammer/cli.modules.d/katello.yml has been loaded
[DEBUG 2016-03-22 08:23:51 Connection] Registered: foreman
[DEBUG 2016-03-22 08:23:51 API] Global headers: {
        :content_type => "application/json",
              :accept => "application/json;version=2",
    "Accept-Language" => "en"
}
[ INFO 2016-03-22 08:23:51 Modules] Extension module hammer_cli_foreman (0.5.1.2) loaded
[ INFO 2016-03-22 08:23:51 Modules] Extension module hammer_cli_foreman_bootdisk (0.1.3) loaded
[ INFO 2016-03-22 08:23:51 HammerCLI::MainCommand] subcommand organization (HammerCLIForeman::Organization) was removed.
[ INFO 2016-03-22 08:23:51 HammerCLI::MainCommand] subcommand organization (HammerCLIKatello::Organization) was created.
[ INFO 2016-03-22 08:23:51 Modules] Extension module hammer_cli_gutterball (1.0.1) loaded
[ INFO 2016-03-22 08:23:51 Modules] Extension module hammer_cli_import (0.10.23) loaded
[ INFO 2016-03-22 08:23:51 Modules] Extension module hammer_cli_katello (0.0.22.1) loaded
[DEBUG 2016-03-22 08:23:51 Init] Using locale 'en'
[DEBUG 2016-03-22 08:23:51 Init] 'mo' files for locale domain 'hammer-cli' loaded from '/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.5.1.3/locale'
[DEBUG 2016-03-22 08:23:51 Init] 'mo' files for locale domain 'hammer-cli-foreman' loaded from '/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.5.1.2/locale'
[DEBUG 2016-03-22 08:23:51 Init] 'mo' files for locale domain 'hammer_cli_foreman_docker' loaded from '/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman_docker-0.0.3/locale'
[DEBUG 2016-03-22 08:23:51 Init] 'mo' files for locale domain 'hammer-cli-katello' loaded from '/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_katello-0.0.22.1/locale'
[ INFO 2016-03-22 08:23:51 HammerCLI::MainCommand] Called with options: {"option_verbose"=>true, "option_debug"=>true}
Warning: Option --id is deprecated. This option will be removed in Katello 2.5, Use --uuid
[ INFO 2016-03-22 08:23:52 HammerCLIKatello::ContentView] Called with options: {}
[ INFO 2016-03-22 08:23:52 HammerCLIKatello::Filter] Called with options: {}
[ INFO 2016-03-22 08:23:52 HammerCLIKatello::FilterRule] Called with options: {}
Usage:
    hammer content-view filter rule list [OPTIONS]

Options:
 --content-view CONTENT_VIEW_NAME                Content view name to search by
 --content-view-filter CONTENT_VIEW_FILTER_NAME  Name to search by
 --content-view-filter-id CONTENT_VIEW_FILTER_ID filter identifier
 --content-view-id CONTENT_VIEW_ID               content view numeric identifier
 --organization ORGANIZATION_NAME                Organization name to search by
 --organization-id ORGANIZATION_ID               organization ID
 --organization-label ORGANIZATION_LABEL         Organization label to search by
 -h, --help                                      print help

--full-results is still not implemented

Comment 8 Bryan Kearney 2016-04-06 17:31:31 UTC
Given teh differences in package numbers between commetn 5 and comment 6, I am going to put back to ON_QA for re-verification.

Comment 11 Tomas Strachota 2016-06-01 13:56:29 UTC
$ for i in {1..30}; do hammer content-view filter create --content-view-id 1 --name filter$i --type rpm; done

$ hammer content-view filter list --content-view-id 1
----------|----------|------|----------
FILTER ID | NAME     | TYPE | INCLUSION
----------|----------|------|----------
1         | filter1  | rpm  |          
10        | filter10 | rpm  |          
11        | filter11 | rpm  |          
12        | filter12 | rpm  |          
13        | filter13 | rpm  |          
14        | filter14 | rpm  |          
15        | filter15 | rpm  |          
16        | filter16 | rpm  |          
17        | filter17 | rpm  |          
18        | filter18 | rpm  |          
19        | filter19 | rpm  |          
2         | filter2  | rpm  |          
20        | filter20 | rpm  |          
21        | filter21 | rpm  |          
22        | filter22 | rpm  |          
23        | filter23 | rpm  |          
24        | filter24 | rpm  |          
25        | filter25 | rpm  |          
26        | filter26 | rpm  |          
27        | filter27 | rpm  |          
----------|----------|------|----------
Page 1 of 2 (use --page and --per-page for navigation)

The command lists only 20 items and now also shows why (due to BZ 1247781). When I commented out the :ui: > :per_page: setting in /etc/hammer/cli_config.yml the command reflected on the change and displayed all filters.

Even though hammer behaves correctly and respects the settings I think this is still a regression compared to 6.1 where we list all items by default. The fix should be only matter of updating the default config file in packaging.

Failed QA.

Comment 12 Tomas Strachota 2016-06-01 13:59:39 UTC
Forgot to mention: tested with satellite 6.2 snap 13

Comment 13 Andrew Kofink 2016-06-02 17:51:50 UTC
Created redmine issue http://projects.theforeman.org/issues/15274 from this bug

Comment 14 Bryan Kearney 2016-06-03 08:12:00 UTC
Upstream bug component is Content Management

Comment 15 Adam Ruzicka 2016-07-18 11:13:26 UTC
VERIFIED.
Sat 6.2 SNAP 20.2
tfm-rubygem-hammer_cli-0.5.1.11-4.el7sat.noarch

$ for i in {1..30}; do hammer content-view filter create --organization-id 1 --content-view-id 2 --name filter$i --type rpm; done

$ hammer content-view filter list --content-view-id 2
----------|----------|------|----------
FILTER ID | NAME     | TYPE | INCLUSION
----------|----------|------|----------
1         | filter1  | rpm  |          
10        | filter10 | rpm  |          
11        | filter11 | rpm  |          
12        | filter12 | rpm  |          
13        | filter13 | rpm  |          
14        | filter14 | rpm  |          
15        | filter15 | rpm  |          
16        | filter16 | rpm  |          
17        | filter17 | rpm  |          
18        | filter18 | rpm  |          
19        | filter19 | rpm  |          
2         | filter2  | rpm  |          
20        | filter20 | rpm  |          
21        | filter21 | rpm  |          
22        | filter22 | rpm  |          
23        | filter23 | rpm  |          
24        | filter24 | rpm  |          
25        | filter25 | rpm  |          
26        | filter26 | rpm  |          
27        | filter27 | rpm  |          
28        | filter28 | rpm  |          
29        | filter29 | rpm  |          
3         | filter3  | rpm  |          
30        | filter30 | rpm  |          
4         | filter4  | rpm  |          
5         | filter5  | rpm  |          
6         | filter6  | rpm  |          
7         | filter7  | rpm  |          
8         | filter8  | rpm  |          
9         | filter9  | rpm  |          
----------|----------|------|----------

$ grep per_page /etc/hammer/cli_config.yml 
  # :per_page: 20

Per page setting is disabled by default, all 30 content view filters shown

Comment 16 Bryan Kearney 2016-07-27 11:13:53 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2016:1501