improve output of ntp resource for single value arrays

This commit is contained in:
Christoph Hartmann 2015-09-05 19:20:05 +02:00 committed by Dominik Richter
parent 0adf3314af
commit 672f03a0dd

View file

@ -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