Py3 compatibility fixes.

This commit is contained in:
Pedro Algarvio 2014-11-22 14:37:40 +00:00
parent 42d1bc49ee
commit c3403bb949

View File

@ -7,6 +7,12 @@ Used to display the output from the :mod:`virt.query <salt.runners.virt.query>`
runner.
'''
# Import python libs
from __future__ import absolute_import
# Import 3rd-party libs
import salt.ext.six as six
def output(data):
'''
@ -30,7 +36,7 @@ def output(data):
id_,
vm_data['graphics']['port'])
if 'disks' in vm_data:
for disk, d_data in vm_data['disks'].items():
for disk, d_data in six.iteritems(vm_data['disks']):
out += ' Disk - {0}:\n'.format(disk)
out += ' Size: {0}\n'.format(d_data['disk size'])
out += ' File: {0}\n'.format(d_data['file'])
@ -38,6 +44,7 @@ def output(data):
if 'nics' in vm_data:
for mac in vm_data['nics']:
out += ' Nic - {0}:\n'.format(mac)
out += ' Source: {0}\n'.format(vm_data['nics'][mac]['source'][next(vm_data['nics'][mac]['source'].iterkeys())])
out += ' Source: {0}\n'.format(
vm_data['nics'][mac]['source'][next(six.iterkeys(vm_data['nics'][mac]['source']))])
out += ' Type: {0}\n'.format(vm_data['nics'][mac]['type'])
return out