mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 01:18:58 +00:00
Py3 compatibility fixes.
This commit is contained in:
parent
b076e27ce4
commit
eb5533b82d
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user