Bug 1460793

Summary: hammer CLI discovery_rules create does not pass organizations_id with request
Product: Red Hat Satellite Reporter: Keith Resar <kresar>
Component: Discovery PluginAssignee: Lukas Zapletal <lzap>
Status: CLOSED WONTFIX QA Contact: Roman Plevka <rplevka>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.2.9CC: dhlavacd, kresar, lzap, mhulan, rplevka, sthirugn, tstrachota
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-09-04 17:47:15 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 Keith Resar 2017-06-12 19:05:50 UTC
Description of problem:
Using the hammer CLI to create discovery rules fails with an error related to missing organizatrions_id.  Hammer is not passing along the default organization ID nor are command line options documented that allow specifying this.

Discovery rules cannot be created without tying to a specific organization ID.

Version-Release number of selected component (if applicable):
Satellite version 6.2.9
Hammer version 0.5.1.13

How reproducible:
Always.

Steps to Reproduce:
1. hammer -d discovery_rule create --hostgroup $hostgroup --name MyDiscoveryRule --search "organization = lab"
2. 
3.

Actual results:
Returns http 422 error "Organizations Host group organization lab must also be associated to the discovery rule"

Expected results:
Discovery rule created.

Additional info:

Run in debug I see the following params provided in the API POST request:
    "discovery_rule" => {
                "name" => "MyDiscoveryRule",
              "search" => "organization = lab",
        "hostgroup_id" => 2
    }

If I run the following direct API query the discovery_rule is created since the organization_ids are provided.

curl -X POST -H "Accept:application/json,version=2" -H "Content-Type:application/json" -s -k -u user:password -d "{\"name\":\"MyDiscoveryRule\", \"search\":\"organization = lab\",\"hostgroup_id\":2, \"organization_ids\": [1]}" https://satelliteserver/api/v2/discovery_rules

Comment 5 Bryan Kearney 2018-09-04 17:47:15 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.