Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Verify format of web_app_pool_info output types #14

Open
jborean93 opened this issue Jan 8, 2025 · 4 comments · May be fixed by #19
Open

Verify format of web_app_pool_info output types #14

jborean93 opened this issue Jan 8, 2025 · 4 comments · May be fixed by #19

Comments

@jborean93
Copy link
Collaborator

SUMMARY

The return values of the web_app_pool_info attributes should be in the same format that we accept for web_app_pool. For example the recycling.periodicRestart.time value is returned as a serialized TimeSpan object which is a dictionary with various properties but the web_app_pool module requires the input format like 00:00:05:00.000000. We should make sure that known types like DateTime as converted to the same format we expect. I've not dug too deeply into it but the TimeSpan values are the first ones that jump out, we should check other types are returned in a similar fashion.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

web_app_pool_info

@jborean93
Copy link
Collaborator Author

cc @ronger4

@ronger4
Copy link
Contributor

ronger4 commented Jan 8, 2025

I will investigate further and see if other properties differ in type.
Just to understand,
In the example case you mentioned I should convert TimeSpan to be DateTime object, right?
So, the user will expect the output to be the same as the input that he entered.

@jborean93
Copy link
Collaborator Author

I think it’s still a timespan but I could be wrong but yes the input format of the attributes should align with output value from the _info module.

@ronger4
Copy link
Contributor

ronger4 commented Jan 8, 2025

I investigated further.
Every time attribute representation will differ from the input.
The native IIS is working with timespan hence it only accepts TimeSpan formatting when setting the attribute (trying to set it as dict represented TimeSpan - will fail and it has no property of such)
For example:

"msg": "Failed to clear attribute to Web App Pool TestPool. Attribute: processModel.pingResponseTime.Seconds, Exception: Property processModel.pingResponseTime.Seconds does not exist at path \\\\WIN-Q36ISGBPHBD\\AppPools\\TestPool."
}

The reason that the output in the end is a dictionary formatted timespan and not string format is most probably due to the fact
that during the JSON serialization process in the module, the TimeSpan object is automatically decomposed into a dictionary of its properties. This happens without any explicit conversion logic in the module.

If we want to align it to be a string too, I can convert it manually to string during the handling in the module itself.
It might be the right way since the default representation when trying to fetch from PowerShell terminal is string representation too.

 (Get-Item -LiteralPath IIS:\AppPools\testron).recycling.periodicRestart


memory         : 0
privateMemory  : 0
requests       : 0
time           : 1.05:00:00

The advantage of the way of how it is handled now is that the output is more readable with the dictionary representation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants