Bug 1868310
Summary: | hammer template update has a option --organization-id that does not update anything. | ||
---|---|---|---|
Product: | Red Hat Satellite | Reporter: | Jaskaran Singh Narula <janarula> |
Component: | Templates Plugin | Assignee: | Oleh Fedorenko <ofedoren> |
Status: | CLOSED ERRATA | QA Contact: | Ondrej Gajdusek <ogajduse> |
Severity: | medium | Docs Contact: | |
Priority: | unspecified | ||
Version: | 6.7.0 | CC: | apatel, kgaikwad, mfalz, mhulan, ofedoren, oprazak, rabajaj |
Target Milestone: | 6.10.0 | Keywords: | Triaged |
Target Release: | Unused | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
Whiteboard: | |||
Fixed In Version: | tfm-rubygem-hammer_cli_foreman-2.5.1 | Doc Type: | If docs needed, set a value |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2021-11-16 14:09:27 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: |
Description
Jaskaran Singh Narula
2020-08-12 09:39:10 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. 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. 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. 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. Created redmine issue https://projects.theforeman.org/issues/32454 from this bug Upstream bug assigned to ofedoren Upstream bug assigned to ofedoren Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/32454 has been resolved. 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. 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 |