Skip to content

DSC extension refactored code for ARM & ASM #647

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 33 commits into from Jul 30, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
f910122
Support for side by side module versioning
eshaparmar Jun 11, 2015
e2e95e4
version conditions got swiped by mistake
eshaparmar Jun 12, 2015
783ab7a
CR comments
eshaparmar Jun 17, 2015
4e319ad
Added format file for dsc get cmdlet in ARM
eshaparmar Jul 9, 2015
af44e43
Merge branch 'dev' of https://github.com/dscsolutions/azure-powershel…
eshaparmar Jul 9, 2015
d36f516
Merge branch 'armcmdlets-2.0' into bugfixes
eshaparmar Jul 9, 2015
3e5d8f3
Fix storage suffix in ASM cmdlets
narrieta Jul 10, 2015
15cfa04
Merge branch 'armcmdlets' of https://github.com/dscsolutions/azure-po…
narrieta Jul 10, 2015
1c018ae
Added storage suffix to ARM cmdlets
narrieta Jul 10, 2015
80f8a1e
Move common code to commons
eshaparmar Jul 10, 2015
817d3e0
Merge branch 'armcmdlets' into dev
eshaparmar Jul 10, 2015
23a7810
more changes
eshaparmar Jul 10, 2015
7c8f76c
Merge branch 'dev' of https://github.com/dscsolutions/azure-powershel…
narrieta Jul 10, 2015
3b5d5f6
Merge pull request #4 from dscsolutions/storage-suffix
narrieta Jul 10, 2015
c9ebb91
more changes
eshaparmar Jul 10, 2015
7ea546d
renamed extensions folder and added vs proj settings
eshaparmar Jul 11, 2015
d6c432b
Correcting paths and vs proj file
eshaparmar Jul 11, 2015
548a2ba
Fixed the build issues
eshaparmar Jul 11, 2015
21930a7
End to end publish ASM workflow
eshaparmar Jul 13, 2015
384850b
Final refactoring for DSC code for ARM and ASM
eshaparmar Jul 13, 2015
c143ebe
Fixed resharper warnings from serialier class
eshaparmar Jul 14, 2015
7c9083b
Merge storage suffix changes from dscsolutions 'dev' to 'refactoring'
eshaparmar Jul 14, 2015
e0e431a
Removed public and private settings from get output format file
eshaparmar Jul 15, 2015
bf25298
Making cmdlet base classes internal
eshaparmar Jul 15, 2015
973db34
Changing methods to internal
eshaparmar Jul 15, 2015
8c4427c
Merge branch 'dev' of https://github.com/Azure/azure-powershell into …
eshaparmar Jul 16, 2015
9fae049
Merge branch 'dev' of https://github.com/dscsolutions/azure-powershel…
eshaparmar Jul 16, 2015
e27e3b8
Fixing merge conflicts
eshaparmar Jul 16, 2015
18b9182
Adding extension name and publisher to get/remove ASM cmdlets that go…
eshaparmar Jul 22, 2015
593276a
Regenerated wxi file
eshaparmar Jul 29, 2015
2484821
Merge branch 'dev' of https://github.com/Azure/azure-powershell into dev
eshaparmar Jul 29, 2015
166d48e
Merge branch 'dev' into dsc_release
eshaparmar Jul 29, 2015
5d4f8e9
Regenerated wix file post merge from dev
eshaparmar Jul 29, 2015
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
336 changes: 272 additions & 64 deletions setup/azurecmdfiles.wxi

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions src/Common/Commands.Common/Commands.Common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,16 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\packages\Microsoft.WindowsAzure.Management.4.1.1\lib\net40\Microsoft.WindowsAzure.Management.dll</HintPath>
</Reference>
<Reference Include="Microsoft.WindowsAzure.Storage">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like you've added a new DLL to the output. Please regenerate WIX file if that is the case

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure why we need to regenerate the wix file. We haven't added any new project/assembly. Just re-using an existing one(Microsoft.WindowsAzure.Management) and added it as a reference to the Command.Common project.

<HintPath>..\..\packages\WindowsAzure.Storage.4.0.0\lib\net40\Microsoft.WindowsAzure.Storage.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json">
<HintPath>..\..\packages\Newtonsoft.Json.6.0.4\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.IO.Compression.FileSystem" />
<Reference Include="System.Management.Automation, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
<Reference Include="System.Net" />
<Reference Include="System.Net.Http" />
Expand Down Expand Up @@ -145,6 +149,14 @@
<Compile Include="AzurePowerShell.cs" />
<Compile Include="ComputeCloudException.cs" />
<Compile Include="Constants.cs" />
<Compile Include="Extensions\DSC\DscExtensionCmdletConstants.cs" />
<Compile Include="Extensions\DSC\DscExtensionPrivateSettings.cs" />
<Compile Include="Extensions\DSC\DscExtensionPublicSettings.cs" />
<Compile Include="Extensions\DSC\DscExtensionSettingsSerializer.cs" />
<Compile Include="Extensions\DSC\Exceptions\GetDscResourceException.cs" />
<Compile Include="Extensions\DSC\Publish\ConfigurationParseResult.cs" />
<Compile Include="Extensions\DSC\Publish\ConfigurationParsingHelper.cs" />
<Compile Include="Extensions\DSC\Publish\DscExtensionPublishCmdletCommonBase.cs" />
<Compile Include="SecureStringExtensions.cs" />
<Compile Include="ConversionUtilities.cs" />
<Compile Include="DebugStreamTraceListener.cs" />
Expand Down Expand Up @@ -182,13 +194,15 @@
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>PublicResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<None Include="packages.config">
<SubType>Designer</SubType>
</None>
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
<Import Project="..\..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets" Condition="Exists('..\..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;

namespace Microsoft.WindowsAzure.Commands.Common.Extensions.DSC
{
public static class DscExtensionCmdletConstants
{
//common extension constants
internal static readonly string ExtensionPublishedNamespace = "Microsoft.Powershell";
internal static readonly string ExtensionPublishedName = "DSC";
internal const string DefaultContainerName = "windows-powershell-dsc";

internal const int MinMajorPowerShellVersion = 4;
internal const string ZipFileExtension = ".zip";
internal const string Ps1FileExtension = ".ps1";
internal const string Psm1FileExtension = ".psm1";


internal static readonly HashSet<String> UploadArchiveAllowedFileExtensions =
new HashSet<String>(StringComparer.OrdinalIgnoreCase) { Ps1FileExtension, Psm1FileExtension, ZipFileExtension };
internal static readonly HashSet<String> CreateArchiveAllowedFileExtensions =
new HashSet<String>(StringComparer.OrdinalIgnoreCase) { Ps1FileExtension, Psm1FileExtension };
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@
// limitations under the License.
// ----------------------------------------------------------------------------------

namespace Microsoft.Azure.Commands.Compute.Extension.DSC
namespace Microsoft.WindowsAzure.Commands.Common.Extensions.DSC
{

using System.Collections;

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
using System.Collections;
using System.Collections.Generic;

namespace Microsoft.Azure.Commands.Compute.Extension.DSC
namespace Microsoft.WindowsAzure.Commands.Common.Extensions.DSC
{
/// <summary>
/// Represents public settings. Serialized representation of this object stored as a plain text string on the VM.
Expand All @@ -40,21 +40,21 @@ internal class Version1
/// <returns></returns>
public DscExtensionPublicSettings ToCurrentVersion()
{
List<Property> properties = new List<Property>();
foreach (DictionaryEntry p in this.Properties)
var properties = new List<Property>();
foreach (DictionaryEntry p in Properties)
{
properties.Add(new Property()
properties.Add(new Property
{
Name = p.Key.ToString(),
TypeName = p.Value.GetType().ToString(),
Value = p.Value
});
}
return new DscExtensionPublicSettings()
return new DscExtensionPublicSettings
{
SasToken = this.SasToken,
ModulesUrl = this.ModulesUrl,
ConfigurationFunction = this.ConfigurationFunction,
SasToken = SasToken,
ModulesUrl = ModulesUrl,
ConfigurationFunction = ConfigurationFunction,
Properties = properties.ToArray(),
ProtocolVersion = new Version(1, 0, 0, 0)
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,27 @@
// limitations under the License.
// ----------------------------------------------------------------------------------


using Newtonsoft.Json;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.Management.Automation;
using System.Runtime.InteropServices;
using System.Security;
using Newtonsoft.Json;

namespace Microsoft.Azure.Commands.Compute.Extension.DSC
namespace Microsoft.WindowsAzure.Commands.Common.Extensions.DSC
{
public class DscSettingsSerializer
public class DscExtensionSettingsSerializer
{
/// <summary>
/// Serialize DscPublicSettings to string.
/// Serialize DscExtensionPublicSettings to string.
/// </summary>
/// <param name="publicSettings"></param>
/// <param name="extensionPublicSettings"></param>
/// <returns></returns>
public static string SerializePublicSettings(DscExtensionPublicSettings publicSettings)
public static string SerializePublicSettings(DscExtensionPublicSettings extensionPublicSettings)
{
return JsonConvert.SerializeObject(publicSettings);
return JsonConvert.SerializeObject(extensionPublicSettings);
}

/// <summary>
Expand All @@ -48,10 +47,10 @@ public static string SerializePrivateSettings(DscExtensionPrivateSettings privat

public static DscExtensionPublicSettings DeserializePublicSettings(string publicSettingsString)
{
DscExtensionPublicSettings publicSettings;
DscExtensionPublicSettings extensionPublicSettings;
try
{
publicSettings = string.IsNullOrEmpty(publicSettingsString)
extensionPublicSettings = string.IsNullOrEmpty(publicSettingsString)
? null
: JsonConvert.DeserializeObject<DscExtensionPublicSettings>(publicSettingsString);
}
Expand All @@ -62,14 +61,14 @@ public static DscExtensionPublicSettings DeserializePublicSettings(string public
{
DscExtensionPublicSettings.Version1 publicSettingsV1 =
JsonConvert.DeserializeObject<DscExtensionPublicSettings.Version1>(publicSettingsString);
publicSettings = publicSettingsV1.ToCurrentVersion();
extensionPublicSettings = publicSettingsV1.ToCurrentVersion();
}
catch (JsonException)
{
throw;
}
}
return publicSettings;
return extensionPublicSettings;
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
using System;
using System.Globalization;

namespace Microsoft.Azure.Commands.Compute.Extension.DSC

namespace Microsoft.WindowsAzure.Commands.Common.Extensions.DSC.Exceptions
{
[Serializable]
public class GetDscResourceException : UnauthorizedAccessException
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,16 @@
// limitations under the License.
// ----------------------------------------------------------------------------------

using System;
using System.Collections.Generic;
using System.Management.Automation.Language;

namespace Microsoft.Azure.Commands.Compute.Extension.DSC
namespace Microsoft.WindowsAzure.Commands.Common.Extensions.DSC.Publish
{
public class ConfigurationParseResult
{
public string Path { get; set; }
public ParseError[] Errors { get; set; }
public List<String> RequiredModules { get; set; }
public Dictionary<string,string> RequiredModules { get; set; }

}
}
Loading