def do(self, workflow_dict): try: for source_host in workflow_dict['source_hosts']: future_host = source_host.future_host hosts_option = [(future_host, 'stop')] for host, option in hosts_option: LOG.info("{} td_agent on host {}".format(option, host)) cs_host_attr = CS_HostAttr.objects.get(host=host) script = test_bash_script_error() script += monit_script(option) script += td_agent_script(option) LOG.info(script) output = {} return_code = exec_remote_command(server=host.address, username=cs_host_attr.vm_user, password=cs_host_attr.vm_password, command=script, output=output) LOG.info(output) if return_code != 0: LOG.error("Error stopping td_agent") LOG.error(str(output)) return True except Exception: traceback = full_stack() workflow_dict['exceptions']['error_codes'].append(DBAAS_0020) workflow_dict['exceptions']['traceback'].append(traceback) return False
def do(self): LOG.info("Start monit on host {}".format(self.host)) script = test_bash_script_error() action = 'start' script += monit_script(action) LOG.info(script) output = {} return_code = exec_remote_command_host(self.host, script, output) LOG.info(output) if return_code != 0: LOG.error("Error starting monit") LOG.error(str(output))
def do(self): LOG.info("Start monit on host {}".format(self.host)) script = test_bash_script_error() action = 'start' script += monit_script(action) LOG.info(script) output = {} return_code = exec_remote_command_host(self.host, script, output) LOG.info(output) if return_code != 0: LOG.error("Error starting monit") LOG.error(str(output))
def do(self, workflow_dict): try: option = 'start' for host in workflow_dict['hosts']: LOG.info("{} monit on host {}".format(option, host)) script = test_bash_script_error() script += monit_script(option) LOG.info(script) output = {} return_code = exec_remote_command_host(host, script, output) LOG.info(output) if return_code != 0: LOG.error("Error monit") LOG.error(str(output)) return True except Exception: traceback = full_stack() workflow_dict['exceptions']['error_codes'].append(DBAAS_0002) workflow_dict['exceptions']['traceback'].append(traceback) return False