Update the constraint value of schema 'ACCESS_TYPE' for Manila share

Update the constaint value to make it up to date. Manila support 4
kinds of access types wich are 'ip', 'user', 'cert', 'cephx', and,
'cephx' is the newer type in Manila which is supported on version '2.13'.
So update the version of Manila client to '2' incidentally.

Change-Id: I230f2bc7268e9f25f77d7b22f7a68b6ca37f6d2a
Closes-Bug: #1649217
This commit is contained in:
zengchen 2016-12-12 19:29:51 +08:00
parent c38f68e745
commit c669955b81
3 changed files with 12 additions and 2 deletions

View File

@ -17,7 +17,7 @@ from heat.engine import constraints
from manilaclient import client as manila_client
from manilaclient import exceptions
MANILACLIENT_VERSION = "1"
MANILACLIENT_VERSION = "2"
CLIENT_NAME = 'manila'

View File

@ -139,7 +139,7 @@ class ManilaShare(resource.Resource):
properties.Schema.STRING,
_('Type of access that should be provided to guest.'),
constraints=[constraints.AllowedValues(
['ip', 'domain'])],
['ip', 'user', 'cert', 'cephx'])],
required=True
),
ACCESS_LEVEL: properties.Schema(

View File

@ -223,3 +223,13 @@ class ManilaShareTest(common.HeatTestCase):
self.assertEqual('ca', share.FnGetAtt('created_at'))
self.assertEqual('s', share.FnGetAtt('status'))
self.assertEqual('p_id', share.FnGetAtt('project_id'))
def test_allowed_access_type(self):
tmp = template_format.parse(manila_template)
properties = tmp['resources']['test_share']['properties']
properties['access_rules'][0]['access_type'] = 'domain'
stack = utils.parse_stack(tmp, stack_name='access_type')
self.assertRaisesRegexp(
exception.StackValidationFailed,
".* \"domain\" is not an allowed value \[ip, user, cert, cephx\]",
stack.validate)