Skip to content

Commit 01db32a

Browse files
committed
Merge pull request #17 from Azure/dev
.
2 parents 85ba01b + 79b9e8a commit 01db32a

File tree

16 files changed

+1481
-1195
lines changed

16 files changed

+1481
-1195
lines changed

ChangeLog.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
2015.05.29 version 0.9.2
1+
2015.06.05 version 0.9.3
2+
* Fixed bug in Websites cmdlets related to slots #454
3+
* Fix bug in Set-AzureResource cmdlet #456
4+
* Fix for new azure resource of Microsoft.Storage #457
5+
6+
2015.05.29 version 0.9.2
27
* Deprecated Switch-AzureMode
38
* Profile
49
* Fixed bug in Get-AzureSubscription and Select-AzureSubscription cmdlets

setup/azurecmd.wxs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
33

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

8-
<?define version="0.9.2" ?>
8+
<?define version="0.9.3" ?>
99
<?define versionedStartMenuFolder="Microsoft Azure" ?>
1010
<?define staleStartMenuFolder="Windows Azure" ?>
1111

src/Common/Commands.Common/AzurePowerShell.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ public class AzurePowerShell
2727

2828
public const string AssemblyCopyright = "Copyright © Microsoft";
2929

30-
public const string AssemblyVersion = "0.9.2";
30+
public const string AssemblyVersion = "0.9.3";
3131

32-
public const string AssemblyFileVersion = "0.9.2";
32+
public const string AssemblyFileVersion = "0.9.3";
3333

3434
public const string ProfileFile = "AzureProfile.json";
3535

src/ResourceManager/ResourceManager/Commands.ResourceManager/Cmdlets/Entities/Resources/Resource.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public class Resource<TProperties>
3232
/// <summary>
3333
/// Gets or sets the id for the resource.
3434
/// </summary>
35-
[JsonProperty(Required = Required.Always)]
35+
[JsonProperty(Required = Required.Default)]
3636
public string Id { get; set; }
3737

3838
/// <summary>

src/ResourceManager/ResourceManager/Commands.ResourceManager/Cmdlets/Extensions/PsObjectExtensions.cs

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,16 +99,36 @@ private static JToken ToJToken(object value)
9999
return obj;
100100
}
101101

102-
var valueAsArray = value as Array;
103-
if (valueAsArray != null)
102+
var valueAsDictionary = value as IDictionary;
103+
if (valueAsDictionary != null)
104104
{
105-
var retVal = new JToken[valueAsArray.Length];
106-
for (int i = 0; i < valueAsArray.Length; ++i)
105+
JObject obj = new JObject();
106+
var dictionaryEntries = valueAsDictionary is IDictionary<string, object>
107+
? valueAsDictionary.OfType<KeyValuePair<string, object>>().Select(kvp => Tuple.Create(kvp.Key, kvp.Value))
108+
: valueAsDictionary.OfType<DictionaryEntry>().Select(dictionaryEntry => Tuple.Create(dictionaryEntry.Key.ToString(), dictionaryEntry.Value));
109+
110+
dictionaryEntries = dictionaryEntries.Any(dictionaryEntry => dictionaryEntry.Item1.EqualsInsensitively(Constants.MicrosoftAzureResource))
111+
? dictionaryEntries.Where(dictionaryEntry => !PsObjectExtensions.PropertiesToRemove.ContainsKey(dictionaryEntry.Item1))
112+
: dictionaryEntries;
113+
114+
foreach (var dictionaryEntry in dictionaryEntries)
115+
{
116+
obj.Add(dictionaryEntry.Item1, PsObjectExtensions.ToJToken(dictionaryEntry.Item2));
117+
}
118+
119+
return obj;
120+
}
121+
122+
var valueAsIList = value as IList;
123+
if (valueAsIList != null)
124+
{
125+
var tmpList = new List<JToken>();
126+
foreach(var v in valueAsIList)
107127
{
108-
retVal[i] = PsObjectExtensions.ToJToken(valueAsArray.GetValue(i));
128+
tmpList.Add(PsObjectExtensions.ToJToken(v));
109129
}
110130

111-
return JArray.FromObject(retVal);
131+
return JArray.FromObject(tmpList.ToArray());
112132
}
113133

114134
return new JValue(value.ToString());

src/ResourceManager/ResourceManager/Commands.ResourceManager/Cmdlets/Extensions/ResourceExtensions.cs

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,21 +35,26 @@ internal static class ResourceExtensions
3535
/// <param name="objectFormat">The <see cref="ResourceObjectFormat"/></param>
3636
internal static PSObject ToPsObject(this Resource<JToken> resource, ResourceObjectFormat objectFormat)
3737
{
38-
var resourceType = ResourceIdUtility.GetResourceType(resource.Id);
39-
var extensionResourceType = ResourceIdUtility.GetExtensionResourceType(resource.Id);
38+
var resourceType = string.IsNullOrEmpty(resource.Id)
39+
? null
40+
: ResourceIdUtility.GetResourceType(resource.Id);
41+
42+
var extensionResourceType = string.IsNullOrEmpty(resource.Id)
43+
? null
44+
: ResourceIdUtility.GetExtensionResourceType(resource.Id);
4045

4146
var objectDefinition = new Dictionary<string, object>
4247
{
4348
{ "Name", resource.Name },
44-
{ "ResourceId", resource.Id },
45-
{ "ResourceName", ResourceIdUtility.GetResourceName(resource.Id) },
49+
{ "ResourceId", string.IsNullOrEmpty(resource.Id) ? null : resource.Id },
50+
{ "ResourceName", string.IsNullOrEmpty(resource.Id) ? null : ResourceIdUtility.GetResourceName(resource.Id) },
4651
{ "ResourceType", resourceType },
47-
{ "ExtensionResourceName", ResourceIdUtility.GetExtensionResourceName(resource.Id) },
52+
{ "ExtensionResourceName", string.IsNullOrEmpty(resource.Id) ? null : ResourceIdUtility.GetExtensionResourceName(resource.Id) },
4853
{ "ExtensionResourceType", extensionResourceType },
4954
{ "Kind", resource.Kind },
50-
{ "ResourceGroupName", ResourceIdUtility.GetResourceGroupName(resource.Id) },
55+
{ "ResourceGroupName", string.IsNullOrEmpty(resource.Id) ? null : ResourceIdUtility.GetResourceGroupName(resource.Id) },
5156
{ "Location", resource.Location },
52-
{ "SubscriptionId", ResourceIdUtility.GetSubscriptionId(resource.Id) },
57+
{ "SubscriptionId", string.IsNullOrEmpty(resource.Id) ? null : ResourceIdUtility.GetSubscriptionId(resource.Id) },
5358
{ "Tags", TagsHelper.GetTagsHashtables(resource.Tags) },
5459
{ "Plan", resource.Plan.ToJToken().ToPsObject(objectFormat) },
5560
{ "Properties", ResourceExtensions.GetProperties(resource, objectFormat) },
@@ -58,8 +63,13 @@ internal static PSObject ToPsObject(this Resource<JToken> resource, ResourceObje
5863
{ "ETag", resource.ETag },
5964
};
6065

61-
var psObject = PowerShellUtilities.ConstructPSObject(
62-
(resourceType + extensionResourceType).Replace('/', '.'),
66+
var resourceTypeName = resourceType == null && extensionResourceType == null
67+
? null
68+
: (resourceType + extensionResourceType).Replace('/', '.');
69+
70+
var psObject =
71+
PowerShellUtilities.ConstructPSObject(
72+
resourceTypeName,
6373
objectDefinition.Where(kvp => kvp.Value != null).SelectManyArray(kvp => new[] { kvp.Key, kvp.Value }));
6474

6575
psObject.TypeNames.Add(Constants.MicrosoftAzureResource);

src/ResourceManager/Resources/Commands.Resources/AzureResourceManager.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
@{
1010

1111
# Version number of this module.
12-
ModuleVersion = '0.9.2'
12+
ModuleVersion = '0.9.3'
1313

1414
# ID used to uniquely identify this module
1515
GUID = '81d522a4-6e5d-4105-8f58-376204c47458'

src/ResourceManager/Storage/Commands.Management.Storage/Microsoft.Azure.Commands.Management.Storage.dll-Help.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
@{
1010

1111
# Version number of this module.
12-
ModuleVersion = '0.9.2'
12+
ModuleVersion = '0.9.3'
1313

1414
# ID used to uniquely identify this module
1515
GUID = 'F237EAAA-BD3A-4965-AD4A-BF38598BFEF7'

src/ResourceManager/Websites/Commands.Websites.Test/ScenarioTests/WebAppTests.ps1

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ function Test-CreatesNewSimpleWebApp
2525
$whpName = Get-WebHostPlanName
2626
$apiversion = "2014-04-01"
2727
$resourceType = "Microsoft.Web/sites"
28+
$slotName = $wname + "(Dev)"
2829
try
2930
{
3031
#Setup
@@ -34,10 +35,13 @@ function Test-CreatesNewSimpleWebApp
3435
# Test
3536
$actual = New-AzureWebApp -ResourceGroupName $rgname -Name $wname -Location $location -AppServicePlan $whpName
3637
$result = Get-AzureWebApp -ResourceGroupName $rgname -Name $wname
38+
$slotCreate = New-AzureWebApp -ResourceGroupName $rgname -Name $wname -Location $location -AppServicePlan $whpName -SlotName Dev
39+
3740

3841
# Assert
3942
Assert-AreEqual $wname $result.Name
4043
Assert-AreEqual $whpName $result.Properties.ServerFarm
44+
Assert-AreEqual $slotName $slotCreate.Name
4145
}
4246
finally
4347
{

src/ResourceManager/Websites/Commands.Websites.Test/SessionRecords/Microsoft.Azure.Commands.WebApp.Test.ScenarioTests.WebAppTests/TestCreatesNewSimpleWebApp.json

Lines changed: 424 additions & 184 deletions
Large diffs are not rendered by default.

src/ResourceManager/Websites/Commands.Websites/Utilities/WebsitesClient.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,20 @@ public WebSiteManagementClient WrappedWebsitesClient
4747

4848
public WebSite CreateWebsite(string resourceGroupName, string webSiteName, string slotName, string location, string webHostingPlan)
4949
{
50+
string webSiteSlotName = webSiteName;
51+
if (string.IsNullOrEmpty(slotName) == false)
52+
{
53+
webSiteSlotName = string.Concat(webSiteName, "/", slotName);
54+
55+
}
56+
5057
var createdWebSite = WrappedWebsitesClient.WebSites.CreateOrUpdate(
5158
resourceGroupName, webSiteName, slotName,
5259
new WebSiteCreateOrUpdateParameters
5360
{
5461
WebSite = new WebSiteBase
5562
{
56-
Name = webSiteName,
63+
Name = webSiteSlotName,
5764
Location = location,
5865
Properties = new WebSiteBaseProperties(webHostingPlan)
5966
}

src/ServiceManagement/Compute/Commands.ServiceManagement.PlatformImageRepository/PIR.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
ModuleToProcess = '.\Microsoft.WindowsAzure.Commands.ServiceManagement.PlatformImageRepository.dll'
1313

1414
# Version number of this module.
15-
ModuleVersion = '0.9.2'
15+
ModuleVersion = '0.9.3'
1616

1717
# ID used to uniquely identify this module
1818
GUID = 'a9343cbd-175c-4f72-90c7-2abe9b300644'

src/ServiceManagement/Compute/Commands.ServiceManagement.Preview/AzurePreview.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
ModuleToProcess = '.\Microsoft.WindowsAzure.Commands.ServiceManagement.Preview.dll'
1313

1414
# Version number of this module.
15-
ModuleVersion = '0.9.2'
15+
ModuleVersion = '0.9.3'
1616

1717
# ID used to uniquely identify this module
1818
GUID = '1C72E555-E83F-45E4-AED2-AF3278828DCD'

src/ServiceManagement/ExpressRoute/Commands.ExpressRoute/ExpressRoute.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
ModuleToProcess = '.\Microsoft.WindowsAzure.Commands.ExpressRoute.dll'
1313

1414
# Version number of this module.
15-
ModuleVersion = '0.9.2'
15+
ModuleVersion = '0.9.3'
1616

1717
# ID used to uniquely identify this module
1818
GUID = 'e5b10573-30da-456a-9319-4c0a5f8bed4a'

src/ServiceManagement/Services/Commands.Utilities/Azure.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
@{
1010

1111
# Version number of this module.
12-
ModuleVersion = '0.9.2'
12+
ModuleVersion = '0.9.3'
1313

1414
# ID used to uniquely identify this module
1515
GUID = 'D48CF693-4125-4D2D-8790-1514F44CE325'

0 commit comments

Comments
 (0)