Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1214675

Summary: Unable to get unlimited-content-hosts value for host collection
Product: Red Hat Satellite Reporter: Andrii Balakhtar <abalakht>
Component: HammerAssignee: Adam Price <adprice>
Status: CLOSED ERRATA QA Contact: Og Maciel <omaciel>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.1.0CC: adprice, bbuckingham, bkearney, cwelton, erezende, omaciel, sghai
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: All   
OS: Linux   
URL: http://projects.theforeman.org/issues/10948
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-07-27 11:21:55 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: 1275995, 1317674    
Bug Blocks:    
Attachments:
Description Flags
Attaching foreman-debug none

Description Andrii Balakhtar 2015-04-23 11:19:09 UTC
Description of problem:
I'm trying to get host collection's 'unlimited-content-hosts' parameter value. 
When creating host collection, 'unlimited-content-hosts' can be set to either 'true' or 'false', but it looks like there is no way to verify what value was set - hammer's 'host-collection info' command doesn't return it.

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

How reproducible:
Always

Steps to Reproduce:
1. hammer host-collection create --name test123 --organization-id 1 --unlimited-content-hosts true
2. hammer -u admin -p changeme host-collection info --name test123 --organization-id 1

Actual results:
ID:                  1
Name:                test123
Limit:
Description:
Total Content Hosts: 0
Max Content Hosts:

Expected results:
ID:                  1
Name:                test123
Limit:
Description:
Total Content Hosts: 0
Max Content Hosts:
Unlimited Content Hosts: true

Additional info:
If I run 'hammer host-collection create --name test123 --organization-id 1 --unlimited-content-hosts false', 'Max Content Hosts' value will still be empty, so I can't check whether unlimited-content-hosts is set by 'Max Content Hosts' field.

Comment 1 RHEL Program Management 2015-04-23 11:33:23 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 Sachin Ghai 2015-06-29 10:31:05 UTC
Still reproducible with sat6.1.1 GA compose (Satellite-6.1.0-RHEL-7-20150625.2)

Comment 4 Adam Price 2015-06-29 18:57:38 UTC
Created redmine issue http://projects.theforeman.org/issues/10948 from this bug

Comment 7 Bryan Kearney 2015-07-10 20:26:38 UTC
Delivered with Snap12.

Comment 8 Sachin Ghai 2015-07-14 06:26:02 UTC
Reproducible with sat6.1.1 GA snap12.

[root@cloud-qe-17 ~]# hammer host-collection create --name test123 --organization-id 1 --unlimited-content-hosts true
[Foreman] Username: admin
[Foreman] Password for admin: 
Host collection created
[root@cloud-qe-17 ~]# hammer -u admin -p changeme host-collection info --name test123 --organization-id 1
ID:                  1
Name:                test123
Limit:               None
Description:         
Total Content Hosts: 0


[root@cloud-qe-17 ~]# rpm -qa | grep hammer
rubygem-hammer_cli-0.1.4.11-1.el6_6sat.noarch
rubygem-hammer_cli_gutterball-0.0.1.3-1.el6_6sat.noarch
rubygem-hammer_cli_import-0.10.18-1.el6_6sat.noarch
rubygem-hammer_cli_foreman_bootdisk-0.1.2.7-1.el6_6sat.noarch
rubygem-hammer_cli_foreman_docker-0.0.3.9-1.el6_6sat.noarch
rubygem-hammer_cli_foreman-0.1.4.14-1.el6_6sat.noarch
rubygem-hammer_cli_katello-0.0.7.17-1.el6_6sat.noarch
rubygem-hammer_cli_foreman_discovery-0.0.1.10-1.el6_6sat.noarch
rubygem-hammer_cli_foreman_tasks-0.0.3.4-1.el6_6sat.noarch
foreman-1.7.2.30-1.el6_6sat.noarch

Comment 9 Adam Price 2015-07-30 18:58:09 UTC
Sachin,

I'm curious why you failed this bug. The change is working correctly. Unlimited-content-hosts was set to true, so there is no limit, which is why it prints "None" as the field's value. If you set a limit on the number of content-hosts, then that field will contain a number.

What are you expecting the value to be?

Comment 10 Sachin Ghai 2015-07-31 06:26:51 UTC
Makes sense @Adam. I was looking for the expected result in bug description which also contains the value of "Unlimited Content Hosts" flag. Thanks for making it clear.



Here I set the max limit set, so it displays 'Limit' as 10.


[root@cloud-qe-12 ~]# hammer host-collection create --name test1234 --organization-id 1 --max-content-hosts 10
[Foreman] Username: admin
[Foreman] Password for admin: 
Host collection created
[root@cloud-qe-12 ~]# hammer -u admin -p changeme host-collection info --name test1234 --organization-id 1
ID:                  2
Name:                test1234
Limit:               10
Description:         
Total Content Hosts: 0

Comment 11 Sachin Ghai 2015-07-31 06:29:07 UTC
If I set the 'unlimited-content-hosts' to true then 'Limit' set to None

[root@cloud-qe-12 ~]# hammer host-collection create --name test123 --organization-id 1 --unlimited-content-hosts true
[Foreman] Username: admin
[Foreman] Password for admin: 
Host collection created
[root@cloud-qe-12 ~]# hammer -u admin -p changeme host-collection info --name test123 --organization-id 1
ID:                  1
Name:                test123
Limit:               None
Description:         
Total Content Hosts: 0

Comment 12 Sachin Ghai 2015-07-31 06:31:21 UTC
when I set 'unlimited-content-hosts' to false then Limit is 'blank' 

[root@cloud-qe-12 ~]# hammer host-collection create --name test12345 --organization-id 1 --unlimited-content-hosts false
[Foreman] Username: admin
[Foreman] Password for admin: 
Host collection created
[root@cloud-qe-12 ~]# hammer -u admin -p changeme host-collection info --name test12345 --organization-id 1
ID:                  3
Name:                test12345
Limit:               
Description:         
Total Content Hosts: 0



Adam: hey, If you see above I set 'unlimited-content-hosts' to false, then 'Limit' is set to nothing. Shouldn't it be set to '0' ?

Comment 13 Adam Price 2015-07-31 18:52:20 UTC
--unlimited-content-hosts should either receive 'true' or you should pass in --max-content-hosts=<num>. Only passing in --unlimited-content-hosts=false doesn't really make sense because you aren't providing a limit.

I'm surprised that creation was successful.

Comment 14 Adam Price 2015-08-05 20:50:43 UTC
another PR!

https://github.com/Katello/katello/pull/5397

Comment 16 Tazim Kolhar 2016-03-22 06:59:06 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. Hammer host-collection Create command

# hammer -v -d host-collection create --name test123 --organization-id 1 --unlimited-hosts true 
[ INFO 2016-03-22 07:49:38 Init] Initialization of Hammer CLI (0.5.1.3) has started...
[DEBUG 2016-03-22 07:49:38 Init] Running at ruby 2.2.2-p95
[ INFO 2016-03-22 07:49:38 Init] Configuration from the file /etc/hammer/cli_config.yml has been loaded
[ INFO 2016-03-22 07:49:38 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman.yml has been loaded
[ INFO 2016-03-22 07:49:38 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman_bootdisk.yml has been loaded
[ INFO 2016-03-22 07:49:38 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman_docker.yml has been loaded
[ INFO 2016-03-22 07:49:38 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman_tasks.yml has been loaded
[ INFO 2016-03-22 07:49:38 Init] Configuration from the file /etc/hammer/cli.modules.d/gutterball.yml has been loaded
[ INFO 2016-03-22 07:49:38 Init] Configuration from the file /etc/hammer/cli.modules.d/import.yml has been loaded
[ INFO 2016-03-22 07:49:38 Init] Configuration from the file /etc/hammer/cli.modules.d/katello.yml has been loaded
[DEBUG 2016-03-22 07:49:38 Connection] Registered: foreman
[DEBUG 2016-03-22 07:49:38 API] Global headers: {
        :content_type => "application/json",
              :accept => "application/json;version=2",
    "Accept-Language" => "en"
}
[ INFO 2016-03-22 07:49:38 Modules] Extension module hammer_cli_foreman (0.5.1.2) loaded
[ INFO 2016-03-22 07:49:38 Modules] Extension module hammer_cli_foreman_bootdisk (0.1.3) loaded
[ INFO 2016-03-22 07:49:39 HammerCLI::MainCommand] subcommand organization (HammerCLIForeman::Organization) was removed.
[ INFO 2016-03-22 07:49:39 HammerCLI::MainCommand] subcommand organization (HammerCLIKatello::Organization) was created.
[ INFO 2016-03-22 07:49:39 Modules] Extension module hammer_cli_gutterball (1.0.1) loaded
[ INFO 2016-03-22 07:49:39 Modules] Extension module hammer_cli_import (0.10.23) loaded
[ INFO 2016-03-22 07:49:39 Modules] Extension module hammer_cli_katello (0.0.22.1) loaded
[DEBUG 2016-03-22 07:49:39 Init] Using locale 'en'
[DEBUG 2016-03-22 07:49:39 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 07:49:39 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 07:49:39 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 07:49:39 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 07:49:39 HammerCLI::MainCommand] Called with options: {"option_verbose"=>true, "option_debug"=>true}
[ WARN 2016-03-22 07:49:39 HammerCLIKatello::HostCollection::ContentBaseCommand] Resource 'systems_bulk_actions' does not exist in the API
[ INFO 2016-03-22 07:49:39 HammerCLIKatello::HostCollection] Called with options: {}
[ INFO 2016-03-22 07:49:39 HammerCLIKatello::HostCollection::CreateCommand] Called with options: {"option_organization_id"=>1, "option_name"=>"test123", "option_unlimited_hosts"=>true}
[ERROR 2016-03-22 07:49:39 Exception] Error: undefined local variable or method `option_host_ids' for #<HammerCLIKatello::HostCollection::CreateCommand:0x00000002726df0>
Could not create the host collection:
  Error: undefined local variable or method `option_host_ids' for #<HammerCLIKatello::HostCollection::CreateCommand:0x00000002726df0>
[ERROR 2016-03-22 07:49:39 Exception] 

NameError (undefined local variable or method `option_host_ids' for #<HammerCLIKatello::HostCollection::CreateCommand:0x00000002726df0>):
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_katello-0.0.22.1/lib/hammer_cli_katello/host_collection.rb:16:in `request_params'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_katello-0.0.22.1/lib/hammer_cli_katello/host_collection.rb:47:in `request_params'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.5.1.3/lib/hammer_cli/apipie/command.rb:43:in `send_request'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.5.1.2/lib/hammer_cli_foreman/commands.rb:189:in `send_request'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.5.1.3/lib/hammer_cli/apipie/command.rb:34:in `execute'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/command.rb:68:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.5.1.3/lib/hammer_cli/abstract.rb:22:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/subcommand/execution.rb:11:in `execute'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/command.rb:68:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.5.1.3/lib/hammer_cli/abstract.rb:22:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/subcommand/execution.rb:11:in `execute'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/command.rb:68:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.5.1.3/lib/hammer_cli/abstract.rb:22:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/command.rb:133:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.5.1.3/bin/hammer:125:in `<top (required)>'
    /usr/bin/hammer:23:in `load'
    /usr/bin/hammer:23:in `<main>'

Comment 17 Tazim Kolhar 2016-03-22 07:00:10 UTC
Created attachment 1138897 [details]
Attaching foreman-debug

Comment 18 Tazim Kolhar 2016-03-22 07:01:00 UTC
This is failing in satellite6 beta
foreman-1.11.0.6-1.el7sat.noarch

Comment 20 Sachin Ghai 2016-03-23 06:45:05 UTC
Verification of this bz depends on #1317674

Comment 21 Og Maciel 2016-03-24 14:32:57 UTC
hammer> host-collection list --organization-id 1
---|---------------|-------|------------
ID | NAME          | LIMIT | DESCRIPTION
---|---------------|-------|------------
5  | test123       | None  |
1  | RHEL 7 Server | None  |
2  | RHEL 6 Server | None  |
3  | RHEL 5 Server | None  |
4  | Capsule       | None  |
---|---------------|-------|------------

Note that you cannot get the info by name, only by ID

hammer> host-collection info --id 5
ID:          5
Name:        test123
Limit:       None
Description:
Total Hosts: 0

hammer> host-collection info --name test123
undefined method `id' for nil:NilClass

Everything else looks good:

hammer> host-collection update --id 5 --unlimited-hosts false --max-hosts 5
Host collection updated
hammer> host-collection info --name test123
undefined method `id' for nil:NilClass
hammer> host-collection info --id 5
ID:          5
Name:        test123
Limit:       5
Description:
Total Hosts: 0

hammer> host-collection update --id 5 --unlimited-hosts false --max-hosts 0
Could not update the the host collection:
  Validation failed: Max hosts must be a positive integer value.
hammer> host-collection update --id 5 --unlimited-hosts false --max-hosts 1
Host collection updated
hammer> host-collection info --id 5
ID:          5
Name:        test123
Limit:       1
Description:
Total Hosts: 0

hammer> host-collection update --id 5 --unlimited-hosts true
Host collection updated
hammer> host-collection info --id 5
ID:          5
Name:        test123
Limit:       None
Description:
Total Hosts: 0

hammer> host-collection update --id 5 --unlimited-hosts true --max-host 1
Could not update the the host collection:
  Error: Unrecognised option '--max-host'

  See: ' host-collection update --help'

Comment 22 Og Maciel 2016-03-24 14:51:12 UTC
Verified by my tests above. I have also filed https://bugzilla.redhat.com/show_bug.cgi?id=1321053

Comment 25 Bryan Kearney 2016-07-27 11:21:55 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