1
0
mirror of https://github.com/ansible/awx.git synced 2024-10-31 23:51:09 +03:00

Fix a Django lookup type.

This commit is contained in:
Michael DeHaan 2013-07-15 16:19:55 -04:00
parent 707c94f32d
commit 25174f955f

View File

@ -272,12 +272,16 @@ class ExecutableJsonLoader(BaseLoader):
data = self.command_to_json([src, "--list"]) data = self.command_to_json([src, "--list"])
print "RAW: %s" % data
group = None group = None
for (k,v) in data.iteritems(): for (k,v) in data.iteritems():
group = self.get_group(k, all_group) group = self.get_group(k, all_group)
print "TYPE %s => %s" % (k, v)
if type(v) == dict: if type(v) == dict:
# process hosts # process hosts
@ -290,6 +294,7 @@ class ExecutableJsonLoader(BaseLoader):
group.add_host(host) group.add_host(host)
if type(host_details) == list: if type(host_details) == list:
for hk in host_details: for hk in host_details:
print "?? getting host: %s" % hk
host = self.get_host(hk) host = self.get_host(hk)
group.add_host(host) group.add_host(host)
@ -306,8 +311,10 @@ class ExecutableJsonLoader(BaseLoader):
group.add_child_group(child) group.add_child_group(child)
self.child_group_names[x] = child self.child_group_names[x] = child
if type(v) == list: if type(v) in (tuple, list):
print "<><><><><><><><><><><><><><><><>><><><> GOT A LIST: %s" % (v)
for x in v: for x in v:
print ">>>>>>>>> ADDING HOST FROM AN EXECUTABLE LIST = %s to %s" % (x, group.name)
host = self.get_host(x) host = self.get_host(x)
group.add_host(host) group.add_host(host)
@ -490,8 +497,8 @@ class Command(BaseCommand):
# if overwrite is set, for each host in the database but NOT in the local # if overwrite is set, for each host in the database but NOT in the local
# list, delete it # list, delete it
if overwrite: if overwrite:
LOGGER.info("deleting any hosts not in the remote source") LOGGER.info("deleting any hosts not in the remote source: %s" % host_names.keys())
Host.objects.exclude(name___in = host_names.keys()).delete() Host.objects.exclude(name__in = host_names.keys()).delete()
# if overwrite is set, for each group in the database but NOT in the local # if overwrite is set, for each group in the database but NOT in the local
# list, delete it # list, delete it