示例#1
0
 public ExecutableResult Execute(string value)
 {
     try
     {
         Statics.ShouldPollXenStore = false;
         _logger.Log(String.Format("Updater Update value: {0}\r\nWill resume in 60 seconds", value));
         _sleeper.Sleep(60);
         _connectionChecker.Check();
         var agentUpdateInfo = _agentUpdateMessageHandler.Handle(value);
         _downloader.Download(agentUpdateInfo.url, Constants.UpdaterReleasePackage);
         _checksumValidator.Validate(agentUpdateInfo.signature, Constants.UpdaterReleasePackage);
         _unzipper.Unzip(Constants.UpdaterReleasePackage, Constants.UpdaterUnzipPath, "");
         _serviceStopper.Stop("RackspaceCloudServersAgentUpdater");
         _fileCopier.CopyFiles(Constants.UpdaterUnzipPath, Constants.UpdaterPath, _logger);
         _serviceStarter.Start("RackspaceCloudServersAgentUpdater");
         Statics.ShouldPollXenStore = true;
         return(new ExecutableResult());
     }
     catch (Exception ex)
     {
         _logger.Log(String.Format("Exception was : {0}\nStackTrace Was: {1}", ex.Message, ex.StackTrace));
         return(new ExecutableResult {
             Error = new List <string> {
                 "Update failed"
             }, ExitCode = "1"
         });
     }
     finally
     {
         _finalizer.Finalize(new List <string> {
             Constants.UpdaterUnzipPath, Constants.UpdaterReleasePackage
         });
     }
 }
示例#2
0
 public ExecutableResult Execute(string value)
 {
     try
     {
         Statics.ShouldPollXenStore = false;
         _logger.Log(String.Format("XenTools Update value: {0}\r\nWill resume in 60 seconds", value));
         _sleeper.Sleep(60);
         var agentUpdateInfo = _agentUpdateMessageHandler.Handle(value);
         _downloader.Download(agentUpdateInfo.url, Constants.XenToolsReleasePackage);
         _checksumValidator.Validate(agentUpdateInfo.signature, Constants.XenToolsReleasePackage);
         _unzipper.Unzip(Constants.XenToolsReleasePackage, Constants.XenToolsUnzipPath, "");
         _installer.Install(new Dictionary <string, string>
         {
             { Constants.XenToolsSetupExecutablePath,
               String.Format("/S /norestart /D={0}", Constants.XenToolsPath) }
         });
         _serviceRestarter.Restart("xensvc");
         if (_serviceRestarter.ServiceExists("XenServerVssProvider"))
         {
             _serviceRestarter.Restart("XenServerVssProvider");
         }
         return(new ExecutableResult());
     }
     catch (Exception ex)
     {
         _logger.Log(String.Format("Exception was : {0}\nStackTrace Was: {1}", ex.Message, ex.StackTrace));
         return(new ExecutableResult {
             Error = new List <string> {
                 "Update failed"
             }, ExitCode = "1"
         });
     }
     finally
     {
         Statics.ShouldPollXenStore = true;
         _finalizer.Finalize(new List <string> {
             Constants.XenToolsUnzipPath, Constants.XenToolsReleasePackage
         });
     }
 }
        public ExecutableResult Execute(string value)
        {
            try
            {
                Statics.ShouldPollXenStore = false;
                _logger.Log(String.Format("XenTools Update value: {0}\r\nWill resume in 60 seconds", value));
                _sleeper.Sleep(60);
                var agentUpdateInfo = _agentUpdateMessageHandler.Handle(value);
                _finalizer.Finalize(new List <string> {
                    Constants.XenToolsUnzipPath, Constants.XenToolsReleasePackage
                });
                _downloader.Download(agentUpdateInfo.url, Constants.XenToolsReleasePackage);
                _checksumValidator.Validate(agentUpdateInfo.signature, Constants.XenToolsReleasePackage);
                _unzipper.Unzip(Constants.XenToolsReleasePackage, Constants.XenToolsUnzipPath, "");

                if (IsCustomPackage())
                {
                    RunCustomPackage();
                }
                else
                {
                    RunLegacyUpdate();
                }

                return(new ExecutableResult());
            }
            catch (Exception ex)
            {
                _logger.Log(String.Format("Exception was : {0}\nStackTrace Was: {1}", ex.Message, ex.StackTrace));
                return(new ExecutableResult {
                    Error = new List <string> {
                        "Update failed"
                    }, ExitCode = "1"
                });
            }
            finally
            {
                Statics.ShouldPollXenStore = true;
            }
        }