def _update_remote_bvars(stackname, buildvars): LOG.info('updating %r with new vars %r', stackname, buildvars) encoded = encode_bvars(buildvars) fid = core_utils.ymd(fmt='%Y%m%d%H%M%S') # make a backup remote_sudo( 'if [ -f /etc/build-vars.json.b64 ]; then cp /etc/build-vars.json.b64 /tmp/build-vars.json.b64.%s; fi;' % fid) upload(StringIO(encoded), "/etc/build-vars.json.b64", use_sudo=True) LOG.info("%r updated. backup written to /tmp/build-vars.json.b64.%s", stackname, fid)
def _update_remote_bvars(stackname, buildvars): LOG.info('updating %r with new vars %r', stackname, buildvars) # not all projects have a 'revision' #ensure(core_utils.hasallkeys(buildvars, ['revision']), "buildvars missing key 'revision'") encoded = encode_bvars(buildvars) fid = core_utils.ymd(fmt='%Y%m%d%H%M%S') # make a backup remote_sudo('if [ -f /etc/build-vars.json.b64 ]; then cp /etc/build-vars.json.b64 /tmp/build-vars.json.b64.%s; fi;' % fid) upload(StringIO(encoded), "/etc/build-vars.json.b64", use_sudo=True) LOG.info("%r updated", stackname)
def salt_master_cmd(cmd, module='cmd.run', minions=r'\*'): "runs the given command on all aws instances. given command must escape double quotes" with stack_conn(core.find_master(utils.find_region())): remote_sudo("salt %(minions)s %(module)s %(cmd)s --timeout=30" % locals())
def workerfn(): remote_sudo("rm -f /etc/salt/pki/minion/minion_master.pub")
def pillar(stackname): "returns the pillar data a minion is using" with stack_conn(stackname, username=BOOTSTRAP_USER): remote_sudo('salt-call pillar.items')
def work(): remote_sudo("rm -f /etc/salt/pki/minion/minion_master.pub" ) # destroy the old master key we have