Add manila client to heat requirements
The requirements for manila client has been added (the version is the same as global-requirements version). Also the manilaclient version is introduced when creating a client. Change-Id: Id487c94477e82addbb98e5402ae50f0151c87669
This commit is contained in:
parent
321c705a9a
commit
8731f53c55
|
@ -11,13 +11,11 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from oslo_utils import importutils
|
||||
|
||||
from heat.engine.clients import client_plugin
|
||||
from manilaclient import client as manila_client
|
||||
from manilaclient import exceptions
|
||||
|
||||
exceptions = importutils.try_import(
|
||||
'manilaclient.openstack.common.apiclient.exceptions')
|
||||
manila_client = importutils.try_import('manilaclient.v1.client')
|
||||
MANILACLIENT_VERSION = "1"
|
||||
|
||||
|
||||
class ManilaClientPlugin(client_plugin.ClientPlugin):
|
||||
|
@ -36,7 +34,7 @@ class ManilaClientPlugin(client_plugin.ClientPlugin):
|
|||
'input_auth_token': self.auth_token
|
||||
}
|
||||
|
||||
client = manila_client.Client(**args)
|
||||
client = manila_client.Client(MANILACLIENT_VERSION, **args)
|
||||
return client
|
||||
|
||||
def is_not_found(self, ex):
|
||||
|
|
|
@ -11,18 +11,12 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from oslo_utils import importutils
|
||||
import testtools
|
||||
|
||||
from heat.tests import common
|
||||
from heat.tests import utils
|
||||
|
||||
manila_client = importutils.try_import('manilaclient.v1.client')
|
||||
|
||||
|
||||
class ManilaClientPluginTests(common.HeatTestCase):
|
||||
|
||||
@testtools.skipIf(manila_client is None, 'Tests the manila client')
|
||||
def test_create(self):
|
||||
context = utils.dummy_context()
|
||||
plugin = context.clients.client_plugin('manila')
|
||||
|
|
|
@ -12,9 +12,7 @@
|
|||
# under the License.
|
||||
|
||||
import mock
|
||||
from oslo_utils import importutils
|
||||
import six
|
||||
import testtools
|
||||
|
||||
from heat.common import exception
|
||||
from heat.common import template_format
|
||||
|
@ -22,13 +20,10 @@ from heat.engine import resource
|
|||
from heat.engine import resources
|
||||
from heat.engine.resources.openstack.manila import security_service
|
||||
from heat.engine import scheduler
|
||||
from heat.engine import stack as stack_parser
|
||||
from heat.engine import template
|
||||
from heat.tests import common
|
||||
from heat.tests import utils
|
||||
|
||||
manila_client = importutils.try_import('manilaclient.v1.client')
|
||||
|
||||
stack_template = '''
|
||||
heat_template_version: 2013-05-23
|
||||
|
||||
|
@ -174,10 +169,3 @@ class ManilaSecurityServiceTest(common.HeatTestCase):
|
|||
scheduler.TaskRunner(ss.update, new_ss))
|
||||
msg = 'The Resource security_service requires replacement.'
|
||||
self.assertEqual(msg, six.text_type(err))
|
||||
|
||||
@testtools.skipIf(manila_client is not None,
|
||||
'Tests manila client not installed')
|
||||
def test_no_client(self):
|
||||
tmpl = template.Template((template_format.parse(stack_template)))
|
||||
stack = stack_parser.Stack(utils.dummy_context(), 'foo', tmpl)
|
||||
self.assertRaises(exception.ResourceTypeNotFound, stack.validate)
|
||||
|
|
|
@ -14,8 +14,6 @@
|
|||
import copy
|
||||
|
||||
import mock
|
||||
from oslo_utils import importutils
|
||||
import testtools
|
||||
|
||||
from heat.common import exception
|
||||
from heat.common import template_format
|
||||
|
@ -23,13 +21,9 @@ from heat.engine import resources
|
|||
from heat.engine.resources.openstack.manila import share_type as mshare_type
|
||||
from heat.engine import rsrc_defn
|
||||
from heat.engine import scheduler
|
||||
from heat.engine import stack as stack_parser
|
||||
from heat.engine import template
|
||||
from heat.tests import common
|
||||
from heat.tests import utils
|
||||
|
||||
manila_client = importutils.try_import('manilaclient.v1.client')
|
||||
|
||||
manila_template = """
|
||||
heat_template_version: 2013-05-23
|
||||
resources:
|
||||
|
@ -118,10 +112,3 @@ class ManilaShareTypeTest(common.HeatTestCase):
|
|||
fake_share_type.unset_keys.assert_called_once_with({"test": "test"})
|
||||
fake_share_type.set_keys.assert_called_with(
|
||||
updated_props[mshare_type.ManilaShareType.EXTRA_SPECS])
|
||||
|
||||
@testtools.skipIf(manila_client is not None,
|
||||
'Tests manila client not installed')
|
||||
def test_no_client(self):
|
||||
tmpl = template.Template((template_format.parse(manila_template)))
|
||||
stack = stack_parser.Stack(utils.dummy_context(), 'foo', tmpl)
|
||||
self.assertRaises(exception.ResourceTypeNotFound, stack.validate)
|
||||
|
|
|
@ -35,6 +35,7 @@ python-cinderclient>=1.2.1
|
|||
python-glanceclient>=0.17.1
|
||||
python-heatclient>=0.3.0
|
||||
python-keystoneclient>=1.6.0
|
||||
python-manilaclient>=1.0.4
|
||||
python-neutronclient>=2.3.11,<3
|
||||
python-novaclient>=2.22.0
|
||||
python-saharaclient>=0.9.0
|
||||
|
|
Loading…
Reference in New Issue