mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-24 05:40:23 -07: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:
parent
94566ed79c
commit
4490c0ba51
2 changed files with 9 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue