Bug 1460793 - hammer CLI discovery_rules create does not pass organizations_id with request
hammer CLI discovery_rules create does not pass organizations_id with request
Status: NEW
Product: Red Hat Satellite 6
Classification: Red Hat
Component: Discovery Plugin (Show other bugs)
All Linux
unspecified Severity medium (vote)
: Unspecified
: --
Assigned To: Lukas Zapletal
Roman Plevka
: Triaged
Depends On:
  Show dependency treegraph
Reported: 2017-06-12 15:05 EDT by Keith Resar
Modified: 2018-01-30 09:02 EST (History)
7 users (show)

See Also:
Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Keith Resar 2017-06-12 15:05:50 EDT
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

How reproducible:

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

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

Note You need to log in before you can comment on or make changes to this bug.