Fix service creation failure

Change-Id: I1c50b757e116ada289f0e35e1dc7a031b7529e48
This commit is contained in:
Ekaterina Fedorova 2013-08-13 11:53:17 +04:00
parent eb5a86baff
commit 0c10a89cc5
1 changed files with 7 additions and 17 deletions

View File

@ -21,7 +21,13 @@ from muranoclient.common import base
def normalize_path(f):
@wraps(f)
def f_normalize_path(*args, **kwargs):
args = list(args)
path = args[2] if len(args) >= 3 else kwargs['path']
#path formally is just absolute unix path
if not posixpath.isabs(path):
raise ValueError("Parameter 'path' should start with '/'")
# args = list(args)
if len(args) >= 3:
args[2] = args[2][1:]
else:
@ -32,18 +38,6 @@ def normalize_path(f):
return f_normalize_path
def verify_path(f):
@wraps(f)
def f_verify_path(*args, **kwargs):
path = args[2] if len(args) >= 3 else kwargs['path']
#path formally is just absolute unix path
if not posixpath.isabs(path):
raise ValueError("Parameter 'path' should start with '/'")
return f_verify_path
class Service(base.Resource):
def __repr__(self):
return '<Service %s>' % self._info
@ -55,7 +49,6 @@ class Service(base.Resource):
class ServiceManager(base.Manager):
resource_class = Service
@verify_path
@normalize_path
def get(self, environment_id, path, session_id=None):
if session_id:
@ -66,7 +59,6 @@ class ServiceManager(base.Manager):
return self._list('/environments/{0}/services/{1}'.
format(environment_id, path), headers=headers)
@verify_path
@normalize_path
def post(self, environment_id, path, data, session_id):
headers = {'X-Configuration-Session': session_id}
@ -75,7 +67,6 @@ class ServiceManager(base.Manager):
format(environment_id, path), data,
headers=headers)
@verify_path
@normalize_path
def put(self, environment_id, path, data, session_id):
headers = {'X-Configuration-Session': session_id}
@ -84,7 +75,6 @@ class ServiceManager(base.Manager):
format(environment_id, path), data,
headers=headers)
@verify_path
@normalize_path
def delete(self, environment_id, path, session_id):
headers = {'X-Configuration-Session': session_id}