Sha256: b1034624f289be3172a3c97db940139b1c81c14a041084b69689ab6073827fcb

Contents?: true

Size: 1.21 KB

Versions: 22

Compression:

Stored size: 1.21 KB

Contents

module Puppet::Parser::Functions
  newfunction(:pdbresourcequery_all, :type => :rvalue, :doc => "\
    Perform a PuppetDB resource query

    The first argument is the resource query.
    Second argument is optional but allows you to specify the item you want
    from the returned hash.

    Returns an array of hashes or array of strings if second argument is provided.

    Examples:
    # Return an array of hashes describing all files that are owned by root.
    $ret = pdbresourcequery_all(
      ['and',
        ['=','type','File'],
        ['=',['parameter','owner'],'root']])

    # Return an array of host names having those resources
    $ret = pdbresourcequery_all(
      ['and',
        ['=','type','File'],
        ['=',['parameter','owner'],'root']], 'certname')") do |args|

    raise(Puppet::ParseError, "pdbresourcequery_all(): Wrong number of arguments " +
                "given (#{args.size} for 1 or 2)") if args.size < 1 or args.size > 2

    Puppet::Parser::Functions.autoloader.load(:pdbquery) unless Puppet::Parser::Functions.autoloader.loaded?(:pdbquery)

    resq, info = args
    ret = function_pdbquery(['resources', resq])
    if info then
      ret.collect {|x| x[info]}
    else
      ret
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
ruby-puppetdb-1.6.1 lib/puppet/parser/functions/pdbresourcequery_all.rb
ruby-puppetdb-1.6.0 lib/puppet/parser/functions/pdbresourcequery_all.rb
ruby-puppetdb-1.5.3 lib/puppet/parser/functions/pdbresourcequery_all.rb
ruby-puppetdb-1.5.2 lib/puppet/parser/functions/pdbresourcequery_all.rb
ruby-puppetdb-1.5.1 lib/puppet/parser/functions/pdbresourcequery_all.rb
ruby-puppetdb-1.5.0 lib/puppet/parser/functions/pdbresourcequery_all.rb
ruby-puppetdb-1.4.0 lib/puppet/parser/functions/pdbresourcequery_all.rb
ruby-puppetdb-1.3.3 lib/puppet/parser/functions/pdbresourcequery_all.rb
ruby-puppetdb-1.3.2 lib/puppet/parser/functions/pdbresourcequery_all.rb
ruby-puppetdb-1.3.1 lib/puppet/parser/functions/pdbresourcequery_all.rb
ruby-puppetdb-1.3.0 lib/puppet/parser/functions/pdbresourcequery_all.rb
ruby-puppetdb-1.2.0 lib/puppet/parser/functions/pdbresourcequery_all.rb
ruby-puppetdb-1.1.1 lib/puppet/parser/functions/pdbresourcequery_all.rb
ruby-puppetdb-1.1.0 lib/puppet/parser/functions/pdbresourcequery_all.rb
ruby-puppetdb-1.0.4 lib/puppet/parser/functions/pdbresourcequery_all.rb
ruby-puppetdb-1.0.3 lib/puppet/parser/functions/pdbresourcequery_all.rb
ruby-puppetdb-1.0.2 lib/puppet/parser/functions/pdbresourcequery_all.rb
ruby-puppetdb-1.0.1 lib/puppet/parser/functions/pdbresourcequery_all.rb
ruby-puppetdb-1.0.0 lib/puppet/parser/functions/pdbresourcequery_all.rb
ruby-puppetdb-1.0.0.pre5 lib/puppet/parser/functions/pdbresourcequery_all.rb