class Object

Public Instance Methods

check() click to toggle source
# File lib/puppet-lint/plugins/check_file_source_rights.rb, line 20
def check
  resource_indexes.each do |r|
    next unless r[:type].value == 'file'
    source_t = token_attr(r, 'source')
    next if source_t.empty?

    check_attr(r, 'owner', source_t[0])
    check_attr(r, 'group', source_t[0])
    check_attr(r, 'mode', source_t[0])
  end
end
check_attr(resource, name, source_t) click to toggle source
# File lib/puppet-lint/plugins/check_file_source_rights.rb, line 9
def check_attr(resource, name, source_t)
  if token_attr(resource, name).empty?
    notify :warning, {
      :message => "file with source missing #{name}",
      :line    => source_t.line,
      :column  => source_t.column,
      :token   => source_t,
    }
  end
end
token_attr(resource, name) click to toggle source
# File lib/puppet-lint/plugins/check_file_source_rights.rb, line 2
def token_attr(resource, name)
  resource[:tokens].select do |t|
      t.type == :NAME && t.value == name && \
        t.next_code_token && t.next_code_token.type == :FARROW
  end
end