mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 01:18:58 +00:00
Initial Azure ARM driver commit (#33122)
* Initial Azure ARM driver commit * Adding version added string * Lint * Add the ability to use a custom image * Fix source image reference * Parse image details in the right place * Correct variable name * Add OS type * Fix userdata * Use image, not source_image * Fix image details for custom images * Only custom images use os_type
This commit is contained in:
parent
39a39ff725
commit
ed05544aba
1324
salt/cloud/clouds/azurearm.py
Normal file
1324
salt/cloud/clouds/azurearm.py
Normal file
File diff suppressed because it is too large
Load Diff
@ -2,12 +2,13 @@
|
||||
'''
|
||||
.. versionadded:: 2015.8.0
|
||||
|
||||
Utilities for accessing storage container blogs on Azure
|
||||
Utilities for accessing storage container blobs on Azure
|
||||
'''
|
||||
|
||||
# Import python libs
|
||||
from __future__ import absolute_import
|
||||
import logging
|
||||
import inspect
|
||||
|
||||
# Import azure libs
|
||||
HAS_LIBS = False
|
||||
@ -174,10 +175,11 @@ def object_to_dict(obj):
|
||||
|
||||
Convert an object to a dictionary
|
||||
'''
|
||||
if isinstance(obj, list):
|
||||
if isinstance(obj, list) or isinstance(obj, tuple):
|
||||
ret = []
|
||||
for item in obj:
|
||||
ret.append(obj.__dict__[item])
|
||||
#ret.append(obj.__dict__[item])
|
||||
ret.append(object_to_dict(obj))
|
||||
elif isinstance(obj, six.text_type):
|
||||
ret = obj.encode('ascii', 'replace'),
|
||||
elif isinstance(obj, six.string_types):
|
||||
@ -185,13 +187,13 @@ def object_to_dict(obj):
|
||||
else:
|
||||
ret = {}
|
||||
for item in dir(obj):
|
||||
if item.startswith('__'):
|
||||
if item.startswith('_'):
|
||||
continue
|
||||
# This is ugly, but inspect.isclass() doesn't seem to work
|
||||
if 'class' in str(type(obj.__dict__[item])):
|
||||
if inspect.isclass(obj) or 'class' in str(type(obj.__dict__.get(item))):
|
||||
ret[item] = object_to_dict(obj.__dict__[item])
|
||||
elif isinstance(obj.__dict__[item], six.text_type):
|
||||
ret[item] = obj.__dict__[item].encode('ascii', 'replace'),
|
||||
ret[item] = obj.__dict__[item].encode('ascii', 'replace')
|
||||
else:
|
||||
ret[item] = obj.__dict__[item]
|
||||
return ret
|
||||
|
Loading…
Reference in New Issue
Block a user