Bug #17673
closedHammer commands don't accept name options when there's id equivalent in defaultsis configured
Description
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:
hammer-cli 0.8.0
hammer-cli-foreman 0.8.0
Steps to Reproduce:
1. Hammer organization defined:
# hammer organization list ---|--------|--------|------------ ID | NAME | LABEL | DESCRIPTION ---|--------|--------|------------ 1 | redhat | redhat | 4 | test | test | ---|--------|--------|------------
1. Without hammer defaults configured (example using hostgroup command):
# hammer hostgroup list --organization redhat ---|-------------|-------------|------------------|------------------------------|------ ID | NAME | TITLE | OPERATING SYSTEM | ENVIRONMENT | MODEL ---|-------------|-------------|------------------|------------------------------|------ 1 | Development | Development | RedHat 7.2 | KT_redhat_Library_puppetcv_2 | ---|-------------|-------------|------------------|------------------------------|------ # hammer hostgroup list --organization test ---|------|-------|------------------|-------------|------ ID | NAME | TITLE | OPERATING SYSTEM | ENVIRONMENT | MODEL ---|------|-------|------------------|-------------|------ 2 | test | test | RedHat 7.2 | | ---|------|-------|------------------|-------------|------
3. With configured hammer default:
# cat .hammer/defaults.yml --- :defaults: :organization_id: :value: '1' :location_id: :value: '2'
4. Run hammer command specifying other --organization option.
hammer hostgroup list --organization test ---|-------------|-------------|------------------|------------------------------|------ 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.
5. Run hammer command specifying other organization by --organisation-id
hammer hostgroup list --organization-id 4 ---|------|-------|------------------|-------------|------ 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 issue with all --<resource> options and their --<resource>-id equivalents accross the whole hammer.
Updated by Tomáš Strachota over 7 years ago
- Subject changed from Hammer commands don't accept name options when there's id equivalent in defaultsis configured to Hammer commands don't accept name options when there's id equivalent in defaultsis configured
- Category changed from Other commands to Hammer core
- Target version set to 115
Updated by Oleh Fedorenko about 4 years ago
- Status changed from New to Closed
- Triaged set to Yes
It appears to be resolved already; I was able to use defaults with explicitly set org/loc to get the right results.
Closing this, since the issue was resolved.