Bug 1325113

Summary: hammer fails to remove LCE from a CV if cv_id+org_id or cv_name+org_name are specified
Product: Red Hat Satellite Reporter: Andrii Balakhtar <abalakht>
Component: Content ViewsAssignee: Zach Huntington-Meath <zhunting>
Status: CLOSED WONTFIX QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 6.2.0CC: bbuckingham
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
URL: http://projects.theforeman.org/issues/14708
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-09-04 17:46:18 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 Andrii Balakhtar 2016-04-08 09:43:57 UTC
Description of problem:
Hammer fails to delete a lifecycle environment from content view if content view was specified by both CV id and organization id. Specifying cv id + org id is not mandatory, as cv id is unique and it should be sufficient for determining desired cv, but anyway exception shouldn't be risen when user also includes org id.
Other use cases like specifying only cv id or cv name + org id are working as expected.

Version-Release number of selected component (if applicable):
Sat6.2 Beta Snap6.2

How reproducible:
Always

Steps to Reproduce:
1. Create a content view:
hammer content-view create --organization-id="15" --name="VQnMGNiFIN"
2. Publish it:
hammer content-view publish --id="22"
3. Try to remove default Library lifecycle environment while specifying both content view id and organization id:
hammer content-view remove --id="22" --organization-id="15" --environment-ids="26"

Actual results:
[ERROR 2016-04-08 05:14:20 Exception] Error: undefined method `include?' for nil:NilClass
Could not remove objects from content view:
  Error: undefined method `include?' for nil:NilClass
[ERROR 2016-04-08 05:14:20 Exception] 

NoMethodError (undefined method `include?' for nil:NilClass):
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_katello-0.0.22.5/lib/hammer_cli_katello/id_resolver.rb:65:in `block in environment_ids'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_katello-0.0.22.5/lib/hammer_cli_katello/id_resolver.rb:65:in `select'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_katello-0.0.22.5/lib/hammer_cli_katello/id_resolver.rb:65:in `environment_ids'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.5.1.3/lib/hammer_cli_foreman/commands.rb:165:in `get_resource_ids'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.5.1.3/lib/hammer_cli_foreman/commands.rb:231:in `block in customized_options'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.5.1.3/lib/hammer_cli_foreman/commands.rb:228:in `each'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.5.1.3/lib/hammer_cli_foreman/commands.rb:228:in `customized_options'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.5.1.3/lib/hammer_cli_foreman/commands.rb:243:in `request_params'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_katello-0.0.22.5/lib/hammer_cli_katello/content_view.rb:183:in `request_params'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.5.1.4/lib/hammer_cli/apipie/command.rb:43:in `send_request'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.5.1.3/lib/hammer_cli_foreman/commands.rb:189:in `send_request'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman_tasks-0.0.10/lib/hammer_cli_foreman_tasks/async_command.rb:14:in `execute'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/command.rb:68:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.5.1.4/lib/hammer_cli/abstract.rb:22:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/subcommand/execution.rb:11:in `execute'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/command.rb:68:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.5.1.4/lib/hammer_cli/abstract.rb:22:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/subcommand/execution.rb:11:in `execute'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/command.rb:68:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.5.1.4/lib/hammer_cli/abstract.rb:22:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/command.rb:133:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.5.1.4/bin/hammer:125:in `<top (required)>'
    /usr/bin/hammer:23:in `load'
    /usr/bin/hammer:23:in `<main>'

Expected results:
Lifecycle environment was removed successfully

Additional info:

Comment 3 Andrii Balakhtar 2016-04-14 19:58:07 UTC
I was also able to reproduce it with org name + cv name combination, and that's pretty common use case so it's better to fix this. Short summary:

cv id              | OK
cv name + org id   | OK
cv name + org name | ERROR
cv id + org id     | ERROR

Comment 4 Zach Huntington-Meath 2016-04-19 13:52:20 UTC
Created redmine issue http://projects.theforeman.org/issues/14708 from this bug

Comment 6 Bryan Kearney 2018-09-04 17:46:18 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.