Project

General

Profile

Actions

Bug #21087

closed

API doc for discovery_rule have taxonomy optional but they seem to be required

Added by Lukas Zapletal over 6 years ago. Updated almost 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Discovery plugin
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

API doc for discovery_rule says both "discovery_rule[location_ids]" and "discovery_rule[organization_ids]" are optional but they seem to be required

Steps to Reproduce:
1. Have host group with ID 1 which links to default org (id 1) and default
loc (id 2)
2. Attempt to create discovery rule and use only required fields as per
documentation
$ curl -k -u <user>:<pass> -X POST -H 'Accept: application/json' -H 'Content-Type: application/json' https://&lt;fwdn&gt;/api/v2/discovery_rules/ -d '{"discovery_rule":{"name":"MyDiscoveryRuleFromApi","search":"cpu_count=10","hostgroup_id":1}}' {
"error": {"id":null,"errors":{"organizations":["Host group organization Default Organization must also be associated to the discovery rule"],"locations":["Host group location Default Location must also be associated to the discovery rule"]},"full_messages":["Organizations Host group organization Default Organization must also be associated to the discovery rule","Locations Host group location Default Location must also be associated to the discovery rule"]}
}

Actual results:
Error above.

Expected results:
Either error should not be there, or documentation should say these two fields are required.

Additional info:
With both of these fields, it works
$ curl -k -u <user>:<pass> -X POST -H 'Accept: application/json' -H 'Content-Type: application/json' https://&lt;fqdn&gt;/api/v2/discovery_rules/ -d '{"discovery_rule":{"name":"MyDiscoveryRuleFromApi","search":"cpu_count=10","hostgroup_id":1,"organization_ids":[1],"location_ids":[2]}}' {"id":8,"name":"MyDiscoveryRuleFromApi","search":"cpu_count=10","hostgroup_id":1,"hostname":"","max_count":0,"priority":0,"enabled":true,"created_at":"2017-09-22T14:30:13.913Z","updated_at":"2017-09-22T14:30:13.913Z"}

Actions #1

Updated by Rahul Bajaj over 6 years ago

  • Assignee set to Rahul Bajaj
Actions #2

Updated by The Foreman Bot over 6 years ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman_discovery/pull/386 added
Actions #3

Updated by Rahul Bajaj over 6 years ago

  • Target version set to 220
Actions #4

Updated by Rahul Bajaj over 6 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100
Actions

Also available in: Atom PDF