Skip to content

Commit

Permalink
Manual Corrections One
Browse files Browse the repository at this point in the history
  • Loading branch information
David Swan committed Jun 4, 2018
1 parent 2471c23 commit 9cf1fbe
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions lib/puppet/provider/hocon_setting/ruby.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ def type=(value)
end

def value
val = conf_file.has_value?(setting) ? # rubocop:disable Style/PreferredHashMethods
conf_object.get_value(setting).unwrapped : []
val = conf_file.has_value?(setting) ? conf_object.get_value(setting).unwrapped : [] # rubocop:disable Style/PreferredHashMethods
unless val.is_a?(Array)
val = if resource[:type] == 'array_element'
# If the current value of the target setting is not an array,
Expand Down Expand Up @@ -129,7 +128,7 @@ def remove_value(value_to_remove)
conf_file_modified
end

def set_value(value_to_set)
def set_value(value_to_set) # rubocop:disable Style/AccessorMethodName
if resource[:type] == 'array_element'
tmp_val = []
val = value
Expand Down
4 changes: 2 additions & 2 deletions lib/puppet/type/hocon_setting.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
newparam(:path, namevar: true) do
desc 'The file Puppet will ensure contains the specified setting.'
validate do |value|
unless (Puppet.features.posix? && value =~ /^\//) || (Puppet.features.microsoft_windows? && (value =~ /^.:\// || value =~ /^\/\/[^\/]+\/[^\/]+/))
unless (Puppet.features.posix? && value =~ %r{^\/}) || (Puppet.features.microsoft_windows? && (value =~ %r{^.:\/} || value =~ %r{^\/\/[^\/]+\/[^\/]+}))
raise(Puppet::Error, "File paths must be fully qualified, not '#{value}'")
end
end
Expand Down Expand Up @@ -64,7 +64,7 @@
unless value.is_a?(Hash)
raise "Type specified as 'hash' but was #{value.class}"
end
when 'array_element', nil
# when 'array_element', nil
# Do nothing, we'll figure it out on our own
else
raise "Type was specified as #{@resource[:type]}, but should have been one of 'boolean', 'string', 'text', 'number', 'array', or 'hash'"
Expand Down

0 comments on commit 9cf1fbe

Please sign in to comment.