mirror of
https://github.com/inspec/inspec
synced 2025-02-17 06:28:40 +00:00
bugfix: catch cases, where no service is available
This commit is contained in:
parent
04ca75b6e7
commit
5019664d4d
1 changed files with 5 additions and 2 deletions
|
@ -311,8 +311,11 @@ class WindowsSrv < ServiceManager
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
service['Service']['Status'] == 4 ? (running = true) : (running = false)
|
# check that we got a response
|
||||||
service['WMI']['StartMode'] == 'Auto' ? (enabled = true) : (enabled = false)
|
return nil if service.nil? || service['Service'].nil?
|
||||||
|
|
||||||
|
(!service['Service'].nil? && !service['Service']['Status'].nil? && service['Service']['Status'] == 4) ? (running = true) : (running = false)
|
||||||
|
(!service['WMI'].nil? && !service['WMI']['StartMode'].nil? && service['WMI']['StartMode'] == 'Auto') ? (enabled = true) : (enabled = false)
|
||||||
|
|
||||||
{
|
{
|
||||||
name: service['Service']['Name'],
|
name: service['Service']['Name'],
|
||||||
|
|
Loading…
Add table
Reference in a new issue