Description of problem: hammer hostgroup update or create command fails when using --organization-ids option fails with below error # hammer hostgroup update --id 1 --lifecycle-environment "Library" --content-view "R7CV" --organization-ids 1 Could not update the hostgroup: Error: Could not find organization, please set one of options --organizations, --organization-ids. Version-Release number of selected component (if applicable): Satellite 6.1.7 and below How reproducible: 100% Steps to Reproduce: 1. Execute the command either to create or update the hostgroup # hammer hostgroup update --id 1 --lifecycle-environment "Library" --content-view "MyCV" --organization-ids 1 Could not update the hostgroup: Error: Could not find organization, please set one of options --organizations, --organization-ids. Actual results: Its failing to parse the --organizations-ids flag, however when using --organization "ORG_NAME" it succeeds. Expected results: Should work with --organizations-id option as well. Additional info: # hammer hostgroup update --id 1 --lifecycle-environment "Library" --content-view "MyCV" --organizations ACME Hostgroup updated The above command works with --organizations flag not with --organizations-id option.
Andrew, this one could be a change to foreman or katello; however, it needs to be investigated. Foreman provides the hostgroup cli; however, katello does extend it to include some additional details (e.g. content view, lifecycle environment & content source).
*** Bug 1324618 has been marked as a duplicate of this bug. ***
Organization scoped_search doesn't take an ID.
Created redmine issue http://projects.theforeman.org/issues/14686 from this bug
Upstream bug component is Provisioning
Marking this as blocker as https://bugzilla.redhat.com/show_bug.cgi?id=1324618 is now closed as dupe.
Moving to POST since upstream bug http://projects.theforeman.org/issues/14686 has been closed ------------- Andrew Kofink Applied in changeset commit:6ee7a8b40807944058c664248570a3031cdb6172.
WORKAROUND: For any use of the "hammer hostgroup create/update" commands, please use the --organizations parameter instead of the --organization-ids.
Still reproducible with sat6.2 GA snap10.1 [root@cloud-qe-3 ~]# hammer -u admin -p changeme hostgroup create --name='testgroup' --content-view-id 2 --lifecycle-environment='dev' --content-source-id=1 --puppet-proxy-id=1 --puppet-ca-proxy-id=1 --domain-id=1 --subnet='libvirt' --architecture='x86_64' --operatingsystem-id=1 --medium-id 8 --partition-table='Kickstart default' --location-ids=1 --organization-ids=1 Could not create the hostgroup: Error: Could not find organization, please set one of options --organizations, --organization-ids. [root@cloud-qe-3 ~]# hammer -u admin -p changeme organization list ---|----------------------|----------------------|------------ ID | NAME | LABEL | DESCRIPTION ---|----------------------|----------------------|------------ 1 | Default Organization | Default_Organization | ---|----------------------|----------------------|------------ [root@cloud-qe-3 ~]#
To specify an organization-id for the lifecycle_environment, use the --lifecycle-environment-organization-id option.
Sachin: Does Comment 11 address this?
Comment 11 is the implemented fix, once the PRs are merged.
Thanks Andrew. If we are replacing "--organization-id" with new hammer option `--lifecycle-environment-organization-id ` as per comment11 then if a user tries to pass --organization-id then error message should indicate to use --lifecycle-environment-organization-id instead of --organization-id.
(In reply to Sachin Ghai from comment #14) > Thanks Andrew. > > If we are replacing "--organization-id" with new hammer option > `--lifecycle-environment-organization-id ` According to UI, both --organization-id and --le-org-id should exist as they point to different things. --organization-id should specify an organization to which the hostgroup should be assigned whereas --le-org-id together with --lifecycle-environment should specify the LE (as the name of the lifecycle environment name does not need to be unique across the satellite, multiple organizations might have the LE with the same name).
Connecting redmine issue http://projects.theforeman.org/issues/15313 from this bug
Connecting redmine issue http://projects.theforeman.org/issues/15312 from this bug
Upstream bug component is Content Management
Just for clarification, here's an example of how you use the options: hammer hostgroup create --name hg1 --lifecycle-environment le1 --lifecycle-environment-organization-id 1 --organization-ids 1,2
Upstream bug component is Hammer
Verified with sat6.2 GA snap19. As per comment19, I understand user need to pass following two cmd line options: --lifecycle-environment-organization-id 1 --organization-ids 1,2 But hammer should throw proper error when any of them is missing, like: example1: create hostgroup without organization-id. ======== hammer hostgroup create --name hg2 --lifecycle-environment 'DEV' --lifecycle-environment-organization-id 1 Hostgroup created example2: create hostgroup without --lifecycle-environment-organization-id =========================================================================== ~]# hammer hostgroup create --name hg1 --lifecycle-environment 'DEV' --organization-ids 1 Could not create the hostgroup: Error: Could not find organization, please set one of options --organizations, --organization-ids. I specified organization-ids 1, however hammer still throwing error, which is misleading. Any thoughts Andrew ?
I don't see any changes to the BZ that warrant it being back on POST so moving to ASSIGNED.
Sachin, I didn't implement the functionality in example 2, but I'm reworking this BZ in https://bugzilla.redhat.com/show_bug.cgi?id=1354462 to address some regressions. I plan on implementing --organization-ids to be used for searching for the content view and the lifecycle environment. i.e. > hammer hostgroup create --name hg1 --lifecycle-environment Library --organization-ids 1,2,5 > hammer hostgroup create --name hg1 --content-view cv1 --organization-ids 1,2,5 If multiple lifecycle environments or content views are found, you will be required to use an ID instead of automatic name resolution for the LE/CV.
Verified with sat6.2 GA snap20.2 case1: with org-id option and life-cycle env name ===== ~]# hammer hostgroup create --name hg1 --lifecycle-environment Library --organization-ids 1 Could not create the hostgroup: Error: Options --lifecycle-environment-organization-id are required Case2: ========= As per comment23, we need to pass lifecyle-environment-id instead of name in case multiple lifecycle environments or content views are found ~]# hammer hostgroup create --name hg1 --lifecycle-environment-id 1 --organization-ids 1 [Foreman] Password for admin: Hostgroup created case3: ====== I'm able to create hostgroup using --lifecycle-environment-organization-id=1 option ~]# hammer hostgroup create --name hg1 --lifecycle-environment Library --lifecycle-environment-organization-id=1 [Foreman] Password for admin: Hostgroup created I'm still not able to understand why we can't crate hostgroup with lifecycle-env name and --organization-id ? Hey Andrew, Could you please clarify
Sachin, Apologies about the confusion -- we've changed the way you pass in organization-id (again). With this BZ, you needed --content-view-organization-id if you use the --content-view option and the --lifecycle-environment-organization-id option if you use the --lifecycle-environment option. You don't need either organization ID if you're using content view (CV) ID or lifecycle environment (LE) ID. Finally, --organizations or --organization-ids is not used at all for resolving IDs of the CV or LE; it only sets the organizations on the hostgroup. Now, with BZ #1357557, we've opted to just use --organization-id for both CVs and LEs, like you suggested, since the CV and the LE must be from the same organization on a hostgroup. I've linked BZ #1357557 to this one.
Verified ! @ Sat 6.2 snap 20.3 GA As per comment 25 , The hostgroup should be able to create and update with option '--organization-id' and the same is tested as below and is expected : # hammer hostgroup update --id 2 --lifecycle-environment 'DEV' --content-view 'rhel7_cv' --organization-id 1 Hostgroup updated # hammer hostgroup create --name 'hg2' --lifecycle-environment 'DEV' --content-view 'rhel7_cv' --operatingsystem 'RedHat 7.2' --organization-id 1 --partition-table 'Kickstart default' --subnet 'subnet1' Hostgroup created So moving this to 'Verified' state.
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
*** Bug 1328188 has been marked as a duplicate of this bug. ***