mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 13:22:48 +00:00
correct behaviour of win_iis when using site_id if site not found (#56567)
* Fixed #47057 * Fix trailing whitespace * Change for review
This commit is contained in:
committed by
Jordan Borean
parent
94566ed79c
commit
4490c0ba51
@@ -0,0 +1,2 @@
|
||||
bugfixes:
|
||||
- "win_iis_website - site_id not used if no sites exist already and creating a new site (https://github.com/ansible/ansible/issues/47057)"
|
||||
@@ -84,7 +84,13 @@ Try {
|
||||
# This is a bug in the New-WebSite commandlet. Apparently there must be at least one site configured in IIS otherwise New-WebSite crashes.
|
||||
# For more details, see http://stackoverflow.com/questions/3573889/ps-c-new-website-blah-throws-index-was-outside-the-bounds-of-the-array
|
||||
$sites_list = get-childitem -Path IIS:\sites
|
||||
if ($null -eq $sites_list) { $site_parameters.ID = 1 }
|
||||
if ($null -eq $sites_list) {
|
||||
if ($site_id) {
|
||||
$site_parameters.ID = $site_id
|
||||
} else {
|
||||
$site_parameters.ID = 1
|
||||
}
|
||||
}
|
||||
|
||||
$site = New-Website @site_parameters -Force
|
||||
$result.changed = $true
|
||||
|
||||
Reference in New Issue
Block a user