diff --git a/salt/modules/cloud.py b/salt/modules/cloud.py index 7f208a0732..5d1e433639 100644 --- a/salt/modules/cloud.py +++ b/salt/modules/cloud.py @@ -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