Skip to content

Commit ad95af3

Browse files
unknownunknown
authored andcommitted
Update PR according to comments
1 parent 6074b72 commit ad95af3

14 files changed

+339
-125
lines changed

src/ResourceManager/Compute/Commands.Compute.Test/ScenarioTests/VirtualMachineExtensionTests.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,17 @@ public void TestVirtualMachineExtension()
2626
ComputeTestController.NewInstance.RunPsTest("Test-VirtualMachineExtension");
2727
}
2828

29-
//[Fact]
30-
//[Trait(Category.AcceptanceType, Category.CheckIn)] // disable this test until the breaking api is checked in.
29+
[Fact
30+
(Skip = "Disable this test until the breaking api is checked in.")]
31+
[Trait(Category.AcceptanceType, Category.CheckIn)]
3132
public void TestVirtualMachineCustomScriptExtension()
3233
{
3334
ComputeTestController.NewInstance.RunPsTest("Test-VirtualMachineCustomScriptExtension");
3435
}
3536

36-
//[Fact]
37-
//[Trait(Category.AcceptanceType, Category.CheckIn)] // disable this test until the breaking api is checked in.
37+
[Fact
38+
(Skip = "Disable this test until the breaking api is checked in.")]
39+
[Trait(Category.AcceptanceType, Category.CheckIn)] // disable this test until the breaking api is checked in.
3840
public void TestVirtualMachineAccessExtension()
3941
{
4042
ComputeTestController.NewInstance.RunPsTest("Test-VirtualMachineAccessExtension");

src/ResourceManager/Compute/Commands.Compute.Test/ScenarioTests/VirtualMachineExtensionTests.ps1

Lines changed: 6 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ function Test-VirtualMachineExtension
2525
try
2626
{
2727
# Common
28-
$loc = 'West US';
28+
$loc = Get-ProviderLocation ResourceManagement;;
2929
New-AzureResourceGroup -Name $rgname -Location $loc;
3030

3131
# VM Profile & Hardware
@@ -184,16 +184,7 @@ function Test-VirtualMachineExtension
184184
Assert-AreEqual $vm1.Extensions[0].TypeHandlerVersion $extver;
185185
Assert-NotNull $vm1.Extensions[0].Settings;
186186

187-
<# *** TODO: The removal call did not return. 12/12/2014.
188-
189-
# Remove Extension
190-
Remove-AzureVMExtension -ResourceGroupName $rgname -VMName $vmname -Name $extname -Force;
191-
192-
# Check Extensions in VM
193-
$vm2 = Get-AzureVM -Name $vmname -ResourceGroupName $rgname;
194-
Assert-Null $vm2.Resources;
195-
196-
#>
187+
# *** TODO: The removal call did not return. 12/12/2014
197188
}
198189
finally
199190
{
@@ -214,7 +205,7 @@ function Test-VirtualMachineCustomScriptExtension
214205
try
215206
{
216207
# Common
217-
$loc = 'West US';
208+
$loc = Get-ProviderLocation ResourceManagement;
218209
New-AzureResourceGroup -Name $rgname -Location $loc;
219210

220211
# VM Profile & Hardware
@@ -350,16 +341,7 @@ function Test-VirtualMachineCustomScriptExtension
350341
Assert-AreEqual $vm1.Resources.Extensions[0].TypeHandlerVersion $extver;
351342
Assert-NotNull $vm1.Resources.Extensions[0].Settings;
352343

353-
<# *** TODO: The removal call did not return. 12/12/2014.
354-
355-
# Remove Extension
356-
Remove-AzureVMCustomScriptExtension -ResourceGroupName $rgname -VMName $vmname -Name $extname -Force;
357-
358-
# Check Extensions in VM
359-
$vm2 = Get-AzureVM -Name $vmname -ResourceGroupName $rgname;
360-
Assert-Null $vm2.Resources;
361-
362-
#>
344+
# *** TODO: The removal call did not return. 12/12/2014
363345
}
364346
finally
365347
{
@@ -382,7 +364,7 @@ function Test-VirtualMachineAccessExtension
382364
try
383365
{
384366
# Common
385-
$loc = 'West US';
367+
$loc = Get-ProviderLocation ResourceManagement;;
386368
New-AzureResourceGroup -Name $rgname -Location $loc;
387369

388370
# VM Profile & Hardware
@@ -516,16 +498,7 @@ function Test-VirtualMachineAccessExtension
516498
Assert-AreEqual $vm1.Resources.Extensions[0].TypeHandlerVersion $extver;
517499
Assert-NotNull $vm1.Resources.Extensions[0].Settings;
518500

519-
<# *** TODO: The removal call did not return. 12/12/2014.
520-
521-
# Remove Extension
522-
Remove-AzureVMAccessExtension -ResourceGroupName $rgname -VMName $vmname -Name $extname -Force;
523-
524-
# Check Extensions in VM
525-
$vm2 = Get-AzureVM -Name $vmname -ResourceGroupName $rgname;
526-
Assert-Null $vm2.Resources;
527-
528-
#>
501+
# *** TODO: The removal call did not return. 12/12/2014
529502
}
530503
finally
531504
{

src/ResourceManager/Compute/Commands.Compute/Commands.Compute.csproj

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@
103103
<SpecificVersion>False</SpecificVersion>
104104
<HintPath>..\..\..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.Desktop.dll</HintPath>
105105
</Reference>
106-
<Reference Include="Microsoft.WindowsAzure.Storage, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
106+
<Reference Include="Microsoft.WindowsAzure.Storage, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
107107
<SpecificVersion>False</SpecificVersion>
108108
<HintPath>..\..\..\packages\WindowsAzure.Storage.4.0.0\lib\net40\Microsoft.WindowsAzure.Storage.dll</HintPath>
109109
</Reference>
@@ -162,6 +162,10 @@
162162
<Compile Include="Images\GetAzureVMImageOfferCommand.cs" />
163163
<Compile Include="Images\GetAzureVMImageCommand.cs" />
164164
<Compile Include="Images\VirtualMachineImageBaseCmdlet.cs" />
165+
<Compile Include="Models\PSAdditionalUnattendContent.cs" />
166+
<Compile Include="Models\PSSshPublicKey.cs" />
167+
<Compile Include="Models\PSVaultCertificate.cs" />
168+
<Compile Include="Models\PSVaultSecretGroup.cs" />
165169
<Compile Include="Models\PSVirtualMachineExtension.cs" />
166170
<Compile Include="Models\PSAvailabilitySet.cs" />
167171
<Compile Include="Models\PSVirtualMachineInstanceView.cs" />

src/ResourceManager/Compute/Commands.Compute/Extension/CustomScript/GetAzureVMCustomScriptExtensionCommand.cs

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -31,40 +31,13 @@ public class GetAzureVMCustomScriptExtensionCommand : VirtualMachineExtensionBas
3131
{
3232
protected const string GetCustomScriptExtensionParamSetName = "GetCustomScriptExtension";
3333

34-
//[Parameter(
35-
// Mandatory = true,
36-
// Position = 0,
37-
// ValueFromPipelineByPropertyName = true,
38-
// HelpMessage = "The resource group name.")]
39-
//[ValidateNotNullOrEmpty]
40-
//public override string ResourceGroupName { get; set; }
41-
42-
//[Alias("ResourceName")]
43-
//[Parameter(
44-
// Mandatory = true,
45-
// Position = 1,
46-
// ValueFromPipelineByPropertyName = true,
47-
// HelpMessage = "The virtual machine name.")]
48-
//[ValidateNotNullOrEmpty]
49-
//public override string VMName { get; set; }
50-
51-
//[Alias("ExtensionName")]
52-
//[Parameter(
53-
// Mandatory = true,
54-
// Position = 2,
55-
// ValueFromPipelineByPropertyName = true,
56-
// HelpMessage = "The extension name.")]
57-
//[ValidateNotNullOrEmpty]
58-
//public override string Name { get; set; }
59-
6034
[Parameter(
6135
Position = 3,
6236
ValueFromPipelineByPropertyName = true,
6337
HelpMessage = "To show the status.")]
6438
[ValidateNotNullOrEmpty]
6539
public SwitchParameter Status { get; set; }
6640

67-
6841
public override void ExecuteCmdlet()
6942
{
7043
base.ExecuteCmdlet();

src/ResourceManager/Compute/Commands.Compute/Extension/CustomScript/SetAzureVMCustomScriptExtensionCommand.cs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public class SetAzureVMCustomScriptExtensionCommand : VirtualMachineExtensionBas
5252
[Alias("HandlerVersion", "Version")]
5353
[Parameter(
5454
Mandatory = false,
55-
Position = 5,
55+
Position = 3,
5656
ValueFromPipelineByPropertyName = true,
5757
HelpMessage = "The type handler version.")]
5858
[ValidateNotNullOrEmpty]
@@ -61,7 +61,7 @@ public class SetAzureVMCustomScriptExtensionCommand : VirtualMachineExtensionBas
6161
[Parameter(
6262
ParameterSetName = SetCustomScriptExtensionByContainerBlobsParamSetName,
6363
Mandatory = true,
64-
Position = 2,
64+
Position = 4,
6565
ValueFromPipelineByPropertyName = true,
6666
HelpMessage = "The Name of the Container.")]
6767
[ValidateNotNullOrEmpty]
@@ -70,7 +70,7 @@ public class SetAzureVMCustomScriptExtensionCommand : VirtualMachineExtensionBas
7070
[Parameter(
7171
ParameterSetName = SetCustomScriptExtensionByContainerBlobsParamSetName,
7272
Mandatory = true,
73-
Position = 3,
73+
Position = 5,
7474
ValueFromPipelineByPropertyName = true,
7575
HelpMessage = "The Blob Files in the Container.")]
7676
[ValidateNotNullOrEmpty]
@@ -79,7 +79,7 @@ public class SetAzureVMCustomScriptExtensionCommand : VirtualMachineExtensionBas
7979
[Parameter(
8080
ParameterSetName = SetCustomScriptExtensionByContainerBlobsParamSetName,
8181
Mandatory = false,
82-
Position = 4,
82+
Position = 6,
8383
ValueFromPipelineByPropertyName = true,
8484
HelpMessage = "The Storage Account Name.")]
8585
[ValidateNotNullOrEmpty]
@@ -88,7 +88,7 @@ public class SetAzureVMCustomScriptExtensionCommand : VirtualMachineExtensionBas
8888
[Parameter(
8989
ParameterSetName = SetCustomScriptExtensionByContainerBlobsParamSetName,
9090
Mandatory = false,
91-
Position = 5,
91+
Position = 7,
9292
ValueFromPipelineByPropertyName = true,
9393
HelpMessage = "The Storage Endpoint Suffix.")]
9494
[ValidateNotNullOrEmpty]
@@ -97,7 +97,7 @@ public class SetAzureVMCustomScriptExtensionCommand : VirtualMachineExtensionBas
9797
[Parameter(
9898
ParameterSetName = SetCustomScriptExtensionByContainerBlobsParamSetName,
9999
Mandatory = false,
100-
Position = 6,
100+
Position = 8,
101101
ValueFromPipelineByPropertyName = true,
102102
HelpMessage = "The Storage Account Key.")]
103103
[ValidateNotNullOrEmpty]
@@ -106,7 +106,7 @@ public class SetAzureVMCustomScriptExtensionCommand : VirtualMachineExtensionBas
106106
[Parameter(
107107
ParameterSetName = SetCustomScriptExtensionByUrisParamSetName,
108108
Mandatory = false,
109-
Position = 2,
109+
Position = 4,
110110
ValueFromPipelineByPropertyName = true,
111111
HelpMessage = "The File URIs.")]
112112
[ValidateNotNullOrEmpty]
@@ -115,13 +115,13 @@ public class SetAzureVMCustomScriptExtensionCommand : VirtualMachineExtensionBas
115115
[Parameter(
116116
ParameterSetName = SetCustomScriptExtensionByContainerBlobsParamSetName,
117117
Mandatory = false,
118-
Position = 7,
118+
Position = 9,
119119
ValueFromPipelineByPropertyName = true,
120120
HelpMessage = "The Run File to Execute in PowerShell on the VM.")]
121121
[Parameter(
122122
ParameterSetName = SetCustomScriptExtensionByUrisParamSetName,
123123
Mandatory = true,
124-
Position = 3,
124+
Position = 5,
125125
ValueFromPipelineByPropertyName = true,
126126
HelpMessage = "The Run File to Execute in PowerShell on the VM.")]
127127
[ValidateNotNullOrEmpty]
@@ -131,20 +131,20 @@ public class SetAzureVMCustomScriptExtensionCommand : VirtualMachineExtensionBas
131131
[Parameter(
132132
ParameterSetName = SetCustomScriptExtensionByContainerBlobsParamSetName,
133133
Mandatory = false,
134-
Position = 8,
134+
Position = 10,
135135
ValueFromPipelineByPropertyName = true,
136136
HelpMessage = "The Argument String for the Run File.")]
137137
[Parameter(
138138
ParameterSetName = SetCustomScriptExtensionByUrisParamSetName,
139139
Mandatory = false,
140-
Position = 4,
140+
Position = 6,
141141
ValueFromPipelineByPropertyName = true,
142142
HelpMessage = "The Argument String for the Run File.")]
143143
[ValidateNotNullOrEmpty]
144144
public string Argument { get; set; }
145145

146146
[Parameter(
147-
Position = 8,
147+
Position = 11,
148148
ValueFromPipelineByPropertyName = true,
149149
HelpMessage = "The location.")]
150150
[ValidateNotNullOrEmpty]
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
14+
15+
using Microsoft.Azure.Management.Compute.Models;
16+
17+
namespace Microsoft.Azure.Commands.Compute.Models
18+
{
19+
public class PSAdditionalUnattendContent
20+
{
21+
public string ComponentName { get; set; }
22+
23+
public string Content { get; set; }
24+
25+
public string PassName { get; set; }
26+
27+
public string SettingName { get; set; }
28+
}
29+
30+
public static class PSAdditionalUnattendContentConversions
31+
{
32+
public static PSAdditionalUnattendContent ToPSAdditionalUnattendContent(this AdditionalUnattendContent auc)
33+
{
34+
if (auc == null)
35+
{
36+
return null;
37+
}
38+
39+
var result = new PSAdditionalUnattendContent
40+
{
41+
ComponentName = auc.ComponentName,
42+
Content = auc.Content,
43+
PassName = auc.PassName,
44+
SettingName = auc.SettingName,
45+
};
46+
47+
return result;
48+
}
49+
50+
public static AdditionalUnattendContent ToAdditionalUnattendContent(this PSAdditionalUnattendContent psauc)
51+
{
52+
if (psauc == null)
53+
{
54+
return null;
55+
}
56+
57+
var result = new AdditionalUnattendContent
58+
{
59+
ComponentName = psauc.ComponentName,
60+
Content = psauc.Content,
61+
PassName = psauc.PassName,
62+
SettingName = psauc.SettingName,
63+
};
64+
65+
return result;
66+
}
67+
}
68+
}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
14+
15+
using Microsoft.Azure.Management.Compute.Models;
16+
17+
namespace Microsoft.Azure.Commands.Compute.Models
18+
{
19+
public class PSSshPublicKey
20+
{
21+
public string KeyData { get; set; }
22+
23+
public string Path { get; set; }
24+
}
25+
26+
public static class PSSshPublicKeyConversions
27+
{
28+
29+
public static PSSshPublicKey ToPSSshPublicKey(this SshPublicKey spk)
30+
{
31+
if (spk == null)
32+
{
33+
return null;
34+
}
35+
36+
var result = new PSSshPublicKey
37+
{
38+
KeyData = spk.KeyData,
39+
Path = spk.Path,
40+
};
41+
42+
return result;
43+
}
44+
public static SshPublicKey ToSshPublicKey(this PSSshPublicKey psspk)
45+
{
46+
if (psspk == null)
47+
{
48+
return null;
49+
}
50+
51+
var result = new SshPublicKey
52+
{
53+
KeyData = psspk.KeyData,
54+
Path = psspk.Path,
55+
};
56+
57+
return result;
58+
}
59+
60+
}
61+
}

0 commit comments

Comments
 (0)