def update(master_stackname=None): "same as `cfn.update` but also removes any orphaned minion keys" master_stackname = master_stackname or core.find_master(utils.find_region()) bootstrap.update_stack(master_stackname, service_list=[ 'ec2' # master-server should be a self-contained EC2 instance ]) bootstrap.remove_all_orphaned_keys(master_stackname)
def server_access(): """returns True if this builder instance has access to the master server. access may be available through presence of the master-server's bootstrap user's identify file OR current user is in master server's allowed_keys list""" stackname = core.find_master(core.find_region()) public_ip = core.stack_data(stackname, ensure_single_instance=True)[0]['PublicIpAddress'] result = local('ssh -o "StrictHostKeyChecking no" %s@%s "exit"' % (config.BOOTSTRAP_USER, public_ip)) return result.return_code == 0
def server_access(): """returns True if this builder instance has access to the master server. access may be available through presence of the master-server's bootstrap user's identify file OR current user is in master server's allowed_keys list""" stackname = core.find_master(core.find_region()) public_ip = core.stack_data(stackname, ensure_single_instance=True)[0]['PublicIpAddress'] result = local('ssh -o "StrictHostKeyChecking no" %s@%s "exit"' % (config.BOOTSTRAP_USER, public_ip)) return result['succeeded']
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 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())): sudo("salt %(minions)s %(module)s %(cmd)s --timeout=30" % locals())
def update_salt_master(region=None): "convenience. update the version of Salt installed on the master-server." region = region or utils.find_region() current_master_stackname = core.find_master(region) return update_salt(current_master_stackname)
def update_salt_master(region=None): "update the version of Salt installed on the master-server." region = region or utils.find_region() current_master_stackname = core.find_master(region) return remaster(current_master_stackname, current_master_stackname)
def kick(): stackname = core.find_master(core.find_region()) with core.stack_conn(stackname, user=config.BOOTSTRAP_USER): bootstrap.run_script('kick-master.sh')
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 update_master(): return bootstrap.update_stack(core.find_master(aws.find_region()))