Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion plugins/modules/web_app_pool_info.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@ function Get-AppPoolInfo ($name) {
$attribute_name = $attribute.Name
if ($attribute_name -notlike "*password*") {
$attribute_value = $attribute_parent.$attribute_name

# Convert TimeSpan to string if applicable
if ($attribute_value -is [TimeSpan]) {
$attribute_value = $attribute_value.ToString("c") # Converts to hh:mm:ss or d.hh:mm:ss format
}
if ($element -eq "attributes") {
$appPoolInfoDict.attributes.Add($attribute_name, $attribute_value)
}
Expand All @@ -75,6 +78,10 @@ function Get-AppPoolInfo ($name) {
foreach ($attribute in $pool.recycling.periodicRestart.Attributes) {
$attribute_name = $attribute.Name
$attribute_value = $pool.recycling.periodicRestart.$attribute_name
# Convert TimeSpan to string if applicable
if ($attribute_value -is [TimeSpan]) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is there this second check, shouldn't the above be setting it properly?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It handles the priodicRestart section.
As priodicRestart sectioned handled separately (as it's the only 3rd layer attribute in the dict).
This is an original code which I didn't change.
This attribute needs to be date handled too and not handled in the loop above.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok makes sense. I think it would have been preferable to just recursively go through the dict at the end and check all types but if this works then that may be overkill.

$attribute_value = $attribute_value.ToString("c") # Converts to hh:mm:ss or d.hh:mm:ss format
}
$appPoolInfoDict.attributes.recycling.periodicRestart.Add($attribute_name, $attribute_value)
}
return $appPoolInfoDict
Expand Down
142 changes: 23 additions & 119 deletions plugins/modules/web_app_pool_info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,39 +52,19 @@ RETURN:
"CLRConfigFile": "",
"applicationPoolSid": "S-1-5-82-3006700770-424185619-1745488364-794895919-4004696415",
"autoStart": true,
"enable32BitAppOnWin64": false,
"enableConfigurationOverride": true,
"managedPipelineMode": "Integrated",
"managedRuntimeLoader": "webengine4.dll",
"managedRuntimeVersion": "v4.0",
"name": "DefaultAppPool",
"passAnonymousToken": true,
"queueLength": 1000,
"startMode": "OnDemand",
"state": "Started"
"cpu": {
"action": "NoAction",
"limit": 0,
"numaNodeAffinityMode": "Soft",
"numaNodeAssignment": "MostAvailableMemory",
"processorGroup": 0,
"resetInterval": {
"Days": 0,
"Hours": 0,
"Milliseconds": 0,
"Minutes": 5,
"Seconds": 0,
"Ticks": 3000000000,
"TotalDays": 0.003472222222222222,
"TotalHours": 0.08333333333333333,
"TotalMilliseconds": 300000,
"TotalMinutes": 5,
"TotalSeconds": 300
},
"resetInterval": "00:05:00",
"smpAffinitized": false,
"smpProcessorAffinityMask": 4294967295,
"smpProcessorAffinityMask2": 4294967295
},
"enable32BitAppOnWin64": false,
"enableConfigurationOverride": true,
"failure": {
"autoShutdownExe": "",
"autoShutdownParams": "",
Expand All @@ -93,124 +73,48 @@ RETURN:
"orphanActionParams": "",
"orphanWorkerProcess": false,
"rapidFailProtection": true,
"rapidFailProtectionInterval": {
"Days": 0,
"Hours": 0,
"Milliseconds": 0,
"Minutes": 5,
"Seconds": 0,
"Ticks": 3000000000,
"TotalDays": 0.003472222222222222,
"TotalHours": 0.08333333333333333,
"TotalMilliseconds": 300000,
"TotalMinutes": 5,
"TotalSeconds": 300
},
"rapidFailProtectionInterval": "00:05:00",
"rapidFailProtectionMaxCrashes": 5
},
"managedPipelineMode": "Integrated",
"managedRuntimeLoader": "webengine4.dll",
"managedRuntimeVersion": "v4.0",
"name": "DefaultAppPool",
"passAnonymousToken": true,
"processModel": {
"identityType": "ApplicationPoolIdentity",
"idleTimeout": {
"Days": 0,
"Hours": 0,
"Milliseconds": 0,
"Minutes": 20,
"Seconds": 0,
"Ticks": 12000000000,
"TotalDays": 0.013888888888888888,
"TotalHours": 0.3333333333333333,
"TotalMilliseconds": 1200000,
"TotalMinutes": 20,
"TotalSeconds": 1200
},
"idleTimeout": "00:20:00",
"idleTimeoutAction": "Terminate",
"loadUserProfile": false,
"logEventOnProcessModel": "IdleTimeout",
"logonType": "LogonBatch",
"manualGroupMembership": false,
"maxProcesses": 1,
"pingInterval": {
"Days": 0,
"Hours": 0,
"Milliseconds": 0,
"Minutes": 0,
"Seconds": 30,
"Ticks": 300000000,
"TotalDays": 0.0003472222222222222,
"TotalHours": 0.008333333333333333,
"TotalMilliseconds": 30000,
"TotalMinutes": 0.5,
"TotalSeconds": 30
},
"pingResponseTime": {
"Days": 0,
"Hours": 0,
"Milliseconds": 0,
"Minutes": 1,
"Seconds": 30,
"Ticks": 900000000,
"TotalDays": 0.0010416666666666667,
"TotalHours": 0.024999999999999998,
"TotalMilliseconds": 90000,
"TotalMinutes": 1.5,
"TotalSeconds": 90
},
"pingInterval": "00:00:30",
"pingResponseTime": "00:01:30",
"pingingEnabled": true,
"requestQueueDelegatorIdentity": "",
"setProfileEnvironment": true,
"shutdownTimeLimit": {
"Days": 0,
"Hours": 0,
"Milliseconds": 0,
"Minutes": 1,
"Seconds": 30,
"Ticks": 900000000,
"TotalDays": 0.0010416666666666667,
"TotalHours": 0.024999999999999998,
"TotalMilliseconds": 90000,
"TotalMinutes": 1.5,
"TotalSeconds": 90
},
"startupTimeLimit": {
"Days": 0,
"Hours": 0,
"Milliseconds": 0,
"Minutes": 1,
"Seconds": 30,
"Ticks": 900000000,
"TotalDays": 0.0010416666666666667,
"TotalHours": 0.024999999999999998,
"TotalMilliseconds": 90000,
"TotalMinutes": 1.5,
"TotalSeconds": 90
},
"shutdownTimeLimit": "00:01:30",
"startupTimeLimit": "00:01:30",
"userName": ""
},
"queueLength": 1000,
"recycling": {
"disallowOverlappingRotation": false,
"disallowRotationOnConfigChange": false,
"logEventOnRecycle": "Time,Requests,Schedule,Memory,IsapiUnhealthy,OnDemand,ConfigChange,PrivateMemory",
"periodicRestart": {
"memory": 0,
"privateMemory": 0,
"requests": 0,
"time": {
"Days": 1,
"Hours": 5,
"Milliseconds": 0,
"Minutes": 0,
"Seconds": 0,
"Ticks": 1044000000000,
"TotalDays": 1.2083333333333333,
"TotalHours": 29,
"TotalMilliseconds": 104400000,
"TotalMinutes": 1740,
"TotalSeconds": 104400
}
"memory": 0,
"privateMemory": 0,
"requests": 0,
"time": "1.05:00:00"
}
}
},
"startMode": "OnDemand",
"state": "Started"
},
"Name": "DefaultAppPool"
"name": "DefaultAppPool"
}
]'
contains:
Expand Down
3 changes: 1 addition & 2 deletions tests/integration/targets/web_app_pool/tasks/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,7 @@
- change_complex_attributes is changed
- web_app_pool_changed_info_complex_again.app_pools[0].attributes.queueLength == 500
- web_app_pool_changed_info_complex_again.app_pools[0].attributes.recycling.periodicRestart.requests == 10
- web_app_pool_changed_info_complex_again.app_pools[0].attributes.recycling.periodicRestart.time.TotalSeconds == 300
- web_app_pool_changed_info_complex_again.app_pools[0].attributes.processModel.pingResponseTime.TotalSeconds == 180
- web_app_pool_changed_info_complex_again.app_pools[0].attributes.recycling.periodicRestart.time == "00:05:00"

- name: change more complex variables again
web_app_pool:
Expand Down
3 changes: 1 addition & 2 deletions tests/integration/targets/web_app_pool_info/tasks/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
- app_pool_info.app_pools[0].attributes.managedPipelineMode == "Classic"
- app_pool_info.app_pools[0].attributes.processModel.identityType == "LocalSystem"
- app_pool_info.app_pools[0].attributes.processModel.loadUserProfile == true
- app_pool_info.app_pools[0].attributes.recycling.periodicRestart.time.Days == 1
- app_pool_info.app_pools[0].attributes.recycling.periodicRestart.time.Hours == 5
- app_pool_info.app_pools[0].attributes.recycling.periodicRestart.time == "1.05:00:00"

- name: Get info of a none existent app pool
web_app_pool_info:
Expand Down
Loading