mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Fix problem with 'restarted' state not restarting the apppool when it is in running state (#1451)
* Fix problem with 'restarted' state not restarting the apppool when it is in running state * Implemeting code review comments Comment from previous commit “You basically want to start the pool if it's stopped and requested state is started or restarted, otherwise if requested state is restarted, restart it.” This commit implements the behavior stated in the PR comment
This commit is contained in:
parent
d0ada049f2
commit
e93f7241be
1 changed files with 10 additions and 2 deletions
|
@ -90,10 +90,18 @@ try {
|
|||
Stop-WebAppPool -Name $name -ErrorAction Stop
|
||||
$result.changed = $TRUE
|
||||
}
|
||||
if ((($state -eq 'started') -and ($pool.State -eq 'Stopped')) -or ($state -eq 'restarted')) {
|
||||
if ((($state -eq 'started') -and ($pool.State -eq 'Stopped'))) {
|
||||
Start-WebAppPool -Name $name -ErrorAction Stop
|
||||
$result.changed = $TRUE
|
||||
}
|
||||
if ($state -eq 'restarted') {
|
||||
switch ($pool.State)
|
||||
{
|
||||
'Stopped' { Start-WebAppPool -Name $name -ErrorAction Stop }
|
||||
default { Restart-WebAppPool -Name $name -ErrorAction Stop }
|
||||
}
|
||||
$result.changed = $TRUE
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
Fail-Json $result $_.Exception.Message
|
||||
|
|
Loading…
Reference in a new issue