Make blessed an optional dependency
blessed is not in openstack g-r and blocks us from aligning there. This makes the dependency optional. If it is not installed, the cli browse command emits a warning telling the user to install it. The browse section of the CLI is the only place its used and doesn't affect any other functionality. Change-Id: If446c2135936c8ea4083eb9fc712a98031b28ac4
This commit is contained in:
parent
bca359320a
commit
f475c70232
|
@ -26,7 +26,13 @@ import threading
|
|||
from contextlib import closing
|
||||
from datetime import datetime
|
||||
|
||||
from blessed import Terminal
|
||||
try:
|
||||
from blessed import Terminal
|
||||
except ImportError:
|
||||
# blessed is not part of openstack global-requirements.
|
||||
raise Exception("The 'blessed' python module is required to browse"
|
||||
" Akanda routers. Please install and try again.")
|
||||
|
||||
from oslo.config import cfg
|
||||
|
||||
from akanda.rug import commands
|
||||
|
|
|
@ -8,6 +8,12 @@ from cliff import commandmanager
|
|||
from akanda.rug.api import rug
|
||||
from akanda.rug.openstack.common import log as logging
|
||||
|
||||
try:
|
||||
import blessed # noqa
|
||||
HAS_BLESSED = True
|
||||
except ImportError:
|
||||
HAS_BLESSED = False
|
||||
|
||||
|
||||
class TestRugAPI(unittest.TestCase):
|
||||
|
||||
|
@ -19,6 +25,7 @@ class TestRugAPI(unittest.TestCase):
|
|||
self.api = rug.RugAPI(ctl)
|
||||
self.ctl = ctl.return_value
|
||||
|
||||
@unittest.skipUnless(HAS_BLESSED, "blessed not available")
|
||||
def test_browse(self):
|
||||
resp = self.api(webob.Request({
|
||||
'REQUEST_METHOD': 'PUT',
|
||||
|
|
|
@ -8,4 +8,3 @@ kombu>=2.4.8
|
|||
WebOb>=1.2.3,<1.3
|
||||
python-novaclient>=2.15.0
|
||||
cliff>=1.4.3
|
||||
blessed>=1.9.1
|
||||
|
|
Loading…
Reference in New Issue