~ubuntu-branches/ubuntu/saucy/nova/saucy-proposed

« back to all changes in this revision

Viewing changes to nova/openstack/common/importutils.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short, Chuck Short, Adam Gandelman
  • Date: 2013-02-22 09:27:29 UTC
  • mfrom: (1.1.68)
  • Revision ID: package-import@ubuntu.com-20130222092729-nn3gt8rf97uvts77
Tags: 2013.1.g3-0ubuntu1
[ Chuck Short ]
* New usptream release. 
* debian/patches/debian/patches/fix-ubuntu-tests.patch: Refreshed.
* debian/nova-baremetal.logrotate: Fix logfile path.
* debian/control, debian/nova-spiceproxy.{install, logrotate, upstart}:
  Add spice html5 proxy support.
* debian/nova-novncproxy.upstart: Start on runlevel [2345]
* debian/rules: Call testr directly since run_tests.sh -N gives weird return
  value when tests pass.
* debian/pyddist-overrides: Add websockify.
* debian/nova-common.postinst: Removed config file conversion, since
  the option is no longer available. (LP: #1110567)
* debian/control: Add python-pyasn1 as a dependency.
* debian/control: Add python-oslo-config as a dependency.
* debian/control: Suggest sysfsutils, sg3-utils, multipath-tools for fibre
  channel support.

[ Adam Gandelman ]
* debian/control: Fix typo (websocikfy -> websockify).

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
    try:
30
30
        __import__(mod_str)
31
31
        return getattr(sys.modules[mod_str], class_str)
32
 
    except (ValueError, AttributeError), exc:
 
32
    except (ValueError, AttributeError):
33
33
        raise ImportError('Class %s cannot be found (%s)' %
34
34
                          (class_str,
35
35
                           traceback.format_exception(*sys.exc_info())))
57
57
    """Import a module."""
58
58
    __import__(import_str)
59
59
    return sys.modules[import_str]
 
60
 
 
61
 
 
62
def try_import(import_str, default=None):
 
63
    """Try to import a module and if it fails return default."""
 
64
    try:
 
65
        return import_module(import_str)
 
66
    except ImportError:
 
67
        return default