Skip to content

Commit

Permalink
Merge pull request #467 from Azure/release-0.9.3
Browse files Browse the repository at this point in the history
Integrate from release to master as a part of Release 0.9.3
  • Loading branch information
ogail committed Jun 6, 2015
2 parents aa13711 + 3f30354 commit b3706ba
Show file tree
Hide file tree
Showing 16 changed files with 1,481 additions and 1,195 deletions.
7 changes: 6 additions & 1 deletion ChangeLog.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
2015.05.29 version 0.9.2
2015.06.05 version 0.9.3
* Fixed bug in Websites cmdlets related to slots #454
* Fix bug in Set-AzureResource cmdlet #456
* Fix for new azure resource of Microsoft.Storage #457

2015.05.29 version 0.9.2
* Deprecated Switch-AzureMode
* Profile
* Fixed bug in Get-AzureSubscription and Select-AzureSubscription cmdlets
Expand Down
4 changes: 2 additions & 2 deletions setup/azurecmd.wxs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">

<?define productName="Microsoft Azure PowerShell - May 2015" ?>
<?define productName="Microsoft Azure PowerShell - June 2015" ?>
<?define sourceDir="$(var.SolutionDir)..\src\Package\$(var.Configuration)" ?>
<?define caSourceDir="$(var.SolutionDir)setup\bin\$(var.Configuration)" ?>

<?define version="0.9.2" ?>
<?define version="0.9.3" ?>
<?define versionedStartMenuFolder="Microsoft Azure" ?>
<?define staleStartMenuFolder="Windows Azure" ?>

Expand Down
4 changes: 2 additions & 2 deletions src/Common/Commands.Common/AzurePowerShell.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ public class AzurePowerShell

public const string AssemblyCopyright = "Copyright © Microsoft";

public const string AssemblyVersion = "0.9.2";
public const string AssemblyVersion = "0.9.3";

public const string AssemblyFileVersion = "0.9.2";
public const string AssemblyFileVersion = "0.9.3";

public const string ProfileFile = "AzureProfile.json";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class Resource<TProperties>
/// <summary>
/// Gets or sets the id for the resource.
/// </summary>
[JsonProperty(Required = Required.Always)]
[JsonProperty(Required = Required.Default)]
public string Id { get; set; }

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,16 +99,36 @@ private static JToken ToJToken(object value)
return obj;
}

var valueAsArray = value as Array;
if (valueAsArray != null)
var valueAsDictionary = value as IDictionary;
if (valueAsDictionary != null)
{
var retVal = new JToken[valueAsArray.Length];
for (int i = 0; i < valueAsArray.Length; ++i)
JObject obj = new JObject();
var dictionaryEntries = valueAsDictionary is IDictionary<string, object>
? valueAsDictionary.OfType<KeyValuePair<string, object>>().Select(kvp => Tuple.Create(kvp.Key, kvp.Value))
: valueAsDictionary.OfType<DictionaryEntry>().Select(dictionaryEntry => Tuple.Create(dictionaryEntry.Key.ToString(), dictionaryEntry.Value));

dictionaryEntries = dictionaryEntries.Any(dictionaryEntry => dictionaryEntry.Item1.EqualsInsensitively(Constants.MicrosoftAzureResource))
? dictionaryEntries.Where(dictionaryEntry => !PsObjectExtensions.PropertiesToRemove.ContainsKey(dictionaryEntry.Item1))
: dictionaryEntries;

foreach (var dictionaryEntry in dictionaryEntries)
{
obj.Add(dictionaryEntry.Item1, PsObjectExtensions.ToJToken(dictionaryEntry.Item2));
}

return obj;
}

var valueAsIList = value as IList;
if (valueAsIList != null)
{
var tmpList = new List<JToken>();
foreach(var v in valueAsIList)
{
retVal[i] = PsObjectExtensions.ToJToken(valueAsArray.GetValue(i));
tmpList.Add(PsObjectExtensions.ToJToken(v));
}

return JArray.FromObject(retVal);
return JArray.FromObject(tmpList.ToArray());
}

return new JValue(value.ToString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,21 +35,26 @@ internal static class ResourceExtensions
/// <param name="objectFormat">The <see cref="ResourceObjectFormat"/></param>
internal static PSObject ToPsObject(this Resource<JToken> resource, ResourceObjectFormat objectFormat)
{
var resourceType = ResourceIdUtility.GetResourceType(resource.Id);
var extensionResourceType = ResourceIdUtility.GetExtensionResourceType(resource.Id);
var resourceType = string.IsNullOrEmpty(resource.Id)
? null
: ResourceIdUtility.GetResourceType(resource.Id);

var extensionResourceType = string.IsNullOrEmpty(resource.Id)
? null
: ResourceIdUtility.GetExtensionResourceType(resource.Id);

var objectDefinition = new Dictionary<string, object>
{
{ "Name", resource.Name },
{ "ResourceId", resource.Id },
{ "ResourceName", ResourceIdUtility.GetResourceName(resource.Id) },
{ "ResourceId", string.IsNullOrEmpty(resource.Id) ? null : resource.Id },
{ "ResourceName", string.IsNullOrEmpty(resource.Id) ? null : ResourceIdUtility.GetResourceName(resource.Id) },
{ "ResourceType", resourceType },
{ "ExtensionResourceName", ResourceIdUtility.GetExtensionResourceName(resource.Id) },
{ "ExtensionResourceName", string.IsNullOrEmpty(resource.Id) ? null : ResourceIdUtility.GetExtensionResourceName(resource.Id) },
{ "ExtensionResourceType", extensionResourceType },
{ "Kind", resource.Kind },
{ "ResourceGroupName", ResourceIdUtility.GetResourceGroupName(resource.Id) },
{ "ResourceGroupName", string.IsNullOrEmpty(resource.Id) ? null : ResourceIdUtility.GetResourceGroupName(resource.Id) },
{ "Location", resource.Location },
{ "SubscriptionId", ResourceIdUtility.GetSubscriptionId(resource.Id) },
{ "SubscriptionId", string.IsNullOrEmpty(resource.Id) ? null : ResourceIdUtility.GetSubscriptionId(resource.Id) },
{ "Tags", TagsHelper.GetTagsHashtables(resource.Tags) },
{ "Plan", resource.Plan.ToJToken().ToPsObject(objectFormat) },
{ "Properties", ResourceExtensions.GetProperties(resource, objectFormat) },
Expand All @@ -58,8 +63,13 @@ internal static PSObject ToPsObject(this Resource<JToken> resource, ResourceObje
{ "ETag", resource.ETag },
};

var psObject = PowerShellUtilities.ConstructPSObject(
(resourceType + extensionResourceType).Replace('/', '.'),
var resourceTypeName = resourceType == null && extensionResourceType == null
? null
: (resourceType + extensionResourceType).Replace('/', '.');

var psObject =
PowerShellUtilities.ConstructPSObject(
resourceTypeName,
objectDefinition.Where(kvp => kvp.Value != null).SelectManyArray(kvp => new[] { kvp.Key, kvp.Value }));

psObject.TypeNames.Add(Constants.MicrosoftAzureResource);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
@{

# Version number of this module.
ModuleVersion = '0.9.2'
ModuleVersion = '0.9.3'

# ID used to uniquely identify this module
GUID = '81d522a4-6e5d-4105-8f58-376204c47458'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
@{

# Version number of this module.
ModuleVersion = '0.9.2'
ModuleVersion = '0.9.3'

# ID used to uniquely identify this module
GUID = 'F237EAAA-BD3A-4965-AD4A-BF38598BFEF7'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ function Test-CreatesNewSimpleWebApp
$whpName = Get-WebHostPlanName
$apiversion = "2014-04-01"
$resourceType = "Microsoft.Web/sites"
$slotName = $wname + "(Dev)"
try
{
#Setup
Expand All @@ -34,10 +35,13 @@ function Test-CreatesNewSimpleWebApp
# Test
$actual = New-AzureWebApp -ResourceGroupName $rgname -Name $wname -Location $location -AppServicePlan $whpName
$result = Get-AzureWebApp -ResourceGroupName $rgname -Name $wname
$slotCreate = New-AzureWebApp -ResourceGroupName $rgname -Name $wname -Location $location -AppServicePlan $whpName -SlotName Dev


# Assert
Assert-AreEqual $wname $result.Name
Assert-AreEqual $whpName $result.Properties.ServerFarm
Assert-AreEqual $slotName $slotCreate.Name
}
finally
{
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,20 @@ public WebSiteManagementClient WrappedWebsitesClient

public WebSite CreateWebsite(string resourceGroupName, string webSiteName, string slotName, string location, string webHostingPlan)
{
string webSiteSlotName = webSiteName;
if (string.IsNullOrEmpty(slotName) == false)
{
webSiteSlotName = string.Concat(webSiteName, "/", slotName);

}

var createdWebSite = WrappedWebsitesClient.WebSites.CreateOrUpdate(
resourceGroupName, webSiteName, slotName,
new WebSiteCreateOrUpdateParameters
{
WebSite = new WebSiteBase
{
Name = webSiteName,
Name = webSiteSlotName,
Location = location,
Properties = new WebSiteBaseProperties(webHostingPlan)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
ModuleToProcess = '.\Microsoft.WindowsAzure.Commands.ServiceManagement.PlatformImageRepository.dll'

# Version number of this module.
ModuleVersion = '0.9.2'
ModuleVersion = '0.9.3'

# ID used to uniquely identify this module
GUID = 'a9343cbd-175c-4f72-90c7-2abe9b300644'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
ModuleToProcess = '.\Microsoft.WindowsAzure.Commands.ServiceManagement.Preview.dll'

# Version number of this module.
ModuleVersion = '0.9.2'
ModuleVersion = '0.9.3'

# ID used to uniquely identify this module
GUID = '1C72E555-E83F-45E4-AED2-AF3278828DCD'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
ModuleToProcess = '.\Microsoft.WindowsAzure.Commands.ExpressRoute.dll'

# Version number of this module.
ModuleVersion = '0.9.2'
ModuleVersion = '0.9.3'

# ID used to uniquely identify this module
GUID = 'e5b10573-30da-456a-9319-4c0a5f8bed4a'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
@{

# Version number of this module.
ModuleVersion = '0.9.2'
ModuleVersion = '0.9.3'

# ID used to uniquely identify this module
GUID = 'D48CF693-4125-4D2D-8790-1514F44CE325'
Expand Down
Loading

0 comments on commit b3706ba

Please sign in to comment.