コード例 #1
0
 def create(self, options_string):
     command = [
         'docker-machine create',
         options_string
     ]
     res = execute(' '.join(command))
     l.INFO('Command Exited with result: %s'%(res))
コード例 #2
0
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)
コード例 #3
0
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)
コード例 #4
0
    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))
コード例 #5
0
def describe(name, pretty):
    descriptor = aws.AWS().get_instance_ip_descs(name)
    if pretty:
        l.INFO(pretty_json(descriptor))
    else:
        print descriptor
コード例 #6
0
def set_configuration(cfg_file):
    l.INFO('With Configuration file: %s' % (cfg_file))
    CONFIG.read_config(cfg_file)