示例#1
0
def install_blueprint_plugins(blueprint_path):

    requirements = create_requirements(
        blueprint_path=blueprint_path
    )

    if requirements:
        # validate we are inside a virtual env
        if not utils.is_virtual_env():
            raise exceptions.CloudifyCliError(
                'You must be running inside a '
                'virtualenv to install blueprint plugins')

        runner = LocalCommandRunner(get_logger())
        # dump the requirements to a file
        # and let pip install it.
        # this will utilize pip's mechanism
        # of cleanup in case an installation fails.
        tmp_path = tempfile.mkstemp(suffix='.txt', prefix='requirements_')[1]
        utils.dump_to_file(collection=requirements, file_path=tmp_path)
        command_parts = [sys.executable, '-m', 'pip', 'install', '-r',
                         tmp_path]
        runner.run(command=' '.join(command_parts), stdout_pipe=False)
    else:
        get_logger().debug('There are no plugins to install')
示例#2
0
def install_blueprint_plugins(blueprint_path):

    requirements = create_requirements(
        blueprint_path=blueprint_path
    )

    if requirements:
        # validate we are inside a virtual env
        if not utils.is_virtual_env():
            raise exceptions.CloudifyCliError(
                'You must be running inside a '
                'virtualenv to install blueprint plugins')

        runner = LocalCommandRunner(get_logger())
        # dump the requirements to a file
        # and let pip install it.
        # this will utilize pip's mechanism
        # of cleanup in case an installation fails.
        output = tempfile.NamedTemporaryFile(mode='w',
                                             delete=True,
                                             suffix='.txt',
                                             prefix='requirements_')
        utils.dump_to_file(collection=requirements,
                           file_path=output.name)
        runner.run(command='pip install -r {0}'.format(output.name),
                   stdout_pipe=False)
    else:
        get_logger().debug('There are no plugins to install..')
示例#3
0
def install_blueprint_plugins(blueprint_path):

    requirements = create_requirements(
        blueprint_path=blueprint_path
    )

    # validate we are inside a virtual env
    if not utils.is_virtual_env():
        raise exceptions.CloudifyCliError(
            'You must be running inside a '
            'virtualenv to install blueprint plugins')

    runner = LocalCommandRunner(get_logger())

    # dump the requirements to a file
    # and let pip install it.
    # this will utilize pip's mechanism
    # of cleanup in case an installation fails.
    output = tempfile.NamedTemporaryFile(mode='w',
                                         delete=True,
                                         suffix='.txt',
                                         prefix='requirements_')
    utils.dump_to_file(collection=requirements,
                       file_path=output.name)
    runner.run(command='pip install -r {0}'.format(output.name),
               stdout_pipe=False)
示例#4
0
def create_requirements(blueprint_path, output):
    logger = get_logger()
    if output and os.path.exists(output):
        raise exceptions.CloudifyCliError(
            'output path already exists : {0}'.format(output))

    requirements = common.create_requirements(blueprint_path=blueprint_path)

    if output:
        utils.dump_to_file(requirements, output)
        logger.info('Requirements created successfully --> {0}'.format(output))
    else:
        # we don't want to use just lgr
        # since we want this output to be prefix free.
        # this will make it possible to pipe the
        # output directly to pip
        for requirement in requirements:
            print(requirement)
            logger.info(requirement)
示例#5
0
def create_requirements(blueprint_path, output):
    logger = get_logger()
    if output and os.path.exists(output):
        raise exceptions.CloudifyCliError('output path already exists : {0}'
                                          .format(output))

    requirements = common.create_requirements(
        blueprint_path=blueprint_path
    )

    if output:
        utils.dump_to_file(requirements, output)
        logger.info('Requirements created successfully --> {0}'
                    .format(output))
    else:
        # we don't want to use just lgr
        # since we want this output to be prefix free.
        # this will make it possible to pipe the
        # output directly to pip
        for requirement in requirements:
            print(requirement)
            logger.info(requirement)
示例#6
0
def install_blueprint_plugins(blueprint_path):

    requirements = create_requirements(blueprint_path=blueprint_path)

    if requirements:
        # validate we are inside a virtual env
        if not utils.is_virtual_env():
            raise exceptions.CloudifyCliError(
                'You must be running inside a '
                'virtualenv to install blueprint plugins')

        runner = LocalCommandRunner(get_logger())
        # dump the requirements to a file
        # and let pip install it.
        # this will utilize pip's mechanism
        # of cleanup in case an installation fails.
        tmp_path = tempfile.mkstemp(suffix='.txt', prefix='requirements_')[1]
        utils.dump_to_file(collection=requirements, file_path=tmp_path)
        runner.run(command='pip install -r {0}'.format(tmp_path),
                   stdout_pipe=False)
    else:
        get_logger().debug('There are no plugins to install..')