Skip to content

Commit

Permalink
Made agent work with either WMI or exe tools
Browse files Browse the repository at this point in the history
  • Loading branch information
kashivreddy committed Nov 18, 2013
1 parent 67dbcd8 commit 2729b48
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Properties.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
COMPANY = "Rackspace Cloud"
DESCRIPTION = "C#.NET Agent for Windows Virtual Machines"
CLR_VERSION = 'v3.5'
RELEASE_BUILD_NUMBER = "1.2.6.1"
RELEASE_BUILD_NUMBER = "1.2.7.0"

#Paths
SLN_FILE = File.join(ABSOLUTE_PATH,'src','WindowsConfigurationAgent.sln')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
[assembly: AssemblyCompany("Rackspace Cloud")]
[assembly: AssemblyProduct("Rackspace Cloud Server Agent")]
[assembly: AssemblyCopyright("Copyright (c) 2009 2010 2011, Rackspace Cloud. All Rights Reserved")]
[assembly: AssemblyVersion("1.2.6.1")]
[assembly: AssemblyVersion("1.2.7.0")]
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
[assembly: AssemblyCompany("Rackspace Cloud")]
[assembly: AssemblyProduct("Rackspace Cloud Server Agent")]
[assembly: AssemblyCopyright("Copyright (c) 2009 2010 2011, Rackspace Cloud. All Rights Reserved")]
[assembly: AssemblyVersion("1.2.6.1")]
[assembly: AssemblyVersion("1.2.7.0")]
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
[assembly: AssemblyCompany("Rackspace Cloud")]
[assembly: AssemblyProduct("Rackspace Cloud Server Agent")]
[assembly: AssemblyCopyright("Copyright (c) 2009 2010 2011, Rackspace Cloud. All Rights Reserved")]
[assembly: AssemblyVersion("1.2.6.1")]
[assembly: AssemblyVersion("1.2.7.0")]
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
[assembly: AssemblyCompany("Rackspace Cloud")]
[assembly: AssemblyProduct("Rackspace Cloud Server Agent")]
[assembly: AssemblyCopyright("Copyright (c) 2009 2010 2011, Rackspace Cloud. All Rights Reserved")]
[assembly: AssemblyVersion("1.2.6.1")]
[assembly: AssemblyVersion("1.2.7.0")]
1 change: 1 addition & 0 deletions src/Rackspace.Cloud.Server.Agent/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,6 @@ public static class Constants {
public static readonly string UpdaterReleasePackageName = "UpdateService.zip";
public static readonly string UpdaterEmbeddedReleasePackagePath = "Rackspace.Cloud.Server.Agent.UpdaterFiles.UpdateService.zip";
public static readonly string UpdaterReleasePackage = SvcConfiguration.AgentVersionUpdatesPath + UpdaterReleasePackageName;
public static readonly string XenToolsRegPath = @"HKEY_LOCAL_MACHINE\SOFTWARE\Citrix\XenTools";
}
}
24 changes: 18 additions & 6 deletions src/Rackspace.Cloud.Server.Agent/IoC.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,22 @@
using Rackspace.Cloud.Server.Agent.WMI;
using Rackspace.Cloud.Server.Common.Logging;
using Rackspace.Cloud.Server.DiffieHellman;
using StructureMap;
using StructureMap.Configuration.DSL;

using StructureMap;
using StructureMap.Configuration.DSL;
using WinRegistry = Microsoft.Win32.Registry;

namespace Rackspace.Cloud.Server.Agent {
public class IoC {
public static void Register() {
StructureMapConfiguration.BuildInstancesOf<ICommandQueue>().TheDefaultIsConcreteType<CommandQueue>();
StructureMapConfiguration.BuildInstancesOf<ICommandFactory>().TheDefaultIsConcreteType<CommandFactory>();
StructureMapConfiguration.BuildInstancesOf<IExecutableProcess>().TheDefaultIsConcreteType<ExecutableProcess>();
StructureMapConfiguration.BuildInstancesOf<ILogger>().TheDefaultIsConcreteType<Logger>();
StructureMapConfiguration.BuildInstancesOf<IExecutableProcessQueue>().TheDefaultIsConcreteType<ExecutableProcessQueue>();
StructureMapConfiguration.BuildInstancesOf<IXenStore>().TheDefaultIsConcreteType<XenStoreWmi>();
StructureMapConfiguration.BuildInstancesOf<IExecutableProcessQueue>().TheDefaultIsConcreteType<ExecutableProcessQueue>();
if (IsWmiTools())
StructureMapConfiguration.BuildInstancesOf<IXenStore>().TheDefaultIsConcreteType<XenStoreWmi>();
else
StructureMapConfiguration.BuildInstancesOf<IXenStore>().TheDefaultIsConcreteType<XenStore>();
StructureMapConfiguration.BuildInstancesOf<IExecutableProcessCommandPatternSubsitution>().TheDefaultIsConcreteType<ExecutableProcessCommandPatternSubsitution>();
StructureMapConfiguration.BuildInstancesOf<ISetNetworkInterface>().TheDefaultIsConcreteType<SetNetworkInterface>();
StructureMapConfiguration.BuildInstancesOf<ISetPassword>().TheDefaultIsConcreteType<SetPassword>();
Expand Down Expand Up @@ -101,6 +105,14 @@ public class IoC {
StructureMapConfiguration.AddInstanceOf<IExecutableCommand>().UsingConcreteType<UpdaterUpdate>().WithName(Utilities.Commands.updaterupdate.ToString());
StructureMapConfiguration.AddInstanceOf<IExecutableCommand>().UsingConcreteType<SetHostname>().WithName(Utilities.Commands.sethostname.ToString());
StructureMapConfiguration.AddInstanceOf<IExecutableCommand>().UsingConcreteType<EnsureMinAgentUpdater>().WithName(Utilities.Commands.ensureminagentupdater.ToString());
}
}

private static bool IsWmiTools()
{
var majorVersion = (int) WinRegistry.GetValue(Constants.XenToolsRegPath, "MajorVersion", 0);
var minorVersion = (int) WinRegistry.GetValue(Constants.XenToolsRegPath, "MinorVersion", 0);

return float.Parse(majorVersion + "." + minorVersion) > 6.0;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
[assembly: AssemblyCompany("Rackspace Cloud")]
[assembly: AssemblyProduct("Rackspace Cloud Server Agent")]
[assembly: AssemblyCopyright("Copyright (c) 2009 2010 2011, Rackspace Cloud. All Rights Reserved")]
[assembly: AssemblyVersion("1.2.6.1")]
[assembly: AssemblyVersion("1.2.7.0")]
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
[assembly: AssemblyCompany("Rackspace Cloud")]
[assembly: AssemblyProduct("Rackspace Cloud Server Agent")]
[assembly: AssemblyCopyright("Copyright (c) 2009 2010 2011, Rackspace Cloud. All Rights Reserved")]
[assembly: AssemblyVersion("1.2.6.1")]
[assembly: AssemblyVersion("1.2.7.0")]
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
[assembly: AssemblyCompany("Rackspace Cloud")]
[assembly: AssemblyProduct("Rackspace Cloud Server Agent")]
[assembly: AssemblyCopyright("Copyright (c) 2009 2010 2011, Rackspace Cloud. All Rights Reserved")]
[assembly: AssemblyVersion("1.2.6.1")]
[assembly: AssemblyVersion("1.2.7.0")]

0 comments on commit 2729b48

Please sign in to comment.