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(aws.find_region())): sudo("salt %(minions)s %(module)s %(cmd)s --timeout=30" % locals())
def aws_update_many_projects(pname_list): minions = ' or '.join(map(lambda pname: pname + "-*", pname_list)) region = aws.find_region() with core.stack_conn(core.find_master(region)): sudo("salt -C '%s' state.highstate --retcode-passthrough" % minions)
def remaster_minions(): map(remaster_minion, core.active_stack_names(aws.find_region()))
def aws_stack_list(): "returns a list of realized stacks. does not include deleted stacks" region = aws.find_region() return core.active_stack_names(region)
def update_master(): return bootstrap.update_stack(core.find_master(aws.find_region()))