mirror of
https://github.com/inspec/inspec
synced 2024-11-23 13:13:22 +00:00
improve code style
This commit is contained in:
parent
5019664d4d
commit
f9501577e4
1 changed files with 13 additions and 2 deletions
|
@ -314,8 +314,19 @@ class WindowsSrv < ServiceManager
|
|||
# check that we got a response
|
||||
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)
|
||||
# detect if service is running
|
||||
if !service['Service']['Status'].nil? && service['Service']['Status'] == 4
|
||||
running = true
|
||||
else
|
||||
running = false
|
||||
end
|
||||
|
||||
# detect if service is enabled
|
||||
if !service['WMI'].nil? && !service['WMI']['StartMode'].nil? && service['WMI']['StartMode'] == 'Auto'
|
||||
enabled = true
|
||||
else
|
||||
enabled = false
|
||||
end
|
||||
|
||||
{
|
||||
name: service['Service']['Name'],
|
||||
|
|
Loading…
Reference in a new issue