mirror of
https://github.com/inspec/inspec
synced 2024-11-26 22:50:36 +00:00
return nil, if we haven't received a value
This commit is contained in:
parent
8dd5ad2979
commit
f165e51e1f
1 changed files with 10 additions and 2 deletions
|
@ -53,8 +53,16 @@ module Serverspec
|
|||
|
||||
# extract variable value
|
||||
result = target.match(/[=]{1}\s*(?<value>.*)/)
|
||||
val = result[:value]
|
||||
val = val.to_i if val.match(/^\d+$/)
|
||||
|
||||
if !result.nil?
|
||||
val = result[:value]
|
||||
val = val.to_i if val.match(/^\d+$/)
|
||||
else
|
||||
# TODO we may need to return skip or failure if the
|
||||
# requested value is not available
|
||||
val = nil
|
||||
end
|
||||
|
||||
val
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue