示例#1
0
文件: cfn.py 项目: swipswaps/builder
def cmd(stackname, command=None, username=DEPLOY_USER, clean_output=False, concurrency=None, node=None):
    if command is None:
        utils.errcho("Please specify a command e.g. ./bldr cmd:%s,ls" % stackname)
        exit(1)
    LOG.info("Connecting to: %s", stackname)

    instances = _check_want_to_be_running(stackname)
    if not instances:
        return

    # take out the load of crap that Fabric prints mangling the useful output
    # of a remote command
    custom_settings = {}
    if clean_output:
        custom_settings['fabric.state.output'] = {
            'status': False,
            'running': False
        }
        custom_settings['output_prefix'] = False

    try:
        with settings(**custom_settings):
            return stack_all_ec2_nodes(
                stackname,
                (remote, {'command': command}),
                username=username,
                abort_on_prompts=True,
                concurrency=concurrency_for(stackname, concurrency),
                node=int(node) if node else None
            )
    except CommandException as e:
        LOG.error(e)
        exit(2)
示例#2
0
def create_ami(stackname, name=None):
    pname = core.project_name_from_stackname(stackname)
    msg = "this will create a new AMI for the project %r" % pname
    confirm(msg)

    amiid = bakery.create_ami(stackname, name)
    print(amiid)
    errcho('update project file with new ami %s. these changes must be merged and committed manually' % amiid)
示例#3
0
文件: tasks.py 项目: muzyk10/builder
def create_ami(stackname, name=None):
    pname = core.project_name_from_stackname(stackname)
    msg = "this will create a new AMI for the project %r" % pname
    confirm(msg)

    amiid = bakery.create_ami(stackname, name)
    print(amiid)
    errcho('update project file with new ami %s. these changes must be merged and committed manually' % amiid)
示例#4
0
 def test_errcho(self, stderr):
     self.assertEqual(
         'Hello, world',
         utils.errcho('Hello, world')
     )
     self.assertEqual(
         [call('Hello, world'), call('\n')],
         stderr.write.call_args_list
     )
     stderr.flush.assert_called_with()
 def test_errcho(self, stderr):
     self.assertEqual(
         'Hello, world',
         utils.errcho('Hello, world')
     )
     self.assertEqual(
         [call('Hello, world'), call('\n')],
         stderr.write.call_args_list
     )
     stderr.flush.assert_called_with()