зеркало из https://github.com/Azure/vdc.git
fixed Get-Exception cmdlet invocation
This commit is contained in:
Родитель
b98130c5cc
Коммит
546f201162
|
@ -265,10 +265,9 @@
|
|||
]
|
||||
},
|
||||
{
|
||||
"name": "[concat('nestedDeploymentUM-Win',variables('tagPatching')[copyindex()].name)]",
|
||||
"type": "Microsoft.Resources/deployments",
|
||||
"comments": "Using nested deployment because a nested resource cannot have a copy function",
|
||||
"apiVersion": "2017-05-10",
|
||||
"name": "[concat(parameters('automationAccountName'), '/windows-um-',subscription().displayName,'-',variables('tagPatching')[copyindex()].name)]",
|
||||
"type": "Microsoft.Automation/automationAccounts/softwareUpdateConfigurations",
|
||||
"apiVersion": "2017-05-15-preview",
|
||||
"copy": {
|
||||
"count": "[length(variables('tagPatching'))]",
|
||||
"name": "patchingWinTagLoop"
|
||||
|
@ -277,108 +276,74 @@
|
|||
"[parameters('automationAccountName')]"
|
||||
],
|
||||
"properties": {
|
||||
"mode": "Incremental",
|
||||
"template": {
|
||||
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
|
||||
"contentVersion": "1.0.0.0",
|
||||
"parameters": {},
|
||||
"variables": {},
|
||||
"resources": [
|
||||
{
|
||||
"name": "[concat(parameters('automationAccountName'), '/windows-um-',subscription().displayName,'-',variables('tagPatching')[copyindex()].name)]",
|
||||
"type": "Microsoft.Automation/automationAccounts/softwareUpdateConfigurations",
|
||||
"apiVersion": "2017-05-15-preview",
|
||||
"properties": {
|
||||
"updateConfiguration": {
|
||||
"operatingSystem": "Windows",
|
||||
"windows": {
|
||||
"includedUpdateClassifications": "Unclassified, Critical, Security, UpdateRollup, FeaturePack, ServicePack, Definition, Tools, Updates",
|
||||
"rebootSetting": "Always"
|
||||
},
|
||||
"duration": "PT3H",
|
||||
"targets": {
|
||||
"azureQueries": [
|
||||
{
|
||||
"scope": [
|
||||
"[subscription().id]"
|
||||
],
|
||||
"locations": [],
|
||||
"tagSettings": {
|
||||
"tags": {
|
||||
"UpdateManagement": [
|
||||
"[variables('tagPatching')[copyindex()].name]"
|
||||
]
|
||||
},
|
||||
"filterOperator": "Any"
|
||||
}
|
||||
}
|
||||
"updateConfiguration": {
|
||||
"operatingSystem": "Windows",
|
||||
"windows": {
|
||||
"includedUpdateClassifications": "Unclassified, Critical, Security, UpdateRollup, FeaturePack, ServicePack, Definition, Tools, Updates",
|
||||
"rebootSetting": "Always"
|
||||
},
|
||||
"duration": "PT3H",
|
||||
"targets": {
|
||||
"azureQueries": [
|
||||
{
|
||||
"scope": [
|
||||
"[subscription().id]"
|
||||
],
|
||||
"locations": [],
|
||||
"tagSettings": {
|
||||
"tags": {
|
||||
"UpdateManagement": [
|
||||
"[variables('tagPatching')[copyindex()].name]"
|
||||
]
|
||||
}
|
||||
},
|
||||
"scheduleInfo": "[variables('tagPatching')[copyindex()].schedule]"
|
||||
},
|
||||
"filterOperator": "Any"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"scheduleInfo": "[variables('tagPatching')[copyindex()].schedule]"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "[concat('nestedDeploymentUM-Linux',variables('tagPatching')[copyindex()].name)]",
|
||||
"type": "Microsoft.Resources/deployments",
|
||||
"comments": "Using nested deployment because a nested resource cannot have a copy function",
|
||||
"apiVersion": "2017-05-10",
|
||||
"name": "[concat(parameters('automationAccountName'), '/linux-um-',subscription().displayName,'-',variables('tagPatching')[copyindex()].name)]",
|
||||
"type": "Microsoft.Automation/automationAccounts/softwareUpdateConfigurations",
|
||||
"apiVersion": "2017-05-15-preview",
|
||||
"copy": {
|
||||
"count": "[length(variables('tagPatching'))]",
|
||||
"name": "patchingLinuxTagLoop"
|
||||
},
|
||||
"dependsOn": [
|
||||
"[parameters('automationAccountName')]",
|
||||
"patchingWinTagLoop"
|
||||
],
|
||||
"properties": {
|
||||
"mode": "Incremental",
|
||||
"template": {
|
||||
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
|
||||
"contentVersion": "1.0.0.0",
|
||||
"parameters": {},
|
||||
"variables": {},
|
||||
"resources": [
|
||||
{
|
||||
"name": "[concat(parameters('automationAccountName'), '/linux-um-',subscription().displayName,'-',variables('tagPatching')[copyindex()].name)]",
|
||||
"type": "Microsoft.Automation/automationAccounts/softwareUpdateConfigurations",
|
||||
"apiVersion": "2017-05-15-preview",
|
||||
"properties": {
|
||||
"updateConfiguration": {
|
||||
"operatingSystem": "Linux",
|
||||
"linux": {
|
||||
"includedPackageClassifications": "Unclassified, Critical, Security, Other",
|
||||
"rebootSetting": "Always"
|
||||
},
|
||||
"duration": "PT3H",
|
||||
"targets": {
|
||||
"azureQueries": [
|
||||
{
|
||||
"scope": [
|
||||
"[subscription().id]"
|
||||
],
|
||||
"locations": [],
|
||||
"tagSettings": {
|
||||
"tags": {
|
||||
"UpdateManagement": [
|
||||
"[variables('tagPatching')[copyindex()].name]"
|
||||
]
|
||||
},
|
||||
"filterOperator": "Any"
|
||||
}
|
||||
}
|
||||
"updateConfiguration": {
|
||||
"operatingSystem": "Linux",
|
||||
"linux": {
|
||||
"includedPackageClassifications": "Unclassified, Critical, Security, Other",
|
||||
"rebootSetting": "Always"
|
||||
},
|
||||
"duration": "PT3H",
|
||||
"targets": {
|
||||
"azureQueries": [
|
||||
{
|
||||
"scope": [
|
||||
"[subscription().id]"
|
||||
],
|
||||
"locations": [],
|
||||
"tagSettings": {
|
||||
"tags": {
|
||||
"UpdateManagement": [
|
||||
"[variables('tagPatching')[copyindex()].name]"
|
||||
]
|
||||
}
|
||||
},
|
||||
"scheduleInfo": "[variables('tagPatching')[copyindex()].schedule]"
|
||||
},
|
||||
"filterOperator": "Any"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"scheduleInfo": "[variables('tagPatching')[copyindex()].schedule]"
|
||||
}
|
||||
}
|
||||
],
|
||||
|
|
|
@ -356,12 +356,12 @@ Function Get-Exception {
|
|||
elseif($errorObject -is [System.Management.Automation.ErrorRecord] `
|
||||
-and $null -ne $errorObject.Exception) {
|
||||
return `
|
||||
GetException $errorObject.Exception;
|
||||
Get-Exception $errorObject.Exception;
|
||||
}
|
||||
elseif($errorObject -is [System.Exception] `
|
||||
-and $null -ne $errorObject.ErrorRecord) {
|
||||
return `
|
||||
GetException $errorObject.ErrorRecord;
|
||||
Get-Exception $errorObject.ErrorRecord;
|
||||
}
|
||||
else {
|
||||
return $errorObject.Message;
|
||||
|
|
|
@ -83,7 +83,7 @@ Class ModuleStateDataService: IModuleStateDataService {
|
|||
|
||||
# If deploymentMapping is null, it means that there is no mapping found
|
||||
if (!$deploymentMapping) {
|
||||
Write-Host "No state information found";
|
||||
Write-Debug "No state information found";
|
||||
return $null;
|
||||
}
|
||||
else {
|
||||
|
@ -92,7 +92,7 @@ Class ModuleStateDataService: IModuleStateDataService {
|
|||
$deploymentMapping.DeploymentName,
|
||||
$deploymentMapping.StateId
|
||||
);
|
||||
Write-Host "Filters: $(ConvertTo-Json $filters)";
|
||||
Write-Debug "Filters: $(ConvertTo-Json $filters)";
|
||||
$resourceState = `
|
||||
$this.stateRepository.GetResourceStateByFilters($filters);
|
||||
|
||||
|
|
|
@ -548,10 +548,13 @@ Class AzureResourceManagerDeploymentService: IDeploymentService {
|
|||
# Adding comma in between array items
|
||||
$formattedResourceIds = $allResourceIds -join ",";
|
||||
|
||||
Write-Debug "Query to execute is: where id in ($formattedResourceIds)";
|
||||
|
||||
$resourceStates = `
|
||||
Start-ExponentialBackoff `
|
||||
-Expression { Search-AzGraph -Query "where id in ($formattedResourceIds)"; }
|
||||
|
||||
|
||||
Write-Debug "Resource states from Resource Graph: $(ConvertTo-Json $resourceStates -Depth 10)"
|
||||
$dataToReturn.ResourceStates = $resourceStates;
|
||||
|
||||
# Let's retrieve deployment outputs
|
||||
|
|
|
@ -57,7 +57,7 @@ Class BlobContainerAuditRepository: IAuditRepository {
|
|||
$temporalFileName = [Guid]::NewGuid();
|
||||
$temporalFilePath = `
|
||||
Join-Path $this.temporalRootPath "$temporalFileName.json"
|
||||
Write-Host "TemporalFilePath is: $temporalFilePath";
|
||||
Write-Debug "TemporalFilePath is: $temporalFilePath";
|
||||
try {
|
||||
|
||||
# Let's create the file contents temporally
|
||||
|
@ -121,7 +121,7 @@ Class BlobContainerAuditRepository: IAuditRepository {
|
|||
$this.mappingsBlobContainerName,
|
||||
$blobName);
|
||||
|
||||
Write-Host "Container name: $($this.mappingsBlobContainerName) and blob name: $blobName";
|
||||
Write-Debug "Container name: $($this.mappingsBlobContainerName) and blob name: $blobName";
|
||||
|
||||
# Set the initial value equals to the
|
||||
# mappingsContent from above, this allows
|
||||
|
@ -287,7 +287,7 @@ Class BlobContainerAuditRepository: IAuditRepository {
|
|||
$temporalFileName = [Guid]::NewGuid();
|
||||
$temporalFilePath = `
|
||||
Join-Path $this.temporalRootPath "$temporalFileName.json";
|
||||
Write-Host "Temporal File Path is $temporalFilePath";
|
||||
Write-Debug "Temporal File Path is $temporalFilePath";
|
||||
|
||||
try {
|
||||
$blobFound = Get-AzStorageBlobContent `
|
||||
|
@ -298,14 +298,14 @@ Class BlobContainerAuditRepository: IAuditRepository {
|
|||
-ErrorAction SilentlyContinue;
|
||||
|
||||
if ($blobFound -eq $null) {
|
||||
Write-Host "Blob not found";
|
||||
Write-Debug "Blob not found. Blob: $blob, Container: $container";
|
||||
return "";
|
||||
}
|
||||
else {
|
||||
$contentJson = `
|
||||
Get-Content $temporalFilePath `
|
||||
-Raw;
|
||||
Write-Host "Content Json is $contentJson";
|
||||
Write-Debug "Content Json is $contentJson";
|
||||
return $contentJson;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -127,7 +127,7 @@ Class BlobContainerStateRepository: IStateRepository {
|
|||
$blobExists = $this.BlobExists(
|
||||
$this.mappingsBlobContainerName,
|
||||
$blobName);
|
||||
Write-Host "Container name: $($this.mappingsBlobContainerName) and blob name: $blobName";
|
||||
Write-Debug "Container name: $($this.mappingsBlobContainerName) and blob name: $blobName";
|
||||
# Set the initial value equals to the
|
||||
# mappingsContent from above, this allows
|
||||
# us to save the initial contents when a
|
||||
|
@ -228,7 +228,7 @@ Class BlobContainerStateRepository: IStateRepository {
|
|||
$this.stateBlobContainerName,
|
||||
$blobName);
|
||||
|
||||
Write-Host "Blob container: $($this.stateBlobContainerName), Blob Name: $blobName";
|
||||
Write-Debug "Blob container: $($this.stateBlobContainerName), Blob Name: $blobName";
|
||||
|
||||
# A non-empty value indicates that a blob exists
|
||||
if (![string]::IsNullOrEmpty($blobFound)) {
|
||||
|
@ -270,12 +270,12 @@ Class BlobContainerStateRepository: IStateRepository {
|
|||
$filters[0];
|
||||
$moduleInstanceName = `
|
||||
$filters[1];
|
||||
Write-Host "archetypeInstanceName: $archetypeInstanceName, moduleInstanceName: $moduleInstanceName";
|
||||
Write-Debug "archetypeInstanceName: $archetypeInstanceName, moduleInstanceName: $moduleInstanceName";
|
||||
|
||||
$blobName = $this.mappingsBlobPath -F `
|
||||
$archetypeInstanceName;
|
||||
|
||||
Write-Host "Blob container: $($this.mappingsBlobContainerName), Blob Name: $blobName";
|
||||
Write-Debug "Blob container: $($this.mappingsBlobContainerName), Blob Name: $blobName";
|
||||
|
||||
# Let's check if the blob exists, if it does,
|
||||
# this function will return the blob contents
|
||||
|
|
Загрузка…
Ссылка в новой задаче