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 1868310 - hammer template update has a option --organization-id that does not update anything.
Summary: hammer template update has a option --organization-id that does not update an...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Templates Plugin
Version: 6.7.0
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: 6.10.0
Assignee: Oleh Fedorenko
QA Contact: Ondrej Gajdusek
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-08-12 09:39 UTC by Jaskaran Singh Narula
Modified: 2024-06-13 22:56 UTC (History)
7 users (show)

Fixed In Version: tfm-rubygem-hammer_cli_foreman-2.5.1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-11-16 14:09:27 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 32454 0 Normal New hammer template update has a option --organization-id that does not update anything. 2021-04-29 10:26:57 UTC
Red Hat Product Errata RHSA-2021:4702 0 None None None 2021-11-16 14:09:35 UTC

Description Jaskaran Singh Narula 2020-08-12 09:39:10 UTC
Description of problem:

The option --organization-id under the command[1] does not update anything. 

Below two commands are the same: 

[1] # hammer template update --id <ID_of_Template> --organization-id <ID_of_Org>

    # hammer  template update --id <ID_of_Template>


- The below [1] and [2] commands do not have any option that needs to be updated still it stats that it updated the template.

- Whereas in the [3] command it uses the --new-name option to update. 

[1] 
~~~~~~~~
[root@localhost ~]# hammer template update --id 41 
<Resource :config_templates>
Provisioning template updated.
~~~~~~~~~

[2] 
~~~~~~~~ 
[root@localhost ~]# hammer  template update --id 41 --organization-id 1
<Resource :config_templates>
Provisioning template updated.
~~~~~~~~~

[3] 
~~~~~~~~~
[root@localhost ~]# hammer template update --id <id> --new-name hello-world --organization-id <ID>
<Resource :config_templates>
Provisioning template updated.
~~~~~~~~~~

- So the option --organization-id is in the context of "hammer template update" a non-switch which shouldn't be present, as it cannot do anything. 

How reproducible:
100% reproducible. 


Actual results:
--organization-id when mention without any option does not through an error nor it asks for any other option input that needs to be updated.  

Expected results:
Either remove the option or an error message should print to mention any other option to update.

Comment 3 Oleh Fedorenko 2021-04-27 09:47:25 UTC
Hello Melanie,

Could you please elaborate on what the actual issue here is?

The description of this BZ says that --organization-id for hammer template update command doesn't do anything. My question is what this option is being used for? If you want to change/update the organization for the template you must use different option, which is --organizations or --organization-ids.

> hammer template update --id 1 --organization-ids 1,2,3

Will update the template with id 1 to be in organizations with ids 1, 2 and 3.

> hammer template update --id 1 --organization-id 1

Will search the template with id 1 within organization with id 1, but since other options weren't passed it will update nothing.

Both behaviors are expected. Please let me know if I didn't catch the issue here. Otherwise I'll close this as not a bug.

Comment 4 Melanie Falz 2021-04-27 10:42:59 UTC
Hello Oleh,

Jaskaran opened this bugzilla based on his findings and requests from customer

In this case, when we use the option ---organization-id it does search for the organization but it does not update anything.
Here it should actually throw an error or should ask that what do we want to update. Just like in the command [a] mentioned below I have added the parameter --new-name. 

[a]  # hammer template update --id <ID> --new-name hello-1world --organization-id <ID>

Now, in below both the commands with the option --organization-id does search for the organization whether the template with the id 41 is present in the organization or not[1] and the second[2] one checks in "ALL" organizations. 

[1] # hammer -d template update --id 41 --organization-id 
[2] # hammer -d template update --id 41 


Below I have used the diff option on both the commands [1] and [2] to check for what --organization-id actually get used for. 
~~~~~~~~~~~~
< [DEBUG 2020-08-12T14:43:13 API] Response headers: {
<                                  :date => "Wed, 12 Aug 2020 09:13:13 GMT",
---
> [DEBUG 2020-08-12T14:44:43 API] Response headers: {
>                                  :date => "Wed, 12 Aug 2020 09:14:43 GMT",
337c336
<          :foreman_current_organization => "1; RedHat",       ==========================>>> Output of the [1] command. 
---
>          :foreman_current_organization => "; ANY",           ==========================>>> Output of the [2] command. 
341,342c340,341
~~~~~~~~~~~

Actual results:
--organization-id when mention without any option does not through an error nor it asks for any other option input that needs to be updated.  

Expected results:
Either remove the option or an error message should print to mention any other option to update.

If you think, this is expected I would post this to the customer.

Comment 5 Oleh Fedorenko 2021-04-27 11:26:27 UTC
Okay, as I have mentioned all the above is the default and expected behavior. Same behavior can be achieved via direct API calls.

We can't make options for actual update required since it will break backward compatibility and they are not actually required anyway. Also, if nothing was updated we can't say that an error happened since it wasn't.

We also cannot remove --organization[-id] option since the templates are taxonomable and those options are used for scoping. The best suggestion I can make here is that if nothing was specified which could cause an update (e.g. hammer template update --id <id> --organization-id <id> is used) then a different success message will be shown, such as "Nothing to update."

What do you think? If you can suggest a better message, please do :)

Just to summarize:
 1. --organization[-id] option remains.
 2. hammer template update --id <ID> NOR hammer template update --id <ID> --organization-id <ID> will cause error, since it's a valid usage and there is no actual error.
 3. Solution to that is to change success message in case nothing was changed.

Comment 7 Melanie Falz 2021-04-29 08:45:36 UTC
I discussed this issue with the customer yesterday and he would be happy to have at least a message i.e. "Nothing to update".
Many thanks for your ideas and efforts.

Comment 8 Oleh Fedorenko 2021-04-29 10:26:55 UTC
Created redmine issue https://projects.theforeman.org/issues/32454 from this bug

Comment 9 Bryan Kearney 2021-04-29 12:01:01 UTC
Upstream bug assigned to ofedoren

Comment 10 Bryan Kearney 2021-04-29 12:01:03 UTC
Upstream bug assigned to ofedoren

Comment 11 Bryan Kearney 2021-06-01 12:01:08 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/32454 has been resolved.

Comment 12 Ondrej Gajdusek 2021-07-20 12:12:54 UTC
Verified

tfm-rubygem-hammer_cli_foreman_templates-0.2.0-2.el7sat.noarch

Hammer now provides a different message if nothing was updated.

Satellite 6.9 - tfm-rubygem-hammer_cli_foreman_templates, tfm-rubygem-hammer_cli-2.3.0-1.el7sat.noarch:
# hammer template update --id 1
Provisioning template updated.

Satellite 6.10 snap 9 - tfm-rubygem-hammer_cli_foreman_templates-0.2.0-2.el7sat.noarch, tfm-rubygem-hammer_cli-2.5.1-1.el7sat.noarch:
# hammer template update --id 1
Nothing to update.


Additional info:
BZ1983760 was filed during the verification.

Comment 15 errata-xmlrpc 2021-11-16 14:09:27 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 (Moderate: Satellite 6.10 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/RHSA-2021:4702


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