Added function to clean deployment description

Change-Id: I969361b7a13f57db72ad08f68d98b2730fd0840b
This commit is contained in:
Serg Melikyan 2013-08-22 17:26:00 +04:00
parent 987c610ac5
commit c8443af298
2 changed files with 8 additions and 4 deletions

View File

@ -16,6 +16,7 @@ from collections import namedtuple
from muranoapi.common import config
from muranoapi.db.models import Session, Environment, Deployment, Status
from muranoapi.db.session import get_session
from muranocommon.helpers.token_sanitizer import TokenSanitizer
from muranocommon.messaging import MqClient, Message
@ -26,6 +27,11 @@ SessionState = namedtuple('SessionState', ['open', 'deploying', 'deployed'])(
)
def secure_description(description):
sanitizer = TokenSanitizer()
return sanitizer.sanitize(description)
class SessionServices(object):
@staticmethod
def get_sessions(environment_id, state=None):
@ -125,9 +131,7 @@ class SessionServices(object):
session.state = SessionState.deploying
deployment = Deployment()
deployment.environment_id = environment['id']
deployment.description = dict(session.description)
if 'token' in deployment.description:
del deployment.description['token']
deployment.description = secure_description(dict(session.description))
status = Status()
status.text = "Deployment scheduled"
status.level = "info"

View File

@ -31,4 +31,4 @@ passlib
jsonschema==2.0.0
python-keystoneclient>=0.2.0
oslo.config
http://github.com/sergmelikyan/murano-common/releases/download/0.2.1/muranocommon-0.2.1.tar.gz#egg=muranocommon-0.2.1
http://tarballs.openstack.org/murano-common/murano-common-release-0.2.tar.gz#egg=muranocommon-dev