-
Notifications
You must be signed in to change notification settings - Fork 4
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
win_iis_website and win_iis_webbinding - Migrate from community #11
win_iis_website and win_iis_webbinding - Migrate from community #11
Conversation
* Fix up docs after migration * Fix up sanity errors
* fix up sanity ignores * Bump ansible-windows dep * Fix bad change for win_region
* Add Extra Information for IIS parameters. hen configuring a website with custom site parameters, for people who are not familiar with PowerShell or IIS, it would be great to add in the documentation some examples to show them how to use these parameters. * Slight tweaks to the docs Co-authored-by: Emir Madrueno Peregrina <[email protected]>
* Rebalance the test targets * Make sure IIS test removes the service so our httptester works
Co-authored-by: Egor Moor <[email protected]>
Build succeeded. ✔️ ansible-galaxy-importer SUCCESS in 4m 26s |
3e5ab09
to
0a70f48
Compare
Build succeeded. ✔️ ansible-galaxy-importer SUCCESS in 4m 30s |
0a70f48
to
7179b56
Compare
Build succeeded. ✔️ ansible-galaxy-importer SUCCESS in 4m 36s |
7179b56
to
d96bd0e
Compare
Build succeeded. ✔️ ansible-galaxy-importer SUCCESS in 10m 28s |
d96bd0e
to
965182d
Compare
Build succeeded. ✔️ ansible-galaxy-importer SUCCESS in 4m 57s |
965182d
to
270beb4
Compare
Build succeeded. ✔️ ansible-galaxy-importer SUCCESS in 3m 22s |
270beb4
to
ae67968
Compare
Build succeeded. ✔️ ansible-galaxy-importer SUCCESS in 4m 17s |
ae67968
to
7a0c42a
Compare
Build succeeded. ✔️ ansible-galaxy-importer SUCCESS in 3m 58s |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a pretty large PR. I think we should try and slim it down a bit so we aren't holding up the other PRs.
Let's just focus on getting the bare minimum here of the website
and website_info
module without the parameters
or bindings
option implemented. We can focus completely on the simpler options and slowly add back in the other features in a subsequent PR where we can focus more on the UX and what they would look like.
port = @{ type = 'int' } | ||
hostname = @{ type = 'str' } | ||
protocol = @{ type = 'str' ; default = 'http' ; choices = @('http', 'https') } | ||
ssl_flags = @{ type = 'str' ; default = '0' ; choices = @('0', '1', '2', '3') } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these flags representing some more human friendly value. It's hard to tell what each number means without having to look it up.
# Custom site Parameters from string where properties are separated by a pipe and property name/values by colon. | ||
# Ex. "foo:1|bar:2" | ||
$parameters = $module.Params.parameters | ||
if ($null -ne $parameters) { | ||
$parameters = @($parameters -split '\|' | ForEach-Object { | ||
return , ($_ -split "\:", 2) | ||
}) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should remove this format entirely, it was written at a time when modules didn't accept a dictionary. Instead we should do something similar to web_app_pool
's attributes
option which accepts a dictionary value. We probably need to talk a bit more about trying to align this behavour so the option name stays the same and see if we can try and share the code for getting/setting/comparing the values in a module util.
$module.Result.changed = $false | ||
|
||
if ($check_mode) { | ||
Write-Output "in check mode" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will cause warnings and potentially errors as the output will be returned back to ansible which expects just a json string.
# Add site | ||
If (($state -ne 'absent') -and (-not $site)) { | ||
If (-not $physical_path) { | ||
$module.FailJson("missing required arguments: physical_path $($_.Exception.Message)") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no exception here so this can become:
$module.FailJson("missing required arguments: physical_path $($_.Exception.Message)") | |
$module.FailJson("missing required arguments: physical_path") |
$module.FailJson("missing required arguments: physical_path $($_.Exception.Message)") | ||
} | ||
ElseIf (-not (Test-Path -LiteralPath $physical_path)) { | ||
$module.FailJson("specified folder must already exist: physical_path $($_.Exception.Message)") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same thing here
$module.FailJson("specified folder must already exist: physical_path $($_.Exception.Message)") | |
$module.FailJson("specified folder must already exist: physical_path") |
# Change Physical Path if needed | ||
if ($physical_path) { | ||
If (-not (Test-Path -LiteralPath $physical_path)) { | ||
$module.FailJson("specified folder must already exist: physical_path $($_.Exception.Message)") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$module.FailJson("specified folder must already exist: physical_path $($_.Exception.Message)") | |
$module.FailJson("specified folder must already exist: physical_path") |
$user_bindings = if ($Module.Params.bindings.add) { $Module.Params.bindings.add } | ||
elseif ($Module.Params.bindings.remove) { $Module.Params.bindings.remove } | ||
elseif ($Module.Params.bindings.set) { $Module.Params.bindings.set } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This logic doesn't sound right to me. It seems like you want to check if set
is present and use if, otherwise you need to check both add and remove together to add and remove accordingly.
$module.FailJson("SSLFlags can only be set for https protocol") | ||
} | ||
# Validate certificate details if provided | ||
If ($_.certificate_hash -and $_.operation -ne 'remove') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think $_.operation
is defined here.
# Validate certificate details if provided | ||
If ($_.certificate_hash -and $_.operation -ne 'remove') { | ||
If ($_.protocol -ne 'https') { | ||
$module.FailJson("You can only provide a certificate thumbprint when protocol is set to https") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$module.FailJson("You can only provide a certificate thumbprint when protocol is set to https") | |
$module.FailJson("You can only provide a certificate thumbprint when protocol is set to https") |
} | ||
} | ||
Catch { | ||
$module.FailJson("$($module.Result) - $($_.Exception.Message)") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$module.FailJson("$($module.Result) - $($_.Exception.Message)") | |
$module.FailJson("$($module.Result) - $($_.Exception.Message)", $_) |
Closing as we migrated just the |
SUMMARY
ISSUE TYPE
COMPONENT NAME
ADDITIONAL INFORMATION