def ensure_dbms_is_running(self, options, properties, scmStatus=None): """ :param scmStatus : SvcStatusCallback :rtype : None """ db_host_components = self.database_host.split("\\") if len(db_host_components) == 1: db_machine = self.database_host sql_svc_name = "MSSQLServer" else: db_machine = db_host_components[0] sql_svc_name = "MSSQL$" + db_host_components[1] if db_machine == "localhost" or db_machine.lower() == os.getenv("COMPUTERNAME").lower() or \ db_machine.lower() == socket.getfqdn().lower(): #TODO: Configure the SQL Server service name in ambari.properties ret = WinServiceController.EnsureServiceIsStarted(sql_svc_name) if 0 != ret: raise FatalException(-1, "Error starting SQL Server: " + string(ret)) if scmStatus is not None: scmStatus.reportStartPending() ret = WinServiceController.EnsureServiceIsStarted("SQLBrowser") #The SQL Server JDBC driver needs this one if 0 != ret: raise FatalException(-1, "Error starting SQL Server Browser: " + string(ret)) pass
def ensure_hdp_service_soft_dependencies(): ret = WinServiceController.EnsureServiceIsStarted( EMBEDDED_HBASE_MASTER_SERVICE) if ret != 0: err = 'ERROR: Cannot start service "{0}". Error = {1}'.format( EMBEDDED_HBASE_MASTER_SERVICE, ret) raise FatalException(1, err)
def run_command(self): from ambari_commons.os_windows import run_powershell_script, CHECK_FIREWALL_SCRIPT, WinServiceController, SERVICE_STATUS_RUNNING if WinServiceController.QueryStatus(self.FIREWALL_SERVICE_NAME) != SERVICE_STATUS_RUNNING: self.returncode = 0 self.stdoutdata = "" self.stderrdata = "" else: retcode, out, err = run_powershell_script(CHECK_FIREWALL_SCRIPT) self.returncode = retcode self.stdoutdata = out self.stderrdata = err
def ensure_hdp_service_soft_dependencies(): if SERVICE_STATUS_RUNNING != WinServiceController.QueryStatus( EMBEDDED_HBASE_MASTER_SERVICE): err = 'ERROR: Service "{0}" was not started.'.format( EMBEDDED_HBASE_MASTER_SERVICE) raise FatalException(1, err)
def ensure_time_service_is_started(): ret = WinServiceController.EnsureServiceIsStarted("W32Time") if 0 != ret: raise FatalException( -1, "Error starting Windows Time service: " + str(ret)) pass
def status(self): svcStatus = WinServiceController.QueryStatus( self.resource.service_name) if svcStatus == win32service.SERVICE_RUNNING: return True return False
def action_stop(self): (ret, msg) = WinServiceController.Stop(self.resource.service_name, 5) if 0 != ret: raise Fail(msg)
def action_stop(self): WinServiceController.Stop(self.resource.service_name, 5)