3
using Rackspace.Cloud.Server.Common.AgentUpdate;
4
using Rackspace.Cloud.Server.Common.Configuration;
5
using Rackspace.Cloud.Server.Common.Logging;
7
namespace Rackspace.Cloud.Server.Agent.UpdaterService.Commands {
8
public interface IAgentDownload : ICommand {
11
public class AgentDownload : IAgentDownload {
12
private readonly ILogger _logger;
14
public AgentDownload(ILogger logger) {
18
public void Execute(AgentUpdateInfo agentUpdateInfo) {
19
_logger.Log("Downloading Agent ...");
21
if (!Directory.Exists(SvcConfiguration.AgentVersionUpdatesPath))
22
Directory.CreateDirectory(SvcConfiguration.AgentVersionUpdatesPath);
24
var webClient = new WebClient();
25
webClient.DownloadFile(agentUpdateInfo.url, Constants.AgentServiceReleasePackage);
27
_logger.Log("Agent downloaded.");