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:
Joseph Hall 2016-05-10 16:31:05 -06:00 committed by Nicole Thomas
parent 39a39ff725
commit ed05544aba
2 changed files with 1332 additions and 6 deletions

File diff suppressed because it is too large Load Diff

View File

@ -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