Adding license checks for Tower inventory source

* For Tower the license must match between the source and destination
* For AWX the check is disabled
* Hosts imported from another Tower don't count against your license
  in the local Tower
* Fix up some issues with enablement
* Prevent slashes from being used in the instance filter
* Add &all=1 filter to make sure we pick up all hosts
This commit is contained in:
Matthew Jones
2017-10-26 11:32:16 -04:00
parent d282966aa1
commit 5f3ebc26e0
5 changed files with 26 additions and 6 deletions

View File

@@ -2443,7 +2443,7 @@ class InventoryScriptView(RetrieveAPIView):
for host in obj.hosts.filter(**hosts_q):
data['_meta']['hostvars'][host.name] = host.variables_dict
if towervars:
tower_dict = dict(remote_tower_enabled=host.enabled,
tower_dict = dict(remote_tower_enabled=str(host.enabled).lower(),
remote_tower_id=host.id)
data['_meta']['hostvars'][host.name].update(tower_dict)