def create(self, options_string): command = [ 'docker-machine create', options_string ] res = execute(' '.join(command)) l.INFO('Command Exited with result: %s'%(res))
def takedown(instances): targeted_members = instances.split(',') if instances == 'all': targeted_members = [m['name'] for m in CONFIG.get_members()] for name in targeted_members: member_desc = CONFIG.get_member(name) l.INFO("Taking down %s" % (member_desc)) instance = aws_instances.AWSInstance(member_desc) try: instance.remove() except Exception as e: l.ERROR(e)
def bootstrap(instances, reset, steps): targeted_members = instances.split(',') if instances == 'all': targeted_members = sorted(CONFIG.get_members(), key=lambda k: k.get('priority', 0), reverse=True) targeted_members = [m['name'] for m in targeted_members] for name in targeted_members: member_desc = CONFIG.get_member(name) member_desc['reset'] = reset member_desc['steps'] = steps.split(',') l.INFO("Bootstraping %s" % (member_desc)) bootstrap_member(member_desc)
def build(self): # Note to self: # Instead of that: Instantiate new instance objects # and build them, this is ugly. for i in range(self.num_instances): name = self.name if self.num_instances != 1: name = self.name + '-' + str(i) if self.reset and self.exists(name): self.remove() if not self.exists(name): for step in self.steps: l.INFO("Performing: %s" %(step)) self.steps_dict[step](name) else: l.WARN("Host %s already exists, skipping" %(name))
def describe(name, pretty): descriptor = aws.AWS().get_instance_ip_descs(name) if pretty: l.INFO(pretty_json(descriptor)) else: print descriptor
def set_configuration(cfg_file): l.INFO('With Configuration file: %s' % (cfg_file)) CONFIG.read_config(cfg_file)