Пример #1
0
def script(port=1985, verbose=False):
    '''
    Connect the manager REST service to a local debugger server
    '''
    global logger
    logger = cosmo.logger

    # set colors for logger levels
    logger = _colorize_logger(logger, 'info', 'green', bold=True)
    logger = _colorize_logger(logger, 'warn', 'yellow', bold=True)
    logger = _colorize_logger(logger, 'error', 'red', bold=True)

    remote_path = '/tmp/pycharm-debug.egg'
    output_to_hide = [] if verbose else ['commands', 'status']

    with cosmo.ssh() as ssh, fabric_ctx.hide(*output_to_hide):
        logger.info(
            'Waiting for debugger server to start at port {}'.format(port))
        is_port_ready = _wait_for_port(port)
        if not is_port_ready:
            return

        if not fab_files.exists(remote_path):
            logger.info('Downloading PyCharm egg at remote manager')
            _download_pycharm_package(ssh, remote_path)

            logger.info(
                'Installing PyCharm package in remote manager virtualenv')
            _install_pycharm_package(ssh, remote_path)

        _connect_manager_to_debugger(ssh, port)

        logger.info(_silly_farewell())
Пример #2
0
def script(*args):
    """Run a celery command on the management worker"""
    with cosmo.ssh() as ssh:
        command = ('CELERY_WORK_DIR=/opt/mgmtworker/work '
                   '/opt/mgmtworker/env/bin/celery --config=cloudify.broker_config '
                   '{}'.format(' '.join(args)))
        ssh.sudo(command)
Пример #3
0
def script(port=1985, verbose=False):
    '''
    Connect the manager REST service to a local debugger server
    '''
    global logger
    logger = cosmo.logger

    # set colors for logger levels
    logger = _colorize_logger(logger, 'info', 'green', bold=True)
    logger = _colorize_logger(logger, 'warn', 'yellow', bold=True)
    logger = _colorize_logger(logger, 'error', 'red', bold=True)

    remote_path = '/tmp/pycharm-debug.egg'
    output_to_hide = [] if verbose else ['commands', 'status']

    with cosmo.ssh() as ssh, fabric_ctx.hide(*output_to_hide):
        logger.info('Waiting for debugger server to start at port {}'
                    .format(port))
        is_port_ready = _wait_for_port(port)
        if not is_port_ready:
            return

        if not fab_files.exists(remote_path):
                logger.info('Downloading PyCharm egg at remote manager')
                _download_pycharm_package(ssh, remote_path)

                logger.info(
                    'Installing PyCharm package in remote manager virtualenv')
                _install_pycharm_package(ssh, remote_path)

        _connect_manager_to_debugger(ssh, port)

        logger.info(_silly_farewell())
Пример #4
0
def script(*args):
    """Run a celery command on the management worker"""
    with cosmo.ssh() as ssh:
        command = (
            'CELERY_WORK_DIR=/opt/mgmtworker/work '
            '/opt/mgmtworker/env/bin/celery --config=cloudify.broker_config '
            '{}'.format(' '.join(args)))
        ssh.run(command)
Пример #5
0
 def _restart_service(self, service):
     with cosmo.ssh() as ssh:
         ssh.sudo('systemctl restart cloudify-{}'.format(service))
Пример #6
0
 def _restart_service(self, service):
     with cosmo.ssh() as ssh:
         ssh.sudo('systemctl restart cloudify-{}'.format(service))