in templates/common.py [0:0]
def TakeZoneOut(properties):
"""Given a properties dictionary, removes the zone specific information."""
def _CleanZoneUrl(value):
value = value.split('/')[-1] if IsComputeLink(value) else value
return value
for name in default.VM_ZONE_PROPERTIES:
if name in properties:
properties[name] = _CleanZoneUrl(properties[name])
if default.ZONE in properties:
properties.pop(default.ZONE)
if default.BOOTDISK in properties:
properties[default.BOOTDISK] = _CleanZoneUrl(properties[default.BOOTDISK])
if default.DISKS in properties:
for disk in properties[default.DISKS]:
# Don't touch references to other disks
if default.DISK_SOURCE in disk:
continue
if default.INITIALIZEP in disk:
disk_init = disk[default.INITIALIZEP]
if default.DISKTYPE in disk_init:
disk_init[default.DISKTYPE] = _CleanZoneUrl(disk_init[default.DISKTYPE])