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 1691436 - hammer help --organization-id should be "Set the current location context for the request"
Summary: hammer help --organization-id should be "Set the current location context for...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Hammer
Version: 6.6.0
Hardware: All
OS: All
medium
medium
Target Milestone: 6.8.0
Assignee: Oleh Fedorenko
QA Contact: Mirek Długosz
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-03-21 15:35 UTC by Nithin Thomas
Modified: 2023-03-24 14:39 UTC (History)
9 users (show)

Fixed In Version: hammer-cli-foreman-2.1.2
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-10-27 13:32:10 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 28869 0 Normal Closed hammer help --organization-id should be "Set the current location context for the request" 2020-07-20 15:38:30 UTC
Foreman Issue Tracker 30182 0 Normal Closed hammer help --organization-id should be "Set the current location context for the request" 2020-07-20 15:38:30 UTC
Red Hat Product Errata RHBA-2020:4367 0 None None None 2020-10-27 13:32:24 UTC

Description Nithin Thomas 2019-03-21 15:35:42 UTC
Description of problem:

- hammer location create do not add location to the specified organization

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

- Satellite 6.4 and 6.5

How reproducible:

- always

Steps to Reproduce:

hammer> location list
---|------------------|------------------|------------
ID | TITLE            | NAME             | DESCRIPTION
---|------------------|------------------|------------
2  | Default Location | Default Location |            
---|------------------|------------------|------------
hammer> organization list
---|----------------------|----------------------|-------------|----------------------|------------
ID | TITLE                | NAME                 | DESCRIPTION | LABEL                | DESCRIPTION
---|----------------------|----------------------|-------------|----------------------|------------
1  | Default Organization | Default Organization |             | Default_Organization |             
---|----------------------|----------------------|-------------|----------------------|------------
hammer> location create --name Test1 --organization-id 1
Location created.

hammer> location list --organization-id 1
---|------------------|------------------|------------
ID | TITLE            | NAME             | DESCRIPTION
---|------------------|------------------|------------
2  | Default Location | Default Location |            
---|------------------|------------------|------------
hammer> location list
---|------------------|------------------|------------
ID | TITLE            | NAME             | DESCRIPTION
---|------------------|------------------|------------
2  | Default Location | Default Location |            
4  | Test1            | Test1            |            
---|------------------|------------------|------------

Actual results:

- location is not added in the specified Org 1

Expected results:

- location should be added in the specified Org 1

Additional info:

need to use the below command for now:

#  hammer location add-organization --name Test1 --organization-id 1

Comment 4 Shira Maximov 2020-01-28 09:48:16 UTC
--organiztion_id will set the current organization context for the request. 
if you want to set an organization, you should --organization-ids

hammer location create --name Test2 --organization-ids "2" which will Associated organization IDs.

however, the hammer --help doesn't explain that very well, so I'm changing the title of the PR to change the help message

Comment 5 Shira Maximov 2020-01-28 09:49:01 UTC
Created redmine issue https://projects.theforeman.org/issues/28869 from this bug

Comment 7 Bryan Kearney 2020-01-29 09:05:17 UTC
Upstream bug assigned to mshira

Comment 8 Shira Maximov 2020-02-04 10:00:44 UTC
organization_id can be a bit confusing, 
Normally you would expect to set the organization but it's not the case. 
organization_id can only set the scope of the request. 
like, In the UI, you have those two buttons of the location and organization, and they are setting the scope of all foreman actions...
organization_id will not set the organization just the scope of it.
so I believe that the best approach here is to change the help because it could be a bit confusing. 

If you want to set the organization, you could use --organization-ids

Comment 9 Bryan Kearney 2020-02-11 17:05:08 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue https://projects.theforeman.org/issues/28869 has been resolved.

Comment 10 Nithin Thomas 2020-02-21 01:47:51 UTC
Thank you @Shira

The new option available in satellite 6.7 will add the location to the organization while creating.


# hammer location create --help
 --organization-ids ORGANIZATION_IDS                   Associated organization IDs

# hammer location create --name Test --organization-ids 1
# hammer location list --organization-id 1
---|----------|----------|------------
ID | TITLE    | NAME     | DESCRIPTION
---|----------|----------|------------
4  | xxxxxxxx | xxxxxxxx |            
6  | Test     | Test     |            
2  | xxxx     | xxxx     |            
---|----------|----------|------------

Comment 11 Mirek Długosz 2020-06-22 11:21:17 UTC
As of 6.8 snap 5, --help message is even more confusing than it used to be:
#v+
$ hammer location create --help
...
 --organization[-id|-title]                            Name/Title/Id of associated organization
 --organization[s|-ids|-titles]                        Associated organization Names/Titles/Ids
                                                       Comma separated list of values. Values containing comma should be quoted or escaped with backslash.
                                                       JSON is acceptable and preferred way for complex parameters
#v-

Both --organization-id and --organization-ids use "associated organization" wording, suggesting these options are equivalent. But they are not, since only --organization-ids actually assign organization to location:

#v+
$ hammer location create --name 'test-loc' --organization-id 3
$ hammer location list --organization-id 3
---|------------------|------------------|------------
ID | TITLE            | NAME             | DESCRIPTION
---|------------------|------------------|------------
2  | Default Location | Default Location |            
---|------------------|------------------|------------
$ hammer location create --name 'test-loc2' --organization-ids 3
$ hammer location list --organization-id 3
---|------------------|------------------|------------
ID | TITLE            | NAME             | DESCRIPTION
---|------------------|------------------|------------
2  | Default Location | Default Location |            
5  | test-loc2        | test-loc2        |            
---|------------------|------------------|------------
#v-


Tested on:
Satellite 6.8.0 snap 5
pulp-server-2.21.2-1.el7sat.noarch
satellite-6.8.0-0.4.beta.el7sat.noarch
foreman-2.1.0-0.20.rc2.el7sat.noarch
katello-3.16.0-0.3.rc1.el7sat.noarch
tfm-rubygem-hammer_cli-2.1.1-1.el7sat.noarch
tfm-rubygem-hammer_cli_foreman-2.1.1-1.el7sat.noarch

Comment 12 Shira Maximov 2020-06-23 10:36:53 UTC
Connecting redmine issue https://projects.theforeman.org/issues/30182 from this bug

Comment 13 Mirek Długosz 2020-07-20 16:02:03 UTC
As of 6.8 snap 9, --help message makes it clear that --organization and --organizations are not equivalent:

#v+
$ hammer location create --help
...
 --organization[-id|-title]                            Set the current organization context for the request. Name/Title/Id can be used
 --organization[s|-ids|-titles]                        Associated organization Names/Titles/Ids
                                                       Comma separated list of values. Values containing comma should be quoted or escaped with backslash.
                                                       JSON is acceptable and preferred way for complex parameters
...
#v-


Tested on:
Satellite 6.8 snap 9
rpm -foreman-2.1.0-1.el7sat.noarch
pulp-server-2.21.2-1.el7sat.noarch
katello-3.16.0-0.4.rc4.el7sat.noarch
satellite-6.8.0-0.7.beta.el7sat.noarch
tfm-rubygem-hammer_cli-2.1.1-1.el7sat.noarch
tfm-rubygem-hammer_cli_foreman-2.1.2-1.el7sat.noarch

Comment 16 errata-xmlrpc 2020-10-27 13:32:10 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 (Satellite 6.8 Satellite Tools Release), 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-2020:4367


Note You need to log in before you can comment on or make changes to this bug.