def _fix_single_ec2_node(stackname): LOG.info("checking build vars on node %s", current_node_id()) try: buildvars = _retrieve_build_vars() LOG.info("valid bvars found, no fix necessary: %s", buildvars) except AssertionError: LOG.info("invalid build vars found, regenerating from context") context = load_context(stackname) # some contexts are missing stackname context['stackname'] = stackname node_id = current_node_id() new_vars = trop.build_vars(context, node_id) _update_remote_bvars(stackname, new_vars)
def _refresh_buildvars(): old_buildvars = _retrieve_build_vars() node = old_buildvars.get('node') if not node or not str(node).isdigit(): # (very) old buildvars. try parsing 'nodename' nodename = old_buildvars.get('nodename') if nodename: # ll: "elife-dashboard--prod--1" node = nodename.split('--')[-1] if not node.isdigit(): LOG.warning("nodename ends in a non-digit node: %s", nodename) node = None if not node: # no 'node' and no (valid) 'nodename' present # assume this stack was created before nodes were a thing # and that there is only 1 in the 'cluster'. node = 1 new_buildvars = trop.build_vars(context, int(node)) new_buildvars['revision'] = old_buildvars.get('revision') # TODO: is this still necessary? _update_remote_bvars(stackname, new_buildvars)