Port has_key to python3 compatible syntax

pull/18515/head
James Tanner 8 years ago committed by Toshio Kuratomi
parent c09060e8ff
commit 2d2bb626d4

@ -342,7 +342,7 @@ class GceInventory(object):
if inst is None:
return {}
if inst.extra['metadata'].has_key('items'):
if 'items' in inst.extra['metadata']:
for entry in inst.extra['metadata']['items']:
md[entry['key']] = entry['value']
@ -419,7 +419,7 @@ class GceInventory(object):
if zones and zone not in zones:
continue
if groups.has_key(zone): groups[zone].append(name)
if zone in groups: groups[zone].append(name)
else: groups[zone] = [name]
tags = node.extra['tags']
@ -428,25 +428,25 @@ class GceInventory(object):
tag = t[6:]
else:
tag = 'tag_%s' % t
if groups.has_key(tag): groups[tag].append(name)
if tag in groups: groups[tag].append(name)
else: groups[tag] = [name]
net = node.extra['networkInterfaces'][0]['network'].split('/')[-1]
net = 'network_%s' % net
if groups.has_key(net): groups[net].append(name)
if net in groups: groups[net].append(name)
else: groups[net] = [name]
machine_type = node.size
if groups.has_key(machine_type): groups[machine_type].append(name)
if machine_type in groups: groups[machine_type].append(name)
else: groups[machine_type] = [name]
image = node.image and node.image or 'persistent_disk'
if groups.has_key(image): groups[image].append(name)
if image in groups: groups[image].append(name)
else: groups[image] = [name]
status = node.extra['status']
stat = 'status_%s' % status.lower()
if groups.has_key(stat): groups[stat].append(name)
if stat in groups: groups[stat].append(name)
else: groups[stat] = [name]
groups["_meta"] = meta

Loading…
Cancel
Save