Merge pull request #31744 from brejoc/fix-attribute-error-with-older-libcloud/2015.5

Fix for AttributeError with libcloud <0.15
This commit is contained in:
Nicole Thomas 2016-03-09 17:15:26 -07:00
commit 970ef0e445

View file

@ -6,7 +6,7 @@ CloudStack Cloud Module
The CloudStack cloud module is used to control access to a CloudStack based
Public Cloud.
:depends: libcloud
:depends: libcloud >= 0.15
Use of this module requires the ``apikey``, ``secretkey``, ``host`` and
``path`` parameters.
@ -202,7 +202,12 @@ def get_project(conn, vm_):
'''
Return the project to use.
'''
projects = conn.ex_list_projects()
try:
projects = conn.ex_list_projects()
except AttributeError:
# with versions <0.15 of libcloud this is causing an AttributeError.
log.warning('Cannot get projects, you may need to update libcloud to 0.15 or later')
return False
projid = config.get_cloud_config_value('projectid', vm_, __opts__)
if not projid: