Skip to content

Commit 84aca93

Browse files
authored
Revert "[MaintenanceService] Added Support for InGuestPatch maintenance scope. (#15827)"
This reverts commit 7219731.
1 parent cbba6dc commit 84aca93

17 files changed

+1072
-2551
lines changed

src/Maintenance/Maintenance.Test/Maintenance.Test.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
</PropertyGroup>
1212

1313
<ItemGroup>
14-
<PackageReference Include="Microsoft.Azure.Management.Maintenance" Version="1.4.0-preview" />
14+
<PackageReference Include="Microsoft.Azure.Management.Maintenance" Version="1.3.0" />
1515
</ItemGroup>
1616

1717
<ItemGroup>

src/Maintenance/Maintenance.Test/ScenarioTests/Common.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,17 +64,17 @@ function Get-ProviderLocation($provider)
6464

6565
if ($location -eq $null)
6666
{
67-
return "eastus2euap"
67+
return "westus"
6868
} else
6969
{
7070
return $location.Locations[0].ToLower() -replace '\s',''
7171
}
7272
}
7373

74-
return "eastus2euap"
74+
return "westus"
7575
}
7676

77-
return "eastus2euap"
77+
return "westus"
7878
}
7979

8080
<#

src/Maintenance/Maintenance.Test/ScenarioTests/MaintenanceTests.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,6 @@ public void TestMaintenanceConfiguration()
3939
TestController.NewInstance.RunPowerShellTest(_logger, "Test-AzMaintenanceConfiguration");
4040
}
4141

42-
[Fact]
43-
[Trait(Category.AcceptanceType, Category.CheckIn)]
44-
public void TestMaintenanceConfigurationInGuestPatch()
45-
{
46-
TestController.NewInstance.RunPowerShellTest(_logger, "Test-AzMaintenanceConfigurationInGuestPatch");
47-
}
48-
4942
[Fact]
5043
[Trait(Category.AcceptanceType, Category.CheckIn)]
5144
public void TestConfigurationAssignment()

src/Maintenance/Maintenance.Test/ScenarioTests/MaintenanceTests.ps1

Lines changed: 18 additions & 148 deletions
Large diffs are not rendered by default.

src/Maintenance/Maintenance.Test/SessionRecords/Microsoft.Azure.Commands.Maintenance.Test.ScenarioTests.MaintenanceTests/TestConfigurationAssignment.json

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

src/Maintenance/Maintenance.Test/SessionRecords/Microsoft.Azure.Commands.Maintenance.Test.ScenarioTests.MaintenanceTests/TestMaintenanceConfiguration.json

Lines changed: 528 additions & 232 deletions
Large diffs are not rendered by default.

src/Maintenance/Maintenance.Test/SessionRecords/Microsoft.Azure.Commands.Maintenance.Test.ScenarioTests.MaintenanceTests/TestMaintenanceConfigurationInGuestPatch.json

Lines changed: 0 additions & 1398 deletions
This file was deleted.

src/Maintenance/Maintenance.Test/SessionRecords/Microsoft.Azure.Commands.Maintenance.Test.ScenarioTests.MaintenanceTests/TestMaintenanceUpdate.json

Lines changed: 252 additions & 138 deletions
Large diffs are not rendered by default.

src/Maintenance/Maintenance.Test/SessionRecords/Microsoft.Azure.Commands.Maintenance.Test.ScenarioTests.MaintenanceTests/TestPublicMaintenanceConfiguration.json

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

src/Maintenance/Maintenance.sln

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
12
Microsoft Visual Studio Solution File, Format Version 12.00
2-
# Visual Studio Version 16
3-
VisualStudioVersion = 16.0.31328.270
3+
# Visual Studio 15
4+
VisualStudioVersion = 15.0.27703.2042
45
MinimumVisualStudioVersion = 10.0.40219.1
56
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Maintenance", "Maintenance\Maintenance.csproj", "{0E11B67A-1257-40D0-BD33-8315759FDB01}"
67
EndProject
@@ -38,10 +39,6 @@ Global
3839
{142D7B0B-388A-4CEB-A228-7F6D423C5C2E}.Debug|Any CPU.Build.0 = Debug|Any CPU
3940
{142D7B0B-388A-4CEB-A228-7F6D423C5C2E}.Release|Any CPU.ActiveCfg = Release|Any CPU
4041
{142D7B0B-388A-4CEB-A228-7F6D423C5C2E}.Release|Any CPU.Build.0 = Release|Any CPU
41-
{6BD6B80A-06AF-4B5B-9230-69CCFC6C8D64}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
42-
{6BD6B80A-06AF-4B5B-9230-69CCFC6C8D64}.Debug|Any CPU.Build.0 = Debug|Any CPU
43-
{6BD6B80A-06AF-4B5B-9230-69CCFC6C8D64}.Release|Any CPU.ActiveCfg = Release|Any CPU
44-
{6BD6B80A-06AF-4B5B-9230-69CCFC6C8D64}.Release|Any CPU.Build.0 = Release|Any CPU
4542
{FF81DC73-B8EC-4082-8841-4FBF2B16E7CE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
4643
{FF81DC73-B8EC-4082-8841-4FBF2B16E7CE}.Debug|Any CPU.Build.0 = Debug|Any CPU
4744
{FF81DC73-B8EC-4082-8841-4FBF2B16E7CE}.Release|Any CPU.ActiveCfg = Release|Any CPU

src/Maintenance/Maintenance/ChangeLog.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
-->
2020

2121
## Upcoming Release
22-
* Added Guest patch maintenance support.
2322

2423
## Version 1.1.1
2524
* Bumped API version to stable 2021-05-01.

src/Maintenance/Maintenance/Maintenance.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
<ItemGroup>
1414
<PackageReference Include="AutoMapper" Version="6.2.2" />
15-
<PackageReference Include="Microsoft.Azure.Management.Maintenance" Version="1.4.0-preview" />
15+
<PackageReference Include="Microsoft.Azure.Management.Maintenance" Version="1.3.0" />
1616
</ItemGroup>
1717

1818
<ItemGroup>

src/Maintenance/Maintenance/MaintenanceConfiguration/MaintenanceConfigurationCreateOrUpdateMethod.cs

Lines changed: 0 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters;
1717
using Microsoft.Azure.Management.Maintenance;
1818
using Microsoft.Azure.Management.Maintenance.Models;
19-
using Newtonsoft.Json;
2019
using System;
2120
using System.Collections;
2221
using System.Collections.Generic;
@@ -86,74 +85,6 @@ public override void ExecuteCmdlet()
8685
{
8786
configuration.Visibility = this.Visibility;
8887
}
89-
90-
if (this.InstallPatchRebootSetting != null)
91-
{
92-
configuration.InstallPatches = configuration.InstallPatches ?? new InputPatchConfiguration();
93-
configuration.InstallPatches.RebootSetting = this.InstallPatchRebootSetting;
94-
}
95-
96-
if (this.WindowParameterClassificationToInclude != null)
97-
{
98-
configuration.InstallPatches = configuration.InstallPatches ?? new InputPatchConfiguration();
99-
configuration.InstallPatches.WindowsParameters = configuration.InstallPatches.WindowsParameters ?? new InputWindowsParameters();
100-
configuration.InstallPatches.WindowsParameters.ClassificationsToInclude = this.WindowParameterClassificationToInclude.ToList();
101-
}
102-
103-
if (this.WindowParameterExcludeKbRequiringReboot.HasValue)
104-
{
105-
configuration.InstallPatches = configuration.InstallPatches ?? new InputPatchConfiguration();
106-
configuration.InstallPatches.WindowsParameters = configuration.InstallPatches.WindowsParameters ?? new InputWindowsParameters();
107-
configuration.InstallPatches.WindowsParameters.ExcludeKbsRequiringReboot = this.WindowParameterExcludeKbRequiringReboot;
108-
}
109-
110-
if (this.WindowParameterKbNumberToExclude != null)
111-
{
112-
configuration.InstallPatches = configuration.InstallPatches ?? new InputPatchConfiguration();
113-
configuration.InstallPatches.WindowsParameters = configuration.InstallPatches.WindowsParameters ?? new InputWindowsParameters();
114-
configuration.InstallPatches.WindowsParameters.KbNumbersToExclude = this.WindowParameterKbNumberToExclude.ToList();
115-
}
116-
117-
if (this.WindowParameterKbNumberToInclude != null)
118-
{
119-
configuration.InstallPatches = configuration.InstallPatches ?? new InputPatchConfiguration();
120-
configuration.InstallPatches.WindowsParameters = configuration.InstallPatches.WindowsParameters ?? new InputWindowsParameters();
121-
configuration.InstallPatches.WindowsParameters.KbNumbersToInclude = this.WindowParameterKbNumberToInclude.ToList();
122-
}
123-
124-
if (this.LinuxParameterClassificationToInclude!= null)
125-
{
126-
configuration.InstallPatches = configuration.InstallPatches ?? new InputPatchConfiguration();
127-
configuration.InstallPatches.LinuxParameters = configuration.InstallPatches.LinuxParameters ?? new InputLinuxParameters();
128-
configuration.InstallPatches.LinuxParameters.ClassificationsToInclude = this.LinuxParameterClassificationToInclude.ToList();
129-
}
130-
131-
if (this.LinuxParameterPackageNameMaskToExclude != null)
132-
{
133-
configuration.InstallPatches = configuration.InstallPatches ?? new InputPatchConfiguration();
134-
configuration.InstallPatches.LinuxParameters = configuration.InstallPatches.LinuxParameters ?? new InputLinuxParameters();
135-
configuration.InstallPatches.LinuxParameters.PackageNameMasksToExclude= this.LinuxParameterPackageNameMaskToExclude.ToList();
136-
}
137-
138-
if (this.LinuxParameterPackageNameMaskToInclude != null)
139-
{
140-
configuration.InstallPatches = configuration.InstallPatches ?? new InputPatchConfiguration();
141-
configuration.InstallPatches.LinuxParameters = configuration.InstallPatches.LinuxParameters ?? new InputLinuxParameters();
142-
configuration.InstallPatches.LinuxParameters.PackageNameMasksToInclude= this.LinuxParameterPackageNameMaskToInclude.ToList();
143-
}
144-
145-
if (this.PreTask != null)
146-
{
147-
configuration.InstallPatches = configuration.InstallPatches ?? new InputPatchConfiguration();
148-
configuration.InstallPatches.PreTasks = JsonConvert.DeserializeObject<List<TaskProperties>>(this.PreTask);
149-
}
150-
151-
if (this.PostTask != null)
152-
{
153-
configuration.InstallPatches = configuration.InstallPatches ?? new InputPatchConfiguration();
154-
configuration.InstallPatches.PreTasks = JsonConvert.DeserializeObject<List<TaskProperties>>(this.PostTask);
155-
}
156-
15788
var result = MaintenanceConfigurationsClient.CreateOrUpdate(resourceGroupName, resourceName, configuration);
15889
var psObject = new PSMaintenanceConfiguration();
15990
MaintenanceAutomationAutoMapperProfile.Mapper.Map<MaintenanceConfiguration, PSMaintenanceConfiguration>(result, psObject);
@@ -232,55 +163,6 @@ public override void ExecuteCmdlet()
232163
HelpMessage = "The Recurrence interval.")]
233164
public string RecurEvery { get; set; }
234165

235-
[Parameter(
236-
Mandatory = false,
237-
HelpMessage = "List of packages to include during vm patch operation")]
238-
public HashSet<string> LinuxParameterPackageNameMaskToInclude { get; set; }
239-
240-
[Parameter(
241-
Mandatory = false,
242-
HelpMessage = "List of packages to exclude during vm patch operation")]
243-
public HashSet<string> LinuxParameterPackageNameMaskToExclude { get; set; }
244-
245-
[Parameter(
246-
Mandatory = false,
247-
HelpMessage = "List of linux patch classifications")]
248-
public HashSet<string> LinuxParameterClassificationToInclude { get; set; }
249-
250-
[Parameter(
251-
Mandatory = false,
252-
HelpMessage = "List of KBs to include during vm patch operation")]
253-
public HashSet<string> WindowParameterKbNumberToInclude { get; set; }
254-
255-
[Parameter(
256-
Mandatory = false,
257-
HelpMessage = "List of KBs to exclude during vm patch operationn")]
258-
public HashSet<string> WindowParameterKbNumberToExclude { get; set; }
259-
260-
[Parameter(
261-
Mandatory = false,
262-
HelpMessage = "List of windows patch classification")]
263-
public HashSet<string> WindowParameterClassificationToInclude { get; set; }
264-
265-
[Parameter(
266-
Mandatory = false,
267-
HelpMessage = "Exclude KBs which require reboot")]
268-
public bool? WindowParameterExcludeKbRequiringReboot { get; set; }
269-
270-
[Parameter(
271-
Mandatory = false,
272-
HelpMessage = "List of tasks executed before schedule. e.g. [{'source' :'runbook', 'taskScope': 'Global', 'parameters': { 'arg1': 'value1'}}]")]
273-
public string PreTask { get; set; }
274-
275-
[Parameter(
276-
Mandatory = false,
277-
HelpMessage = "List of tasks executed after schedule. [{'source' :'runbook', 'taskScope': 'Resource', 'parameters': { 'arg1': 'value1'}}]")]
278-
public string PostTask { get; set; }
279-
280-
[Parameter(
281-
Mandatory = false,
282-
HelpMessage = "Install Patch Reboot Option. Allowed values Never, IfRequired, Always")]
283-
public string InstallPatchRebootSetting { get; set; }
284166

285167
[Parameter(Mandatory = false, HelpMessage = "Run cmdlet in the background")]
286168
public SwitchParameter AsJob { get; set; }

src/Maintenance/Maintenance/MaintenanceConfiguration/MaintenanceConfigurationGetMethod.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,7 @@ public override void ExecuteCmdlet()
4040
if (!string.IsNullOrEmpty(resourceGroupName) && !string.IsNullOrEmpty(name))
4141
{
4242
var result = MaintenanceConfigurationsClient.Get(resourceGroupName, name);
43-
PSMaintenanceConfiguration psMaintenanceConfiguration = new PSMaintenanceConfiguration();
44-
MaintenanceAutomationAutoMapperProfile.Mapper.Map<MaintenanceConfiguration, PSMaintenanceConfiguration>(result, psMaintenanceConfiguration);
45-
WriteObject(psMaintenanceConfiguration);
43+
WriteObject(result);
4644
}
4745

4846
else

src/Maintenance/Maintenance/Models/MaintenanceAutoMapperProfile.cs

Lines changed: 4 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
// ----------------------------------------------------------------------------------
1414

1515
using AutoMapper;
16-
using System.Collections.Generic;
17-
using System.Linq;
1816
using FROM = Microsoft.Azure.Management.Maintenance.Models;
1917
using TO = Microsoft.Azure.Commands.Maintenance.Models;
2018

@@ -52,81 +50,16 @@ private static void Initialize()
5250
var config = new MapperConfiguration(cfg =>
5351
{
5452
cfg.CreateMap<FROM.ApplyUpdate, TO.PSApplyUpdate>();
55-
cfg.CreateMap<TO.PSApplyUpdate, FROM.ApplyUpdate>()
56-
.ForMember(src => src.SystemData, s => s.Ignore());
53+
cfg.CreateMap<TO.PSApplyUpdate, FROM.ApplyUpdate>();
5754
cfg.CreateMap<FROM.ConfigurationAssignment, TO.PSConfigurationAssignment>();
58-
cfg.CreateMap<TO.PSConfigurationAssignment, FROM.ConfigurationAssignment>()
59-
.ForMember(src => src.SystemData, s => s.Ignore());
60-
cfg.CreateMap<FROM.MaintenanceConfiguration, TO.PSMaintenanceConfiguration>()
61-
.ForMember(dest => dest.InstallPatchRebootSetting, opt => opt.MapFrom(src => src.InstallPatches.RebootSetting))
62-
.ForMember(dest => dest.LinuxParameterClassificationToInclude, opt => opt.MapFrom(src => src.InstallPatches.LinuxParameters.ClassificationsToInclude))
63-
.ForMember(dest => dest.LinuxParameterPackageNameMaskToExclude, opt => opt.MapFrom(src => src.InstallPatches.LinuxParameters.PackageNameMasksToExclude))
64-
.ForMember(dest => dest.LinuxParameterPackageNameMaskToInclude, opt => opt.MapFrom(src => src.InstallPatches.LinuxParameters.PackageNameMasksToInclude))
65-
.ForMember(dest => dest.WindowParameterClassificationToInclude, opt => opt.MapFrom(src => src.InstallPatches.WindowsParameters.ClassificationsToInclude))
66-
.ForMember(dest => dest.WindowParameterExcludeKbRequiringReboot, opt => opt.MapFrom(src => src.InstallPatches.WindowsParameters.ExcludeKbsRequiringReboot))
67-
.ForMember(dest => dest.WindowParameterKbNumberToExclude, opt => opt.MapFrom(src => src.InstallPatches.WindowsParameters.KbNumbersToExclude))
68-
.ForMember(dest => dest.WindowParameterKbNumberToInclude, opt => opt.MapFrom(src => src.InstallPatches.WindowsParameters.KbNumbersToInclude))
69-
.ForMember(dest => dest.PreTask, opt => opt.MapFrom(src => src.InstallPatches.PreTasks))
70-
.ForMember(dest => dest.PostTask, opt => opt.MapFrom(src => src.InstallPatches.PostTasks))
71-
.ForMember(dest => dest.InstallPatchRebootSetting, opt => opt.MapFrom(src => src.InstallPatches.RebootSetting))
72-
.ForSourceMember(src => src.SystemData, s => s.Ignore())
73-
.ForSourceMember(src => src.InstallPatches, s => s.Ignore())
74-
.ForPath(dst => dst.PostTask, s => s.Ignore())
75-
.ForPath(dst => dst.PreTask, s => s.Ignore())
76-
.AfterMap((src, dst) => {
77-
if (src?.InstallPatches?.PreTasks?.Any() ?? false)
78-
{
79-
dst.PreTask = Newtonsoft.Json.JsonConvert.SerializeObject(src.InstallPatches.PreTasks);
80-
}
81-
if (src?.InstallPatches?.PostTasks?.Any() ?? false)
82-
{
83-
dst.PostTask = Newtonsoft.Json.JsonConvert.SerializeObject(src.InstallPatches.PostTasks);
84-
}
85-
});
86-
cfg.CreateMap<TO.PSMaintenanceConfiguration, FROM.MaintenanceConfiguration>()
87-
.ForPath(dest => dest.InstallPatches.LinuxParameters.ClassificationsToInclude, src => src.MapFrom(o => o.LinuxParameterClassificationToInclude))
88-
.ForPath(dest => dest.InstallPatches.LinuxParameters.PackageNameMasksToInclude, src => src.MapFrom(o => o.LinuxParameterPackageNameMaskToInclude))
89-
.ForPath(dest => dest.InstallPatches.LinuxParameters.PackageNameMasksToExclude, src => src.MapFrom(o => o.LinuxParameterPackageNameMaskToExclude))
90-
.ForPath(dest => dest.InstallPatches.WindowsParameters.ClassificationsToInclude, src => src.MapFrom(o => o.WindowParameterClassificationToInclude))
91-
.ForPath(dest => dest.InstallPatches.WindowsParameters.ExcludeKbsRequiringReboot, src => src.MapFrom(o => o.WindowParameterExcludeKbRequiringReboot))
92-
.ForPath(dest => dest.InstallPatches.WindowsParameters.KbNumbersToExclude, src => src.MapFrom(o => o.WindowParameterKbNumberToExclude))
93-
.ForPath(dest => dest.InstallPatches.WindowsParameters.KbNumbersToInclude, src => src.MapFrom(o => o.WindowParameterKbNumberToInclude))
94-
.AfterMap((src, dst) => {
95-
if (string.IsNullOrEmpty(src.InstallPatchRebootSetting) &&
96-
string.IsNullOrEmpty(src.PostTask) &&
97-
string.IsNullOrEmpty(src.PreTask) &&
98-
!src.WindowParameterExcludeKbRequiringReboot.HasValue &&
99-
IsEmpty(src.LinuxParameterClassificationToInclude) &&
100-
IsEmpty(src.LinuxParameterPackageNameMaskToExclude) &&
101-
IsEmpty(src.LinuxParameterPackageNameMaskToInclude) &&
102-
IsEmpty(src.WindowParameterClassificationToInclude) &&
103-
IsEmpty(src.WindowParameterKbNumberToExclude) &&
104-
IsEmpty(src.WindowParameterKbNumberToInclude))
105-
{
106-
dst.InstallPatches = null;
107-
}
108-
else
109-
{
110-
if(string.IsNullOrEmpty(src.PreTask))
111-
{
112-
dst.InstallPatches.PreTasks = Newtonsoft.Json.JsonConvert.DeserializeObject<List<FROM.TaskProperties>>(src.PreTask);
113-
dst.InstallPatches.PostTasks = Newtonsoft.Json.JsonConvert.DeserializeObject<List<FROM.TaskProperties>>(src.PostTask);
114-
}
115-
}
116-
})
117-
.ForPath(dest => dest.InstallPatches.PostTasks, s => s.Ignore())
118-
.ForPath(dest => dest.InstallPatches.PreTasks, s => s.Ignore())
119-
.ForMember(dest => dest.SystemData, s => s.Ignore());
55+
cfg.CreateMap<TO.PSConfigurationAssignment, FROM.ConfigurationAssignment>();
56+
cfg.CreateMap<FROM.MaintenanceConfiguration, TO.PSMaintenanceConfiguration>();
57+
cfg.CreateMap<TO.PSMaintenanceConfiguration, FROM.MaintenanceConfiguration>();
12058
cfg.CreateMap<FROM.Update, TO.PSUpdate>();
12159
cfg.CreateMap<TO.PSUpdate, FROM.Update>();
12260

12361
});
12462
_mapper = config.CreateMapper();
125-
config.AssertConfigurationIsValid();
126-
}
127-
public static bool IsEmpty<T>(IEnumerable<T> collection)
128-
{
129-
return !(collection != null && collection.Any());
13063
}
13164
}
13265
}

src/Maintenance/Maintenance/Models/PSMaintenanceConfiguration.cs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,6 @@ public partial class PSMaintenanceConfiguration
3333
public string Timezone { get; set; }
3434
public string Visibility { get; set; }
3535
public string RecurEvery { get; set; }
36-
public HashSet<string> LinuxParameterClassificationToInclude { get; set; }
37-
public HashSet<string> LinuxParameterPackageNameMaskToExclude { get; set; }
38-
public HashSet<string> LinuxParameterPackageNameMaskToInclude { get; set; }
39-
public HashSet<string> WindowParameterKbNumberToInclude { get; set; }
40-
public HashSet<string> WindowParameterKbNumberToExclude { get; set; }
41-
public HashSet<string> WindowParameterClassificationToInclude { get; set; }
42-
public bool? WindowParameterExcludeKbRequiringReboot { get; set; }
43-
public string PreTask { get; set; }
44-
public string PostTask { get; set; }
45-
public string InstallPatchRebootSetting { get; set; }
4636

4737
}
4838
}

0 commit comments

Comments
 (0)