Commit 840d68c8 authored by Łukasz Nowak's avatar Łukasz Nowak

Do not force promise.

Additionaly support slapos_update_promise
parent 23b84958
......@@ -104,10 +104,14 @@ def guessPlatform():
class Script:
"""Free script building system"""
def _checkPromise(self, location):
def _checkPromise(self, promise_key, location):
promise_text = self.options.get(promise_key)
if promise_text is None:
self.logger.warning('Promise %r not defined' % promise_key)
return True
promise_problem_list = []
a = promise_problem_list.append
for promise in self.options['slapos_promise'].split('\n'):
for promise in promise_text.split('\n'):
promise = promise.strip()
if not promise:
continue
......@@ -279,7 +283,7 @@ class Script:
env = self.getEnvironment()
exec self.options['script']
try:
self._checkPromise(self.options['location'])
self._checkPromise('slapos_promise', self.options['location'])
except Exception:
if os.path.exists(self.options['location']):
self.logger.info('Removing location %r because of error' %
......@@ -300,6 +304,11 @@ class Script:
try:
env = self.getEnvironment()
exec self.options['update_script']
try:
self._checkPromise('slapos_update_promise', self.options['location'])
except Exception:
self.logger.info('Keeping location %r during update' % self.options['location'])
raise
finally:
for d in self.cleanup_dir_list:
if os.path.exists(d):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment