Bug 1357557

Summary: A new option --content-view-organization-id added to bunch of hammer sub-commands though intended for hostgroup cmd only
Product: Red Hat Satellite Reporter: Sachin Ghai <sghai>
Component: HammerAssignee: Andrew Kofink <akofink>
Status: CLOSED ERRATA QA Contact: Jitendra Yejare <jyejare>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.2.0CC: bbuckingham, ehelms, jyejare, mmccune, sghai
Target Milestone: UnspecifiedKeywords: Regression, Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: rubygem-hammer_cli_katello-0.0.22.23-1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-07-27 11:39:44 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 Sachin Ghai 2016-07-18 13:44:59 UTC
Description of problem:

I see a new change in hammer that introduces new failures in our automation. I see a new option  *content-view-organization-id* is added to bunch of hammer
sub-commands like:
 
activation-key, 
content-view filter/version, pulp-module add/remove
host subscription register,
hammer package-group list
hammer puppet-module list
hammer ostree-branch list
hammer docker manifest list
hammer host errata list


however this option is expected only for hostgroup not for others sub-commands.

Version-Release number of selected component (if applicable):
sat62 GA snap20.2

How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:
--content-view-organization-id should be only for hostgroup not for all.

Additional info:

<sghai> ehelms, ping.. any idea about the addition of new option  *content-view-organization-id* in hammer sub-commands..?
<ehelms> sghai: how many commands or rather which ones do you see it for?
<sghai> ehelms, content-view/content-view version/filter etc..
<ehelms> sghai: no, that is not intentional, its supposed to exist for hostgroups only

Comment 2 Brad Buckingham 2016-07-18 17:01:11 UTC
Sachin, do those commands work in spite of the additional parameter?  Or is it requiring it to be provided?

Comment 4 Sachin Ghai 2016-07-19 13:04:04 UTC
(In reply to Brad Buckingham from comment #2)
> Sachin, do those commands work in spite of the additional parameter?  Or is
> it requiring it to be provided?

Most of the cmds are failing with error:

cv update:
===============

 LANG=en_US.UTF-8  hammer -v -u admin -p changeme --output=csv content-view update --id="467" --name="𧗢𩸅퉐𤧶㞨𤽤厲𤠼𨑏㾖"
2016-07-17 17:52:07 - robottelo.ssh - INFO - Instantiated Paramiko client 0x7f19b2bf9050
2016-07-17 17:52:10 - robottelo.ssh - INFO - Destroying Paramiko client 0x7f19b2bf9050
2016-07-17 17:52:10 - robottelo.ssh - INFO - Destroyed Paramiko client 0x7f19b2bf9050
2016-07-17 17:52:10 - robottelo.ssh - DEBUG - <<< stderr
[ERROR 2016-07-17 17:52:10 Exception] Error: Could not find organization, please set one of options --organization, --organization-label.
Could not update the content view:
  Error: Could not find organization, please set one of options --organization, --organization-label.
[ERROR 2016-07-17 17:52:10 Exception] 


Host subscription register:
===========================

 hammer -v -u admin -p changeme --output=csv host subscription register --lifecycle-environment="Library" --content-view-id="411" --organization-id="503" --name="qBzPPjQwuspOhMU"
2016-07-17 16:08:04 - robottelo.ssh - INFO - Instantiated Paramiko client 0x7fc68c021950
2016-07-17 16:08:06 - robottelo.ssh - INFO - Destroying Paramiko client 0x7fc68c021950
2016-07-17 16:08:06 - robottelo.ssh - INFO - Destroyed Paramiko client 0x7fc68c021950
2016-07-17 16:08:06 - robottelo.ssh - DEBUG - <<< stderr
[ERROR 2016-07-17 16:08:06 Exception] Error: Could not find organization, please set one of options --organization, --organization-label, --organization-id.
Failed to register host:
  Error: Could not find organization, please set one of options --organization, --organization-label, --organization-id.
[ERROR 2016-07-17 16:08:06 Exception] 




All content-view filter commands are affected with this. All required now org name/lable/id.

Comment 5 Jitendra Yejare 2016-07-20 13:25:59 UTC
As per comment 3, the fix is given for hostgroup issue is to use  '--organization-id' and not the 'content-view-organization-id', the same is tested and verified as below and is expected.

# hammer hostgroup update --id 2 --lifecycle-environment 'DEV' --content-view 'rhel7_cv' --organization-id 1
Hostgroup updated


# hammer hostgroup create --name 'hg2' --lifecycle-environment 'DEV' --content-view 'rhel7_cv' --operatingsystem 'RedHat 7.2' --organization-id 1 --partition-table 'Kickstart default' --subnet 'subnet1'
Hostgroup created


Other areas/subcommands the change is been reverted back to use '--organization-id' and not the 'content-view-organization-id'. And the unaffected/reverted area's are tested and verified as below" and are expected:

1. AK
# hammer activation-key info --help  | grep org
 --organization ORGANIZATION_NAME        Organization name to search by
 --organization-id ORGANIZATION_ID       organization ID
 --organization-label ORGANIZATION_LABEL Organization label to search by

# hammer activation-key create --help  | grep org
 --organization ORGANIZATION_NAME                    Organization name to search by
 --organization-id ORGANIZATION_ID                   organization ID
 --organization-label ORGANIZATION_LABEL             Organization label to search by


2. Content View filter/Version, puppet-module add / remove

# hammer content-view filter create --help | grep org
 --organization ORGANIZATION_NAME        Organization name to search by
 --organization-id ORGANIZATION_ID       organization ID
 --organization-label ORGANIZATION_LABEL Organization label to search by

# hammer content-view version info --help | grep org
 --organization ORGANIZATION_NAME        Organization name to search by
 --organization-id ORGANIZATION_ID       organization ID
 --organization-label ORGANIZATION_LABEL Organization label to search by

# hammer content-view version export --help | grep org
 --organization ORGANIZATION_NAME        Organization name to search by
 --organization-id ORGANIZATION_ID       organization ID
 --organization-label ORGANIZATION_LABEL Organization label to search by

# hammer content-view puppet-module add --help | grep org
 --organization ORGANIZATION_NAME        Organization name to search by
 --organization-id ORGANIZATION_ID       organization ID
 --organization-label ORGANIZATION_LABEL Organization label to search by

# hammer content-view puppet-module remove --help | grep org
 --organization ORGANIZATION_NAME        Organization name to search by
 --organization-id ORGANIZATION_ID       organization ID
 --organization-label ORGANIZATION_LABEL Organization label to search by


3. host subscription register:

# hammer host subscription register --help | grep org
 --organization ORGANIZATION_NAME                    Organization name to search by
 --organization-id ORGANIZATION_ID                   organization ID
 --organization-label ORGANIZATION_LABEL             Organization label to search by


4. hammer package-group list
# hammer package-group list --help | grep org
 --organization ORGANIZATION_NAME                    Organization name to search by
 --organization-id ORGANIZATION_ID                   organization ID
 --organization-label ORGANIZATION_LABEL             Organization label to search by


5. hammer puppet-module list
# hammer puppet-module list --help | grep org
 --organization ORGANIZATION_NAME                    Organization name to search by
 --organization-id ORGANIZATION_ID                   organization ID
 --organization-label ORGANIZATION_LABEL             Organization label to search by


6. hammer ostree-branch list
# hammer ostree-branch list --help | grep org
 --organization ORGANIZATION_NAME                    Organization name to search by
 --organization-id ORGANIZATION_ID                   organization ID
 --organization-label ORGANIZATION_LABEL             Organization label to search by


7. hammer docker manifest list
# hammer docker manifest list --help | grep org
 --organization ORGANIZATION_NAME                    Organization name to search by
 --organization-id ORGANIZATION_ID                   organization ID
 --organization-label ORGANIZATION_LABEL             Organization label to search by


So moving this bug to 'Verfied' state.

If this bug needs any more things to test feel free to reopen.

Comment 6 Bryan Kearney 2016-07-27 11:39:44 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, 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-2016:1501