mirror of
https://github.com/inspec/inspec
synced 2024-11-26 22:50:36 +00:00
improve output of ntp resource for single value arrays
This commit is contained in:
parent
0adf3314af
commit
672f03a0dd
1 changed files with 11 additions and 1 deletions
|
@ -4,6 +4,13 @@
|
|||
|
||||
require 'utils/simpleconfig'
|
||||
|
||||
# Usage:
|
||||
#
|
||||
# describe ntp_conf do
|
||||
# its('server') { should_not eq nil }
|
||||
# its('restrict') { should include '-4 default kod notrap nomodify nopeer noquery'}
|
||||
# end
|
||||
|
||||
class NtpConf < Vulcano.resource(1)
|
||||
name 'ntp_conf'
|
||||
|
||||
|
@ -21,7 +28,10 @@ class NtpConf < Vulcano.resource(1)
|
|||
|
||||
def method_missing(name)
|
||||
@params || read_content
|
||||
@params[name.to_s]
|
||||
param = @params[name.to_s]
|
||||
# extract first value if we have only one value in array
|
||||
param = param[0] if !param.nil? && param.length == 1
|
||||
param
|
||||
end
|
||||
|
||||
def read_content
|
||||
|
|
Loading…
Reference in a new issue