def _run_script(agent, script_url, timeout): params = _build_install_script_params(agent, script_url) try: _send_task(agent, params, timeout) finally: cleanup_scripts()
def _run_script(agent, script_url, timeout, new_agent_connection=None): params = _build_install_script_params( agent, script_url, new_agent_connection=new_agent_connection) try: _send_task(agent, params, timeout) finally: cleanup_scripts()
def stop(cloudify_agent, installer, **_): """ Only called in "remote" mode - other modes stop via AMQP """ ctx.logger.info('Stopping Agent {0}'.format(cloudify_agent['name'])) installer.stop_agent() script.cleanup_scripts()
def _run_script(agent, script_url, timeout): params = _build_install_script_params(agent, script_url) try: _send_task(agent, params, timeout) finally: cleanup_scripts()
def start(cloudify_agent, **_): """ Only called in "init_script"/"plugin" mode, where the agent is started externally (e.g. userdata script), and all we have to do is wait for it """ update_agent_record(cloudify_agent, AgentState.STARTING) tenant = cloudify_utils.get_tenant() client = get_client( amqp_user=tenant['rabbitmq_username'], amqp_pass=tenant['rabbitmq_password'], amqp_vhost=tenant['rabbitmq_vhost'] ) agent_alive = utils.is_agent_alive(cloudify_agent['queue'], client) if not agent_alive: if ctx.operation.retry_number > 3: ctx.logger.warning('Waiting too long for Agent to start') update_agent_record(cloudify_agent, AgentState.NONRESPONSIVE) return ctx.operation.retry( message='Waiting for Agent to start...') ctx.logger.info('Agent has started') update_agent_record(cloudify_agent, AgentState.STARTED) if not cloudify_agent.is_provided: script.cleanup_scripts()
def stop(cloudify_agent, installer, **_): """ Only called in "remote" mode - other modes stop via AMQP """ ctx.logger.info('Stopping Agent {0}'.format(cloudify_agent['name'])) update_agent_record(cloudify_agent, AgentState.STOPPING) installer.stop_agent() update_agent_record(cloudify_agent, AgentState.STOPPED) script.cleanup_scripts()
def stop(cloudify_agent, installer, **_): """ Only called in "remote" mode - other modes stop via AMQP """ ctx.logger.info('Stopping Agent {0}'.format(cloudify_agent['name'])) update_agent_record(cloudify_agent, AgentState.STOPPING) installer.stop_agent() update_agent_record(cloudify_agent, AgentState.STOPPED) script.cleanup_scripts()
def start(cloudify_agent, **_): """ Only called in "init_script"/"plugin" mode, where the agent is started externally (e.g. userdata script), and all we have to do is wait for it """ celery_client = get_celery_app(tenant=cloudify_agent['rest_tenant'], target=cloudify_agent['queue']) registered = utils.get_agent_registered(cloudify_agent['name'], celery_client) if not registered: return ctx.operation.retry(message='Waiting for Agent to start...') ctx.logger.info('Agent has started') if not cloudify_agent.is_provided: script.cleanup_scripts()
def _run_install_script(old_agent, timeout): old_agent = copy.deepcopy(old_agent) if 'version' not in old_agent: # Assuming that if there is no version info in the agent then # this agent was installed by current manager. old_agent['version'] = str(_get_manager_version()) new_agent = create_new_agent_config(old_agent) with _celery_app(old_agent) as celery_app: _assert_agent_alive(old_agent['name'], celery_app, old_agent['version']) script_path, script_url = _get_init_script_path_and_url( new_agent, old_agent['version']) params = _build_install_script_params(old_agent, script_url) _execute_install_script_task(celery_app, params, old_agent, timeout, script_path) cleanup_scripts() created_agent = _validate_created_agent(new_agent) return {'old': old_agent, 'new': created_agent}
def start(cloudify_agent, **_): """ Only called in "init_script"/"plugin" mode, where the agent is started externally (e.g. userdata script), and all we have to do is wait for it """ tenant = cloudify_utils.get_tenant() client = get_client( amqp_user=tenant['rabbitmq_username'], amqp_pass=tenant['rabbitmq_password'], amqp_vhost=tenant['rabbitmq_vhost'] ) agent_alive = utils.is_agent_alive(cloudify_agent['queue'], client) if not agent_alive: return ctx.operation.retry( message='Waiting for Agent to start...') ctx.logger.info('Agent has started') if not cloudify_agent.is_provided: script.cleanup_scripts()
def start(cloudify_agent, **_): """ Only called in "init_script"/"plugin" mode, where the agent is started externally (e.g. userdata script), and all we have to do is wait for it """ update_agent_record(cloudify_agent, AgentState.STARTING) tenant = cloudify_utils.get_tenant() client = get_client(amqp_user=tenant['rabbitmq_username'], amqp_pass=tenant['rabbitmq_password'], amqp_vhost=tenant['rabbitmq_vhost']) agent_alive = utils.is_agent_alive(cloudify_agent['queue'], client) if not agent_alive: if ctx.operation.retry_number > 3: ctx.logger.warning('Waiting too long for Agent to start') update_agent_record(cloudify_agent, AgentState.NONRESPONSIVE) return ctx.operation.retry(message='Waiting for Agent to start...') ctx.logger.info('Agent has started') update_agent_record(cloudify_agent, AgentState.STARTED) if not cloudify_agent.is_provided: script.cleanup_scripts()