From 0e9b977384845a0236a0b194a7c345ced2fef854 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Sun, 10 Nov 2013 08:38:06 +0000 Subject: [PATCH] Don't let Salt fail because `libcloud` is not installed. --- salt/cloud/cli.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/salt/cloud/cli.py b/salt/cloud/cli.py index c11e5fc424..2a6b571956 100644 --- a/salt/cloud/cli.py +++ b/salt/cloud/cli.py @@ -28,7 +28,11 @@ import salt.cloud import salt.cloud.config from salt.cloud.utils import parsers from salt.cloud.exceptions import SaltCloudException, SaltCloudSystemExit -from salt.cloud.libcloudfuncs import libcloud_version +try: + from salt.cloud.libcloudfuncs import libcloud_version + HAS_LIBCLOUD = True +except ImportError: + HAS_LIBCLOUD = False log = logging.getLogger(__name__) @@ -39,6 +43,9 @@ class SaltCloud(parsers.SaltCloudParser): ''' Execute the salt-cloud command line ''' + if HAS_LIBCLOUD is False: + self.error('salt-cloud requires >= libcloud 0.11.4') + libcloud_version() # Parse shell arguments