Remove insights_credential from inventory

This commit is contained in:
Bill Nottingham
2021-06-16 16:47:42 -04:00
committed by Shane McDonald
parent 0947d30682
commit 1e68519c99
26 changed files with 38 additions and 267 deletions

View File

@@ -59,14 +59,12 @@ class Inventory(HasCopy, HasCreate, HasInstanceGroups, HasVariables, base.Base):
organization=organization.id,
)
optional_fields = ('host_filter', 'insights_credential', 'kind', 'variables')
optional_fields = ('host_filter', 'kind', 'variables')
update_payload(payload, optional_fields, kwargs)
if 'variables' in payload and isinstance(payload.variables, dict):
payload.variables = json.dumps(payload.variables)
if 'insights_credential' in payload and isinstance(payload.insights_credential, Credential):
payload.insights_credential = payload.insights_credential.id
return payload

View File

@@ -45,7 +45,7 @@ def pk_or_name(v2, model_name, value, page=None):
identity = UNIQUENESS_RULES[model_name][-1]
# certain related fields follow a pattern of <foo>_<model> e.g.,
# insights_credential, target_credential etc...
# target_credential etc...
if not page and '_' in model_name:
return pk_or_name(v2, model_name.split('_')[-1], value, page)