public ScriptInstallationResults InstallScripts(GenericCredentialInfo credentialInfo) { var results = new ScriptInstallationResults(); try { //Context setup with admin credentials results.AppendMessage("Setting database context..."); this.administrationInstallationRepository.InstallPrimaryServerAdminScripts(credentialInfo); //Do a server refresh prior to deployment var currentServers = refreshServerService.GetServerList(); if (currentServers != null && currentServers.Any()) { refreshServerService.UpdateServerList(currentServers); } //Get an array of all SQL servers registered in Relativity results.AppendMessage("Retrieving server list..."); var servers = this.serverRepository.ReadAllActive() .Where(s => s.ServerType == ServerType.Database); foreach (var server in servers) { //Install any per-server scripts that need admin privileges results.AppendMessage($"Installing scripts on {server.ServerName}..."); var deploymentResult = databaseDeployer.DeployResource(server, credentialInfo); HandleDeploymentResponse(deploymentResult, results); results.AppendMessage($"Scripts installed on {server.ServerName}."); } results.AppendMessage("Finished installing per-server scripts."); //Update the configuration to indicate that administrative scripts have been installed results.AppendMessage("Updating script installation history..."); this.administrationInstallationRepository.UpdateAdminScriptsRun(); results.AppendMessage("Installation complete."); results.Success = true; } catch (Exception e) { results.AppendMessage($"Installation failed. {e}"); results.Success = false; } return(results); }
public bool Execute(ProcessControl processControl) { var currentServers = _refreshServerSvc.GetServerList(); _logger.LogInformation($"Total Server :{currentServers.Count}", "GetServerList"); if (currentServers != null && currentServers.Any()) { //update server list _refreshServerSvc.UpdateServerList(currentServers); //refresh server list since new list may include new servers added var latestServers = this.SqlRepo.PerformanceServerRepository.ReadAllActive(); _logger.LogInformation($"Total Server count after update: {latestServers.Count}", "GetServerList"); } else { Log("RunServerTask Called - CurrentServers is null!"); } return(true); }