ozwillo: use NamedTemporaryFile for the recipe file (#18785)

This commit is contained in:
Benjamin Dauvergne 2017-09-19 15:06:01 +02:00
parent 30bbc4e0f7
commit 84e96dc891
1 changed files with 5 additions and 8 deletions

View File

@ -143,13 +143,12 @@ def ozwillo_deploy_thread(data):
domain = var['combo']
domain_agent = var['combo_agent']
domain_passerelle = var['passerelle']
recipe_file_handle, recipe_file_path = tempfile.mkstemp()
json.dump(template_recipe, open(recipe_file_path, 'w'))
logger.debug(u'ozwillo: cooking %s', template_recipe)
call_command('cook', recipe_file_path, timeout=1000, verbosity=0)
with tempfile.NamedTemporaryFile() as recipe_file:
json.dump(template_recipe, recipe_file)
recipe_file.flush()
call_command('cook', recipe_file.name, timeout=1000, verbosity=0)
# Load user portal template
logger.debug(u'ozwillo: loading combo template')
@ -205,8 +204,6 @@ def ozwillo_deploy_thread(data):
'--import-user', '-d', domain_passerelle
])
os.remove(recipe_file_path)
# Sending done event to Ozwillo
services = {
'services': [{