Py3 compatibility fixes.

This commit is contained in:
Pedro Algarvio 2014-11-23 21:38:34 +00:00
parent b076e27ce4
commit eb5533b82d

View File

@ -18,6 +18,9 @@ except ImportError:
import salt.utils
# Import 3rd-party libs
import salt.ext.six as six
log = logging.getLogger(__name__)
__func_alias__ = {
@ -169,12 +172,11 @@ def get_instance(name, provider=None):
{{ salt['cloud.get_instance']('myinstance')['mac_address'] }}
'''
client = _get_client()
data = action(fun='show_instance', names=[name], provider=provider)
info = salt.utils.cloud.simple_types_filter(data)
try:
# get the first: [alias][driver][vm_name]
info = info.itervalues().next().itervalues().next().itervalues().next()
info = next(six.itervalues(next(six.itervalues(next(six.itervalues(info))))))
except AttributeError:
return None
return info