Fix EP building if app doesn't have files in template

Change-Id: Ie4148562db1521969729791a6198761f85f47c36
Closes-Bug: #1435331
This commit is contained in:
Dmytro Dovbii 2015-03-23 15:30:20 +02:00
parent 62c1f10e7b
commit 08feb98be6
3 changed files with 58 additions and 1 deletions

View File

@ -237,7 +237,7 @@ class Agent(murano_object.MuranoObject):
script['EntryPoint'] = self._place_file(
scripts_folder, script['EntryPoint'],
template, files, resources)
scripts_files = script['Files']
scripts_files = script.get('Files', [])
script['Files'] = []
for file in scripts_files:
file_id = self._place_file(scripts_folder, file,

View File

@ -0,0 +1,18 @@
FormatVersion: 2.0.0
Version: 1.0.0
Name: Deploy Tomcat
Parameters:
appName: $appName
Body: |
return deploy(args.appName).stdout
Scripts:
deploy:
Type: Application
Version: 1.0.0
EntryPoint: deployTomcat.sh
Options:
captureStdout: true
captureStderr: true

View File

@ -78,6 +78,13 @@ class TestExecutionPlan(base.MuranoTestCase):
template = self.agent.buildExecutionPlan(template, self.resources)
self.assertEqual(template, self._get_telnet_application())
def test_execution_plan_v2_app_without_files(self):
template = yamllib.load(
self._read('application_without_files.template'),
Loader=self.yaml_loader)
template = self.agent.buildExecutionPlan(template, self.resources)
self.assertEqual(template, self._get_app_without_files())
def _get_application(self):
return {
'Action': 'Execute',
@ -123,6 +130,38 @@ class TestExecutionPlan(base.MuranoTestCase):
'Version': '1.0.0'
}
def _get_app_without_files(self):
return {
'Action': 'Execute',
'Body': 'return deploy(args.appName).stdout\n',
'Files': {
self.uuids[1]: {
'Body': 'text',
'BodyType': 'Text',
'Name': 'deployTomcat.sh'
},
},
'FormatVersion': '2.0.0',
'ID': self.uuids[0],
'Name': 'Deploy Tomcat',
'Parameters': {
'appName': '$appName'
},
'Scripts': {
'deploy': {
'EntryPoint': self.uuids[1],
'Files': [],
'Options': {
'captureStderr': True,
'captureStdout': True
},
'Type': 'Application',
'Version': '1.0.0'
}
},
'Version': '1.0.0'
}
def _get_chef(self):
return {
'Action': 'Execute',