コード例 #1
0
ファイル: cfn.py プロジェクト: elifesciences/builder
def launch(pname, instance_id=None, alt_config=None):
    stackname = generate_stack_from_input(pname, instance_id, alt_config)
    pdata = core.project_data_for_stackname(stackname)

    LOG.info('attempting to create %s (AWS region %s)', stackname,
             pdata['aws']['region'])

    if core.is_master_server_stack(stackname):
        checks.ensure_can_access_builder_private(pname)

    bootstrap.create_stack(stackname)

    LOG.info('updating stack %s', stackname)
    # TODO: highstate.sh (think it's run inside here) doesn't detect:
    # [34.234.95.137] out: [CRITICAL] The Salt Master has rejected this minion's public key!
    bootstrap.update_stack(stackname, service_list=['ec2', 'sqs', 's3'])
    setdefault('.active-stack', stackname)
コード例 #2
0
def deploy(pname, instance_id=None, branch='master', part_filter=None):
    pdata = project.project_data(pname)
    if not branch:
        branch_list = utils.git_remote_branches(pdata['repo'])
        branch_list = impose_ordering(branch_list)
        branch = utils._pick('branch', branch_list, deffile('.branch'))
    stackname = cfn.generate_stack_from_input(pname, instance_id)

    region = pdata['aws']['region']
    active_stacks = core.active_stack_names(region)
    if stackname in active_stacks:
        LOG.info("stack %r exists, skipping creation", stackname)
    else:
        LOG.info("stack %r doesn't exist, creating", stackname)
        more_context = cfngen.choose_config(stackname)
        more_context['branch'] = branch
        cfngen.generate_stack(pname, **more_context)

    bootstrap.create_update(stackname, part_filter)
    setdefault('.active-stack', stackname)
コード例 #3
0
ファイル: cfn.py プロジェクト: elifesciences/builder
def launch(pname, instance_id=None, alt_config=None):
    try:
        stackname = generate_stack_from_input(pname, instance_id, alt_config)
    except checks.StackAlreadyExistsProblem as e:
        LOG.info('stack %s already exists', e.stackname)
        return

    pdata = core.project_data_for_stackname(stackname)

    LOG.info('attempting to create %s (AWS region %s)', stackname, pdata['aws']['region'])

    if core.is_master_server_stack(stackname):
        checks.ensure_can_access_builder_private(pname)

    bootstrap.create_stack(stackname)

    LOG.info('updating stack %s', stackname)
    # TODO: highstate.sh (think it's run inside here) doesn't detect:
    # [34.234.95.137] out: [CRITICAL] The Salt Master has rejected this minion's public key!
    bootstrap.update_stack(stackname, service_list=['ec2', 'sqs', 's3'])
    setdefault('.active-stack', stackname)
コード例 #4
0
ファイル: cfn.py プロジェクト: stephenwf/builder
def launch(pname, instance_id=None):
    try:
        stackname = generate_stack_from_input(pname, instance_id)
        pdata = core.project_data_for_stackname(stackname)

        print 'attempting to create stack:'
        print '  stackname: ' + stackname
        print '  region:    ' + pdata['aws']['region']
        print

        if core.is_master_server_stack(stackname):
            if not checks.can_access_builder_private(pname):
                print "failed to access your organisation's 'builder-private' repository:"
                print '  ' + pdata['private-repo']
                print "you'll need access to this repository to add a deploy key later"
                print
                return

        bootstrap.create_update(stackname)
        setdefault('.active-stack', stackname)
    except core.NoMasterException as e:
        LOG.warn(e.message)
        print "\n%s\ntry `./bldr master.create`'" % e.message
コード例 #5
0
ファイル: cfn.py プロジェクト: elife-anonymous-user/builder
def launch(pname):
    try:
        stackname = create_stack(pname)
        pdata = core.project_data_for_stackname(stackname)

        print 'attempting to create stack:'
        print '  stackname: ' + stackname
        print '  region:    ' + pdata['aws']['region']
        print

        if core.is_master_server_stack(stackname):
            if not checks.can_access_builder_private(pname):
                print "failed to access your organisation's 'builder-private' repository:"
                print '  ' + pdata['private-repo']
                print "you'll need access to this repository to add a deploy key later"
                print
                return
        
        stackname = create_update(stackname)        
        if stackname:
            setdefault('.active-stack', stackname)
    except core.NoMasterException, e:
        LOG.warn(e.message)
        print "\n%s\ntry `./bldr master.create`'" % e.message
コード例 #6
0
 def test_setdefault(self):
     decorators.setdefault('.active-stack', 'lax--ci')
     with open('/tmp/.active-stack') as f:
         self.assertEqual(f.read(), 'lax--ci')
コード例 #7
0
 def test_setdefault(self):
     decorators.setdefault('.active-stack', 'lax--ci')
     with open('/tmp/.active-stack') as f:
         self.assertEqual(f.read(), 'lax--ci')
コード例 #8
0
ファイル: cfn.py プロジェクト: elifesciences/builder
def fix_bootstrap(stackname):
    """uploads the bootstrap script and re-runs the bootstrap process.
    Used when stack creation succeeds but the bootstrap script failed for some reason."""
    LOG.info('bootstrapping stack %s', stackname)
    bootstrap.update_stack(stackname)
    setdefault('.active-stack', stackname)