Project

General

Profile

Actions

Bug #15257

closed

Default per_page configuration enables pagination, including in CSV mode

Added by Dominic Cleal almost 8 years ago. Updated almost 8 years ago.

Status:
Closed
Priority:
Normal
Category:
Foreman commands (obsolete)
Target version:
-
Fixed in Releases:
Found in Releases:
In Kanboard:

Description

Pagination was disabled in both table and CSV formats by default since #10534 (in 0.3.0), but #14530 in master changed hammer_cli_foreman to paginate according to the config file's per_page value if set.

This value is set in the default hammer_cli config file (https://github.com/theforeman/hammer-cli/blob/0.6.1/config/cli_config.template.yml), so pagination is now enabled by default, even in CSV mode.

I think the configured setting should probably be ignored in CSV output mode (it is described as a 'ui' setting too), or remove the default per_page value of 20.


Related issues 3 (0 open3 closed)

Related to Hammer CLI - Bug #14530: hammer queries defaults to 1000 items per pageClosedMartin Bacovsky04/07/2016Actions
Related to Katello - Bug #15542: SAT6.1 Pagination control not supported for listing content hosts in host collection with Satellite 6 command-lineRejected06/29/2016Actions
Has duplicate Katello - Bug #15274: [Sat6] hammer content-view filter rule list shows only 20 entriesDuplicate06/02/2016Actions
Actions #1

Updated by Dominic Cleal almost 8 years ago

  • Related to Bug #14530: hammer queries defaults to 1000 items per page added
Actions #2

Updated by Dominic Cleal almost 8 years ago

Tested on current master versions:

tfm-rubygem-hammer_cli-0.6.0-2.201605301239git17e9b68.el7.noarch
tfm-rubygem-hammer_cli_foreman-0.6.0-2.201605271002git382103d.el7.noarch

$ hammer -d fact list
[[32m INFO[0m [34m2016-06-01 09:38:03[0m [36mInit[0m] Initialization of Hammer CLI (0.6.0) has started...
[DEBUG [34m2016-06-01 09:38:03[0m [36mInit[0m] Running at ruby 2.2.2-p95
[[32m INFO[0m [34m2016-06-01 09:38:03[0m [36mInit[0m] Configuration from the file /etc/hammer/cli_config.yml has been loaded
[[32m INFO[0m [34m2016-06-01 09:38:03[0m [36mInit[0m] Configuration from the file /etc/hammer/cli.modules.d/foreman.yml has been loaded
[[32m INFO[0m [34m2016-06-01 09:38:03[0m [36mInit[0m] Configuration from the file /root/.hammer/cli.modules.d/foreman.yml has been loaded
[DEBUG [34m2016-06-01 09:38:03[0m [36mConnection[0m] Registered: foreman
[DEBUG [34m2016-06-01 09:38:03[0m [36mAPI[0m] Global headers: {
        :content_type => "application/json",
              :accept => "application/json;version=2",
    "Accept-Language" => "en_GB" 
}
[DEBUG [34m2016-06-01 09:38:03[0m [36mAPI[0m] Follow redirects: never
[[32m INFO[0m [34m2016-06-01 09:38:03[0m [36mModules[0m] Extension module hammer_cli_foreman (0.6.0) loaded
[DEBUG [34m2016-06-01 09:38:03[0m [36mInit[0m] Using locale 'en_GB'
[DEBUG [34m2016-06-01 09:38:03[0m [36mInit[0m] 'mo' files for locale domain 'hammer-cli' loaded from '/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.6.0/locale'
[DEBUG [34m2016-06-01 09:38:03[0m [36mInit[0m] 'mo' files for locale domain 'hammer-cli-foreman' loaded from '/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.6.0/locale'
[[32m INFO[0m [34m2016-06-01 09:38:03[0m [36mHammerCLI::MainCommand[0m] Called with options: {"option_debug"=>true}
[[32m INFO[0m [34m2016-06-01 09:38:03[0m [36mHammerCLIForeman::Fact[0m] Called with options: {}
[[32m INFO[0m [34m2016-06-01 09:38:03[0m [36mHammerCLIForeman::Fact::ListCommand[0m] Called with options: {}
[[32m INFO[0m [34m2016-06-01 09:38:03[0m [36mAPI[0m] Server: https://foreman.example.com
[[32m INFO[0m [34m2016-06-01 09:38:03[0m [36mAPI[0m] GET /api/fact_values
[DEBUG [34m2016-06-01 09:38:03[0m [36mAPI[0m] Params: {
        "page" => 1,
    "per_page" => 20
}
[DEBUG [34m2016-06-01 09:38:03[0m [36mAPI[0m] Headers: {
    :params => {
            "page" => 1,
        "per_page" => 20
    }
}
[DEBUG [34m2016-06-01 09:38:03[0m [36mAPI[0m] Response: {
       "total" => 93,
    "subtotal" => 93,
        "page" => 1,
    "per_page" => 20,
      "search" => "",
        "sort" => {
           "by" => nil,
        "order" => nil
    },
     "results" => {
        "foreman.example.com" => {
                       "uptime_days" => "0",
                       "swapsize_mb" => "0.00",
                       "swapfree_mb" => "0.00",
                          "swapsize" => "0.00 MB",
                          "swapfree" => "0.00 MB",
                          "uniqueid" => "007f0100",
                 "bios_release_date" => "04/01/2014",
            "blockdevice_vda_vendor" => "0x1af4",
                    "processorcount" => "1",
            "physicalprocessorcount" => "1",
                      "uptime_hours" => "1",
              "blockdevice_vda_size" => "10737418240",
                        "network_lo" => "127.0.0.0",
                      "ipaddress_lo" => "127.0.0.1",
                            "uptime" => "1:38 hours",
                     "augeasversion" => "1.4.0",
                          "mtu_eth1" => "1500",
                          "mtu_eth0" => "1500",
                      "bios_version" => "1.8.2-20150715_102347-",
                      "network_eth0" => "192.168.122.0" 
        }
    }
}
[DEBUG [34m2016-06-01 09:38:03[0m [36mAPI[0m] Response headers: {
                      :date => "Wed, 01 Jun 2016 09:38:03 GMT",
                    :server => "Apache/2.4.6 (CentOS)",
             :cache_control => "max-age=0, private, must-revalidate",
          :x_xss_protection => "1; mode=block",
              :x_request_id => "241eaf2a-2214-432e-bf91-95e126c1cacd",
           :x_frame_options => "SAMEORIGIN",
           :foreman_version => "1.13.0-develop",
    :x_content_type_options => "nosniff",
       :foreman_api_version => "2",
           :apipie_checksum => "8ab4cc7c24acf9cca77f2593780c64a1",
                 :x_runtime => "0.081729",
              :x_powered_by => "Phusion Passenger 5.0.28",
                :set_cookie => [
        [0] "_session_id=c9fb2bccad9b46e2063c17da83406c0f; path=/; secure; HttpOnly" 
    ],
                      :etag => "W/\"649408b53ad3ac94e444fb50d675210d-gzip\"",
                    :status => "200 OK",
                      :vary => "Accept-Encoding",
          :content_encoding => "gzip",
            :content_length => "363",
              :content_type => "application/json; charset=utf-8" 
}
--------------------|------------------------|-----------------------
HOST                | FACT                   | VALUE                 
--------------------|------------------------|-----------------------
foreman.example.com | uptime_days            | 0                     
foreman.example.com | swapsize_mb            | 0.00                  
foreman.example.com | swapfree_mb            | 0.00                  
foreman.example.com | swapsize               | 0.00 MB               
foreman.example.com | swapfree               | 0.00 MB               
foreman.example.com | uniqueid               | 007f0100              
foreman.example.com | bios_release_date      | 04/01/2014            
foreman.example.com | blockdevice_vda_vendor | 0x1af4                
foreman.example.com | processorcount         | 1                     
foreman.example.com | physicalprocessorcount | 1                     
foreman.example.com | uptime_hours           | 1                     
foreman.example.com | blockdevice_vda_size   | 10737418240           
foreman.example.com | network_lo             | 127.0.0.0             
foreman.example.com | ipaddress_lo           | 127.0.0.1             
foreman.example.com | uptime                 | 1:38 hours            
foreman.example.com | augeasversion          | 1.4.0                 
foreman.example.com | mtu_eth1               | 1500                  
foreman.example.com | mtu_eth0               | 1500                  
foreman.example.com | bios_version           | 1.8.2-20150715_102347-
foreman.example.com | network_eth0           | 192.168.122.0         
--------------------|------------------------|-----------------------
Page 1 of 5 (use --page and --per-page for navigation)
$ head /etc/hammer/cli_config.yml
# User interface related settings
:ui:
  # Enable interactive queries?
  :interactive: true
  # Number of records listed per page
  :per_page: 20
  # Location of shell history file
  :history_file: '~/.hammer/history'

Actions #3

Updated by Martin Bacovsky almost 8 years ago

  • Status changed from New to Assigned
  • Assignee set to Martin Bacovsky
Actions #4

Updated by Dominic Cleal almost 8 years ago

Sorry, I included the wrong log (in table, not CSV mode).

$ hammer -d --csv fact list
[[32m INFO[0m [34m2016-06-01 09:53:14[0m [36mInit[0m] Initialization of Hammer CLI (0.6.0) has started...
[DEBUG [34m2016-06-01 09:53:14[0m [36mInit[0m] Running at ruby 2.2.2-p95
[[32m INFO[0m [34m2016-06-01 09:53:14[0m [36mInit[0m] Configuration from the file /etc/hammer/cli_config.yml has been loaded
[[32m INFO[0m [34m2016-06-01 09:53:14[0m [36mInit[0m] Configuration from the file /etc/hammer/cli.modules.d/foreman.yml has been loaded
[[32m INFO[0m [34m2016-06-01 09:53:14[0m [36mInit[0m] Configuration from the file /root/.hammer/cli.modules.d/foreman.yml has been loaded
[DEBUG [34m2016-06-01 09:53:14[0m [36mConnection[0m] Registered: foreman
[DEBUG [34m2016-06-01 09:53:14[0m [36mAPI[0m] Global headers: {
        :content_type => "application/json",
              :accept => "application/json;version=2",
    "Accept-Language" => "en_GB" 
}
[DEBUG [34m2016-06-01 09:53:14[0m [36mAPI[0m] Follow redirects: never
[[32m INFO[0m [34m2016-06-01 09:53:14[0m [36mModules[0m] Extension module hammer_cli_foreman (0.6.0) loaded
[DEBUG [34m2016-06-01 09:53:14[0m [36mInit[0m] Using locale 'en_GB'
[DEBUG [34m2016-06-01 09:53:14[0m [36mInit[0m] 'mo' files for locale domain 'hammer-cli' loaded from '/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.6.0/locale'
[DEBUG [34m2016-06-01 09:53:14[0m [36mInit[0m] 'mo' files for locale domain 'hammer-cli-foreman' loaded from '/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.6.0/locale'
[[32m INFO[0m [34m2016-06-01 09:53:14[0m [36mHammerCLI::MainCommand[0m] Called with options: {"option_debug"=>true}
[[32m INFO[0m [34m2016-06-01 09:53:14[0m [36mHammerCLIForeman::Fact[0m] Called with options: {}
[[32m INFO[0m [34m2016-06-01 09:53:14[0m [36mHammerCLIForeman::Fact::ListCommand[0m] Called with options: {}
[[32m INFO[0m [34m2016-06-01 09:53:14[0m [36mAPI[0m] Server: https://foreman.example.com
[[32m INFO[0m [34m2016-06-01 09:53:14[0m [36mAPI[0m] GET /api/fact_values
[DEBUG [34m2016-06-01 09:53:14[0m [36mAPI[0m] Params: {
        "page" => 1,
    "per_page" => 20
}
[DEBUG [34m2016-06-01 09:53:14[0m [36mAPI[0m] Headers: {
    :params => {
            "page" => 1,
        "per_page" => 20
    }
}
[DEBUG [34m2016-06-01 09:53:14[0m [36mAPI[0m] Response: {
       "total" => 93,
    "subtotal" => 93,
        "page" => 1,
    "per_page" => 20,
      "search" => "",
        "sort" => {
           "by" => nil,
        "order" => nil
    },
     "results" => {
        "foreman.example.com" => {
                       "uptime_days" => "0",
                       "swapsize_mb" => "0.00",
                       "swapfree_mb" => "0.00",
                          "swapsize" => "0.00 MB",
                          "swapfree" => "0.00 MB",
                          "uniqueid" => "007f0100",
                 "bios_release_date" => "04/01/2014",
            "blockdevice_vda_vendor" => "0x1af4",
                    "processorcount" => "1",
            "physicalprocessorcount" => "1",
                      "uptime_hours" => "1",
              "blockdevice_vda_size" => "10737418240",
                        "network_lo" => "127.0.0.0",
                      "ipaddress_lo" => "127.0.0.1",
                            "uptime" => "1:38 hours",
                     "augeasversion" => "1.4.0",
                          "mtu_eth1" => "1500",
                          "mtu_eth0" => "1500",
                      "bios_version" => "1.8.2-20150715_102347-",
                      "network_eth0" => "192.168.122.0" 
        }
    }
}
[DEBUG [34m2016-06-01 09:53:14[0m [36mAPI[0m] Response headers: {
                      :date => "Wed, 01 Jun 2016 09:53:14 GMT",
                    :server => "Apache/2.4.6 (CentOS)",
             :cache_control => "max-age=0, private, must-revalidate",
          :x_xss_protection => "1; mode=block",
              :x_request_id => "01645703-1411-4024-b6fb-41e333908b07",
           :x_frame_options => "SAMEORIGIN",
           :foreman_version => "1.13.0-develop",
    :x_content_type_options => "nosniff",
       :foreman_api_version => "2",
           :apipie_checksum => "8ab4cc7c24acf9cca77f2593780c64a1",
                 :x_runtime => "0.043445",
              :x_powered_by => "Phusion Passenger 5.0.28",
                :set_cookie => [
        [0] "_session_id=f319f8716a1d39c3680bac8f893ff0e6; path=/; secure; HttpOnly" 
    ],
                      :etag => "W/\"649408b53ad3ac94e444fb50d675210d-gzip\"",
                    :status => "200 OK",
                      :vary => "Accept-Encoding",
          :content_encoding => "gzip",
            :content_length => "363",
              :content_type => "application/json; charset=utf-8" 
}
Host,Fact,Value
foreman.example.com,uptime_days,0
foreman.example.com,swapsize_mb,0.00
foreman.example.com,swapfree_mb,0.00
foreman.example.com,swapsize,0.00 MB
foreman.example.com,swapfree,0.00 MB
foreman.example.com,uniqueid,007f0100
foreman.example.com,bios_release_date,04/01/2014
foreman.example.com,blockdevice_vda_vendor,0x1af4
foreman.example.com,processorcount,1
foreman.example.com,physicalprocessorcount,1
foreman.example.com,uptime_hours,1
foreman.example.com,blockdevice_vda_size,10737418240
foreman.example.com,network_lo,127.0.0.0
foreman.example.com,ipaddress_lo,127.0.0.1
foreman.example.com,uptime,1:38 hours
foreman.example.com,augeasversion,1.4.0
foreman.example.com,mtu_eth1,1500
foreman.example.com,mtu_eth0,1500
foreman.example.com,bios_version,1.8.2-20150715_102347-
foreman.example.com,network_eth0,192.168.122.0
Actions #5

Updated by Martin Bacovsky almost 8 years ago

  • Assignee changed from Martin Bacovsky to Tomáš Strachota
Actions #6

Updated by The Foreman Bot almost 8 years ago

  • Status changed from Assigned to Ready For Testing
  • Pull request https://github.com/theforeman/hammer-cli/pull/208 added
Actions #7

Updated by The Foreman Bot almost 8 years ago

  • Pull request https://github.com/theforeman/hammer-cli-foreman/pull/243 added
Actions #8

Updated by Anonymous almost 8 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100
Actions #9

Updated by Andrew Kofink almost 8 years ago

  • Has duplicate Bug #15274: [Sat6] hammer content-view filter rule list shows only 20 entries added
Actions #10

Updated by Andrew Kofink almost 8 years ago

  • Related to Bug #15542: SAT6.1 Pagination control not supported for listing content hosts in host collection with Satellite 6 command-line added
Actions

Also available in: Atom PDF