Port has_key to python3 compatible syntax
(cherry picked from commit 2d2bb626d4
)
This commit is contained in:
parent
6f5ec79e91
commit
39cb6797a3
1 changed files with 7 additions and 7 deletions
|
@ -261,7 +261,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']
|
||||
|
||||
|
@ -326,7 +326,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']
|
||||
|
@ -335,25 +335,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…
Reference in a new issue