Merge "Add error handler to os-refresh-config"

This commit is contained in:
Jenkins 2014-04-29 20:24:01 +00:00 committed by Gerrit Code Review
commit cb092f8f27
2 changed files with 12 additions and 4 deletions

View File

@ -9,6 +9,7 @@ pre-defined set of directories::
/opt/stack/os-config-refresh/configure.d
/opt/stack/os-config-refresh/post-configure.d
/opt/stack/os-config-refresh/migration.d
/opt/stack/os-config-refresh/error.d
`/opt/stack/os-config-refresh` is the default base directory. You can
set `OS_REFRESH_CONFIG_BASE_DIR` environment variable to override the
@ -21,10 +22,10 @@ Its intended purpose is to separate scripts execution into 4 phases:
3. Activate(post-configure.d).
4. Migrate(migration.d),
It runs through all the phases above to ensure configuration is
applied and enabled on a machine. It will exit with an error if any
phase has a problem. The scripts in each phase should not depend on
each other having worked properly.
It runs through all the phases above to ensure configuration is applied
and enabled on a machine. It will run the scripts in error.d and then
exit with a non-zero exit status if any phase has a problem. The scripts
in each phase should not depend on each other having worked properly.
Note: Earlier versions of os-refresh-config ran migration before
post-configure. This was an oversight in the initial design, as

View File

@ -91,6 +91,13 @@ def main(argv=sys.argv):
log.info('Completed phase %s' % phase)
except subprocess.CalledProcessError as e:
log.error("during %s phase. [%s]\n" % (phase, e))
error_dir = os.path.join(BASE_DIR, 'error.d')
if os.path.exists(error_dir):
log.info('Calling error handlers.')
try:
subprocess.call(['dib-run-parts', error_dir])
except OSError:
pass
log.error("Aborting...")
return 1
else: