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 1402646 - [Bug] Hammer command won't accept specified organization name other than the default when .hammer/defaults.yml is configured
Summary: [Bug] Hammer command won't accept specified organization name other than the ...
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Hammer
Version: 6.2.2
Hardware: All
OS: Linux
medium
medium
Target Milestone: Unspecified
Assignee: satellite6-bugs
QA Contact: Katello QA List
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-12-08 03:10 UTC by jalviso
Modified: 2021-12-10 14:49 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-09-04 17:59:52 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 17673 0 None None None 2016-12-14 12:59:19 UTC

Description jalviso 2016-12-08 03:10:06 UTC
Description of problem:

Currently if .hammer/defaults.yml is defined with default organization,
any hammer command run with --organization option other than the default will not be honoured. 

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

How reproducible: Always

Steps to Reproduce:

0. Hammer organization defined:

# hammer organization list
[Foreman] Password for admin: 
---|--------|--------|------------
ID | NAME   | LABEL  | DESCRIPTION
---|--------|--------|------------
1  | redhat | redhat |            
4  | test   | test   |            
---|--------|--------|------------

1. Without hammer defaults configured (example using hostgroup command):

# hammer hostgroup list --organization redhat
[Foreman] Password for admin: 
---|-------------|-------------|------------------|------------------------------|------
ID | NAME        | TITLE       | OPERATING SYSTEM | ENVIRONMENT                  | MODEL
---|-------------|-------------|------------------|------------------------------|------
1  | Development | Development | RedHat 7.2       | KT_redhat_Library_puppetcv_2 |      
---|-------------|-------------|------------------|------------------------------|------

# hammer hostgroup list --organization test
[Foreman] Password for admin: 
---|------|-------|------------------|-------------|------
ID | NAME | TITLE | OPERATING SYSTEM | ENVIRONMENT | MODEL
---|------|-------|------------------|-------------|------
2  | test | test  | RedHat 7.2       |             |      
---|------|-------|------------------|-------------|------


2. With configured hammer default:

# cat .hammer/defaults.yml 
---
:defaults:
  :organization_id:
    :value: '1'
  :location_id:
    :value: '2'

2. Run hammer command specifying other --organization option.

hammer> hostgroup list --organization test
[Foreman] Password for admin: 
---|-------------|-------------|------------------|------------------------------|------
ID | NAME        | TITLE       | OPERATING SYSTEM | ENVIRONMENT                  | MODEL
---|-------------|-------------|------------------|------------------------------|------
1  | Development | Development | RedHat 7.2       | KT_redhat_Library_puppetcv_2 |      
---|-------------|-------------|------------------|------------------------------|------

Actual result: It gives the list of Hostgroup of the default.

3. Run hammer command specifying other organization by --organisation-id

hammer> hostgroup list --organization-id 4
[Foreman] Password for admin: 
---|------|-------|------------------|-------------|------
ID | NAME | TITLE | OPERATING SYSTEM | ENVIRONMENT | MODEL
---|------|-------|------------------|-------------|------
2  | test | test  | RedHat 7.2       |             |      
---|------|-------|------------------|-------------|------

Actual result: It gives the correct list of Hostgroup in organization test(id 4)

Expected result: 

With hammer default.yml configured, we should be able to use
organization by name (not only organization-id) to get correct result.


Additional info:

This is also true to other hammer commands with specified organization name, example:

hammer activation-key create 
hammer activation-key list

Comment 1 Tomas Strachota 2016-12-14 12:39:29 UTC
The issue here is we treat options like --organization and --organization-id separately and "*-id" form takes precedence. Therefore when you save the default for organization_id it always overrides --organization.

At the moment it works only with the same combinations:
- you have organization_id in defaults and override with --organization-id
- you have organization in defaults and override with --organization
cross-combinations fail.

We need to add a connection between the id and name options and properly detect the situations when one overrides the other.

Comment 2 Tomas Strachota 2016-12-14 12:59:15 UTC
Created redmine issue http://projects.theforeman.org/issues/17673 from this bug

Comment 4 Bryan Kearney 2018-09-04 17:59:52 UTC
Thank you for your interest in Satellite 6. We have evaluated this request, and we do not expect this to be implemented in the product in the foreseeable future. We are therefore closing this out as WONTFIX. If you have any concerns about this, please feel free to contact Rich Jerrido or Bryan Kearney. Thank you.


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