Don't return ids for deleted credential/inventory for ad hoc commands. Fixes https://trello.com/c/ps2bW38Q

This commit is contained in:
Chris Church
2015-04-16 14:31:23 -04:00
parent 3f98b40ed7
commit 6dda8e58ad
2 changed files with 15 additions and 0 deletions

View File

@@ -1543,6 +1543,10 @@ class AdHocCommandSerializer(UnifiedJobSerializer):
if parent_model in (Host, Group):
ret.pop('inventory', None)
ret.pop('limit', None)
if 'inventory' in ret and (not obj.inventory or not obj.inventory.active):
ret['inventory'] = None
if 'credential' in ret and (not obj.credential or not obj.credential.active):
ret['credential'] = None
return ret