]> review.fuel-infra Code Review - openstack-build/heat-build.git/commitdiff
Get rid of leftover heat-jeos code in utils
authorZane Bitter <zbitter@redhat.com>
Fri, 7 Dec 2012 14:36:54 +0000 (15:36 +0100)
committerZane Bitter <zbitter@redhat.com>
Fri, 7 Dec 2012 14:47:10 +0000 (15:47 +0100)
This code, including the Glance client dependency, was left over from when
what is now heat-jeos was part of the heat codebase.

Change-Id: I35081fb7911ad1ea3284cbb6e3f83dd8c6a1807f
Signed-off-by: Zane Bitter <zbitter@redhat.com>
heat/utils.py

index bc39b6cfd058d697a5d5511178d383312ddc1267..d494b9271fd808e759b6ce9b9a317642c8553a53 100644 (file)
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
-import functools
-import os
-import os.path
-import sys
-import base64
-from lxml import etree
-import re
-
-try:
-    from glanceclient import client as glance_client
-except ImportError:
-    from glance import client as glance_client
-from heat.common import exception
-
-from heat.openstack.common import log as logging
-
-LOG = logging.getLogger(__name__)
-
-SUCCESS = 0
-FAILURE = 1
-
-
-def catch_error(action):
-    """Decorator to provide sensible default error handling for CLI actions."""
-    def wrap(func):
-        @functools.wraps(func)
-        def wrapper(*arguments, **kwargs):
-            try:
-                ret = func(*arguments, **kwargs)
-                return SUCCESS if ret is None else ret
-            except exception.NotAuthorized:
-                LOG.error("Not authorized to make this request. Check " +
-                      "your credentials (OS_USERNAME, OS_PASSWORD, " +
-                      "OS_TENANT_NAME, OS_AUTH_URL and OS_AUTH_STRATEGY).")
-                return FAILURE
-            except exception.ClientConfigurationError:
-                raise
-            except exception.KeystoneError, e:
-                LOG.error("Keystone did not finish the authentication and "
-                              "returned the following message:\n\n%s"
-                              % e.message)
-                return FAILURE
-            except Exception, e:
-                options = arguments[0]
-                if options.debug:
-                    raise
-                LOG.error("Failed to %s. Got error:" % action)
-                pieces = unicode(e).split('\n')
-                for piece in pieces:
-                    LOG.error(piece)
-                return FAILURE
-
-        return wrapper
-    return wrap
-
 
 class LazyPluggable(object):
     """A pluggable backend loaded lazily based on some value."""