Bug 1713222

Summary: Hammer host/hg create/edit --environment is masked
Product: Red Hat Satellite Reporter: Lukas Zapletal <lzap>
Component: Hammer - ContentAssignee: Oleh Fedorenko <ofedoren>
Status: CLOSED ERRATA QA Contact: Roman Plevka <rplevka>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.6.0CC: apatel, dvoss, egolov, inecas, jhutar, jomitsch, kgaikwad, ktordeur, mbacovsk, mshira, mzalewsk, ofedoren, pcreech, rabajaj, spetrosi
Target Milestone: 6.6.0Keywords: AutomationBlocker, PrioBumpQA, Regression, TestBlocker, Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: tfm-rubygem-hammer_cli_foreman-0.17.0.3-1,tfm-rubygem-hammer_cli_katello-0.18.0.2-1 Doc Type: Deprecated Functionality
Doc Text:
The `--environment` and `--environment-id` options of the `hammer` command are deprecated because of confusion between lifecycle and Puppet environments. Use the `--lifecycle-environment` or `--puppet-environment` options instead.
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-10-22 13:30:45 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:
Bug Depends On: 1730026    
Bug Blocks:    

Description Lukas Zapletal 2019-05-23 07:54:51 UTC
Hello, regression from 6.5:

hammer hostgroup create --name xxx ... --environment production
Hostgroup created.

In 6.6 however:

hammer hostgroup create --name xxx ... --environment production
Could not create the hostgroup:
  Error: lifecycle_environment not found.

Apparently something made hammer think that --environment is actually --lifecycle-environment:

hammer hostgroup create --name xxx ... --environment Library
Hostgroup created.

Unable to crate hosts or hostgroups, blocker, regression.

Comment 3 Jonathon Turel 2019-06-19 19:36:05 UTC
*** Bug 1715992 has been marked as a duplicate of this bug. ***

Comment 4 Bryan Kearney 2019-07-02 08:08:06 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue https://projects.theforeman.org/issues/23204 has been resolved.

Comment 7 Mirek Długosz 2019-07-15 15:53:28 UTC
These patches caused https://bugzilla.redhat.com/show_bug.cgi?id=1730026 . More bugs might be coming as we discover them.

Comment 8 Peter Ondrejka 2019-07-16 08:07:43 UTC
When pulling in such changes we should consider the downstream documentation impact, certainly 6.6 versions of [1] and [2] will be affected. Oleh, could you please file a bz against documentation detailing the scope of changes so that the docs guys have time to sort it out before release?

Also I'd say the problem in comment #7 is a blocker for this bz.

[1]https://access.redhat.com/documentation/en-us/red_hat_satellite/6.5/html-single/hammer_cli_guide/index
[2]https://access.redhat.com/documentation/en-us/red_hat_satellite/6.5/html/hammer_cheat_sheet/index

Comment 11 Roman Plevka 2019-08-07 06:53:50 UTC
VERIFIED
on beta snap,

verified by automation:
tests/foreman/cli/test_hostgroup.py::HostGroupTestCase::test_positive_create_with_multiple_entities_and_delete

```
hammer -v -u admin -p changeme --output=csv environment create --location-ids="463" --name="jZlJEl" --organization-ids="465"'
2019-08-02 14:29:18 - robottelo.ssh - INFO - <<< stdout
Message,Id,Name
Environment created.,119,jZlJEl
...
hammer -v -u admin -p changeme --output=csv hostgroup create --architecture="gfNbrbPQDs" --content-source-id="1" --content-view="UsCDcgHsQO" --domain="fe9saudcec" --environment="jZlJEl" --locations="y0OMVUqkUX" --lifecycle-environment="4AMfy0" --medium="iElooq" --name="NDqnTcvtqgIElqlRMuToWWchPxXvlJGMGROYgcnTKyNsBdCCzeTbqVgmNNL" --operatingsystem="022mdv 3.6" --organization-ids="465,448" --partition-table="DaMr20Zamo" --puppet-ca-proxy="qe-sat66-*.redhat.com" --puppet-classes="generic_1" --puppet-proxy="qe-sat66-*.redhat.com" --query-organization="pjU7gk" --subnet="U6jLIFko"'
2019-08-02 14:30:28 - robottelo.ssh - INFO - <<< stdout
Message,Id,Name
Hostgroup created.,50,NDqnTcvtqgIElqlRMuToWWchPxXvlJGMGROYgcnTKyNsBdCCzeTbqVgmNNL
...
hammer -v -u admin -p changeme hostgroup info --id="50"'
2019-08-02 14:30:31 - robottelo.ssh - INFO - <<< stdout
Id: 50
Name: NDqnTcvtqgIElqlRMuToWWchPxXvlJGMGROYgcnTKyNsBdCCzeTbqVgmNNL
Title: NDqnTcvtqgIElqlRMuToWWchPxXvlJGMGROYgcnTKyNsBdCCzeTbqVgmNNL
Puppet Environment: jZlJEl
...
```

Comment 16 errata-xmlrpc 2019-10-22 13:30:45 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-2019:3175