Skip to content
This repository has been archived by the owner on Oct 13, 2023. It is now read-only.

Commit

Permalink
Fixing state save
Browse files Browse the repository at this point in the history
  • Loading branch information
adammhaile committed Feb 21, 2019
1 parent 3f3e54b commit 7e0357b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
4 changes: 0 additions & 4 deletions doozer
Original file line number Diff line number Diff line change
Expand Up @@ -1757,7 +1757,6 @@ def config_update_required(runtime, image_list):
def main():
try:
cli(obj={})
color_print(yaml.dump(CTX_GLOBAL.obj.state, default_flow_style=False), color='red')
except DoozerFatalError as ex:
# Allow capturing actual tool errors and print them
# nicely instead of a gross stack-trace.
Expand All @@ -1769,12 +1768,9 @@ def main():
CTX_GLOBAL.obj.state['status'] = state.STATE_FAIL
CTX_GLOBAL.obj.state['msg'] = ex.message

color_print(yaml.dump(CTX_GLOBAL.obj.state, default_flow_style=False), color='red')

sys.exit(1)
finally:
if CTX_GLOBAL and CTX_GLOBAL.obj and CTX_GLOBAL.obj.initialized:
color_print(yaml.dump(CTX_GLOBAL.obj.state, default_flow_style=False), color='red')
CTX_GLOBAL.obj.save_state()


Expand Down
6 changes: 4 additions & 2 deletions doozerlib/runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,6 @@ def __init__(self, **kwargs):
self.image_tree = {}
self.image_order = []

self.init_state()

def get_group_config(self):
# group.yml can contain a `vars` section which should be a
# single level dict containing keys to str.format(**dict) replace
Expand Down Expand Up @@ -228,6 +226,8 @@ def initialize(self, mode='images', clone_distgits=True,

self.initialize_logging()

self.init_state()

if no_group:
return # nothing past here should be run without a group

Expand Down Expand Up @@ -412,6 +412,8 @@ def add_child_branch(child, branch, level=1):
if clone_distgits:
self.clone_distgits()

self.initialized = True

def initialize_logging(self):

if self.initialized:
Expand Down

0 comments on commit 7e0357b

Please sign in to comment.