source stringclasses 1
value | repo stringlengths 5 63 | repo_url stringlengths 24 82 | path stringlengths 5 167 | language stringclasses 1
value | license stringclasses 5
values | stars int64 10 51.4k | ref stringclasses 23
values | size_bytes int64 200 258k | text stringlengths 137 258k |
|---|---|---|---|---|---|---|---|---|---|
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/parser/parser_factory.rb | Ruby | apache-2.0 | 7,843 | main | 887 | # frozen_string_literal: true
module Puppet; end
module Puppet::Parser
# The ParserFactory makes selection of parser possible.
# Currently, it is possible to switch between two different parsers:
# * classic_parser, the parser in 3.1
# * eparser, the Expression Based Parser
#
class ParserFactory
# Pro... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/parser/abstract_compiler.rb | Ruby | apache-2.0 | 7,843 | main | 1,204 | # frozen_string_literal: true
module Puppet::Parser::AbstractCompiler
# Returns the catalog for a compilation. Must return a Puppet::Resource::Catalog or fail with an
# error if the specific compiler does not support catalog operations.
#
def catalog
raise Puppet::DevError("Class '#{self.class}' should hav... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/parser/type_loader.rb | Ruby | apache-2.0 | 7,843 | main | 4,368 | # frozen_string_literal: true
require 'find'
require 'forwardable'
require_relative '../../puppet/parser/parser_factory'
class Puppet::Parser::TypeLoader
extend Forwardable
class TypeLoaderError < StandardError; end
# Import manifest files that match a given file glob pattern.
#
# @param pattern [String] ... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/parser/script_compiler.rb | Ruby | apache-2.0 | 7,843 | main | 4,122 | # frozen_string_literal: true
require_relative '../../puppet/loaders'
require_relative '../../puppet/pops'
# A Script "compiler" that does not support catalog operations
#
# The Script compiler is "one shot" - it does not support rechecking if underlying source has changed or
# deal with possible errors in a cached e... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/parser/templatewrapper.rb | Ruby | apache-2.0 | 7,843 | main | 2,876 | # frozen_string_literal: true
require_relative '../../puppet/parser/files'
require 'erb'
require_relative '../../puppet/file_system'
# A simple wrapper for templates, so they don't have full access to
# the scope objects.
#
# @api private
class Puppet::Parser::TemplateWrapper
include Puppet::Util
Puppet::Util.log... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/parser/ast/top_level_construct.rb | Ruby | apache-2.0 | 7,843 | main | 203 | # frozen_string_literal: true
# The base class for AST nodes representing top level things:
# hostclasses, definitions, and nodes.
class Puppet::Parser::AST::TopLevelConstruct < Puppet::Parser::AST
end |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/parser/ast/resource.rb | Ruby | apache-2.0 | 7,843 | main | 2,617 | # frozen_string_literal: true
# Instruction for Resource instantiation.
# Instantiates resources of both native and user defined types.
#
class Puppet::Parser::AST::Resource < Puppet::Parser::AST::Branch
attr_accessor :type, :instances, :exported, :virtual
def initialize(argshash)
Puppet.warn_once('deprecatio... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/parser/ast/node.rb | Ruby | apache-2.0 | 7,843 | main | 626 | # frozen_string_literal: true
class Puppet::Parser::AST::Node < Puppet::Parser::AST::TopLevelConstruct
attr_accessor :names, :context
def initialize(names, context = {})
raise ArgumentError, _("names should be an array") unless names.is_a? Array
if context[:parent]
raise Puppet::DevError, _("Node in... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/parser/ast/hostclass.rb | Ruby | apache-2.0 | 7,843 | main | 704 | # frozen_string_literal: true
require_relative '../../../puppet/parser/ast/top_level_construct'
class Puppet::Parser::AST::Hostclass < Puppet::Parser::AST::TopLevelConstruct
attr_accessor :name, :context
def initialize(name, context = {})
@context = context
@name = name
end
def instantiate(modname)
... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/parser/ast/block_expression.rb | Ruby | apache-2.0 | 7,843 | main | 457 | # frozen_string_literal: true
# Evaluates contained expressions, produce result of the last
#
class Puppet::Parser::AST::BlockExpression < Puppet::Parser::AST::Branch
def evaluate(scope)
@children.reduce(nil) { |_, child| child.safeevaluate(scope) }
end
def sequence_with(other)
Puppet::Parser::AST::Bloc... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/parser/ast/leaf.rb | Ruby | apache-2.0 | 7,843 | main | 2,284 | # frozen_string_literal: true
# The base class for all of the leaves of the parse trees. These
# basically just have types and values. Both of these parameters
# are simple values, not AST objects.
#
class Puppet::Parser::AST::Leaf < Puppet::Parser::AST
attr_accessor :value, :type
# Return our value.
def eval... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/parser/ast/resource_instance.rb | Ruby | apache-2.0 | 7,843 | main | 428 | # frozen_string_literal: true
# A simple container for a parameter for an object. Consists of a
# title and a set of parameters.
#
class Puppet::Parser::AST::ResourceInstance < Puppet::Parser::AST::Branch
attr_accessor :title, :parameters
def initialize(argshash)
Puppet.warn_once('deprecations', 'AST::Resour... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/parser/ast/branch.rb | Ruby | apache-2.0 | 7,843 | main | 598 | # frozen_string_literal: true
# The parent class of all AST objects that contain other AST objects.
# Everything but the really simple objects descend from this. It is
# important to note that Branch objects contain other AST objects only --
# if you want to contain values, use a descendant of the AST::Leaf class.
#
... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/parser/ast/pops_bridge.rb | Ruby | apache-2.0 | 7,843 | main | 9,067 | # frozen_string_literal: true
require_relative '../../../puppet/parser/ast/top_level_construct'
require_relative '../../../puppet/pops'
# The AST::Bridge contains classes that bridges between the new Pops based model
# and the 3.x AST. This is required to be able to reuse the Puppet::Resource::Type which is
# fundame... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/parser/ast/resourceparam.rb | Ruby | apache-2.0 | 7,843 | main | 838 | # frozen_string_literal: true
# The AST object for the parameters inside resource expressions
#
class Puppet::Parser::AST::ResourceParam < Puppet::Parser::AST::Branch
attr_accessor :value, :param, :add
def initialize(argshash)
Puppet.warn_once('deprecations', 'AST::ResourceParam', _('Use of Puppet::Parser::AS... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/parser/resource/param.rb | Ruby | apache-2.0 | 7,843 | main | 842 | # frozen_string_literal: true
# The parameters we stick in Resources.
class Puppet::Parser::Resource::Param
include Puppet::Util
include Puppet::Util::Errors
attr_accessor :name, :value, :source, :add, :file, :line
def initialize(name: nil, value: nil, source: nil, line: nil, file: nil, add: nil)
@value ... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/parser/compiler/catalog_validator.rb | Ruby | apache-2.0 | 7,843 | main | 994 | # frozen_string_literal: true
# Abstract class for a catalog validator that can be registered with the compiler to run at
# a certain stage.
class Puppet::Parser::Compiler
class CatalogValidator
PRE_FINISH = :pre_finish
FINAL = :final
# Returns true if the validator should run at the given stage. The de... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/parser/compiler/catalog_validator/relationship_validator.rb | Ruby | apache-2.0 | 7,843 | main | 1,345 | # frozen_string_literal: true
class Puppet::Parser::Compiler
# Validator that asserts relationship metaparameters refer to valid resources
class CatalogValidator::RelationshipValidator < CatalogValidator
def validate
catalog.resources.each do |resource|
next unless resource.is_a?(Puppet::Parser::... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/parser/functions/assert_type.rb | Ruby | apache-2.0 | 7,843 | main | 2,246 | # frozen_string_literal: true
Puppet::Parser::Functions.newfunction(
:assert_type,
:type => :rvalue,
:arity => -3,
:doc => <<~DOC
Returns the given value if it is of the given
[data type](https://puppet.com/docs/puppet/latest/lang_data.html), or
otherwise either raises an error or executes an optio... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/parser/functions/epp.rb | Ruby | apache-2.0 | 7,843 | main | 1,780 | # frozen_string_literal: true
Puppet::Parser::Functions.newfunction(:epp, :type => :rvalue, :arity => -2, :doc =>
"Evaluates an Embedded Puppet (EPP) template file and returns the rendered text
result as a String.
`epp('<MODULE NAME>/<TEMPLATE FILE>', <PARAMETER HASH>)`
The first argument to this function should be ... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/parser/functions/hiera_hash.rb | Ruby | apache-2.0 | 7,843 | main | 4,010 | # frozen_string_literal: true
require 'hiera_puppet'
module Puppet::Parser::Functions
newfunction(
:hiera_hash,
:type => :rvalue,
:arity => -2,
:doc => <<~DOC
Finds all matches of a key throughout the hierarchy and returns them in a merged hash.
If any of the matched hashes share keys, t... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/parser/functions/digest.rb | Ruby | apache-2.0 | 7,843 | main | 386 | # frozen_string_literal: true
require_relative '../../../puppet/util/checksums'
Puppet::Parser::Functions.newfunction(:digest, :type => :rvalue, :arity => 1, :doc => "Returns a hash value from a provided string using the digest_algorithm setting from the Puppet config file.") do |args|
algo = Puppet[:digest_algorith... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/parser/functions/defined.rb | Ruby | apache-2.0 | 7,843 | main | 3,717 | # frozen_string_literal: true
Puppet::Parser::Functions.newfunction(
:defined,
:type => :rvalue,
:arity => -2,
:doc => <<~DOC
Determines whether a given class or resource type is defined and returns a Boolean
value. You can also use `defined` to determine whether a specific resource is defined,
or ... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/parser/functions/inline_template.rb | Ruby | apache-2.0 | 7,843 | main | 1,031 | # frozen_string_literal: true
Puppet::Parser::Functions.newfunction(:inline_template, :type => :rvalue, :arity => -2, :doc =>
"Evaluate a template string and return its value. See
[the templating docs](https://puppet.com/docs/puppet/latest/lang_template.html) for
more information. Note that if multiple template... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/parser/functions/with.rb | Ruby | apache-2.0 | 7,843 | main | 937 | # frozen_string_literal: true
Puppet::Parser::Functions.newfunction(
:with,
:type => :rvalue,
:arity => -1,
:doc => <<~DOC
Call a [lambda](https://puppet.com/docs/puppet/latest/lang_lambdas.html)
with the given arguments and return the result. Since a lambda's scope is
local to the lambda, you can ... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/parser/functions/break.rb | Ruby | apache-2.0 | 7,843 | main | 1,042 | # frozen_string_literal: true
Puppet::Parser::Functions.newfunction(
:break,
:arity => 0,
:doc => <<~DOC
Breaks the innermost iteration as if it encountered an end of input.
This function does not return to the caller.
The signal produced to stop the iteration bubbles up through
the call stack u... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/parser/functions/lookup.rb | Ruby | apache-2.0 | 7,843 | main | 6,751 | # frozen_string_literal: true
module Puppet::Parser::Functions
newfunction(:lookup, :type => :rvalue, :arity => -2, :doc => <<~'ENDHEREDOC') do |_args|
Uses the Puppet lookup system to retrieve a value for a given key. By default,
this returns the first value found (and fails compilation if no values are
... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/parser/functions/sprintf.rb | Ruby | apache-2.0 | 7,843 | main | 2,544 | # frozen_string_literal: true
# Copyright (C) 2009 Thomas Bellman
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, cop... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/parser/functions/contain.rb | Ruby | apache-2.0 | 7,843 | main | 1,424 | # frozen_string_literal: true
# Called within a class definition, establishes a containment
# relationship with another class
Puppet::Parser::Functions.newfunction(
:contain,
:arity => -2,
:doc => "Contain one or more classes inside the current class. If any of
these classes are undeclared, they will be declare... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/parser/functions/scanf.rb | Ruby | apache-2.0 | 7,843 | main | 1,244 | # frozen_string_literal: true
require 'scanf'
Puppet::Parser::Functions.newfunction(
:scanf,
:type => :rvalue,
:arity => 2,
:doc => <<~DOC
Scans a string and returns an array of one or more converted values based on the given format string.
See the documentation of Ruby's String#scanf method for detai... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/parser/functions/each.rb | Ruby | apache-2.0 | 7,843 | main | 3,783 | # frozen_string_literal: true
Puppet::Parser::Functions.newfunction(
:each,
:type => :rvalue,
:arity => -3,
:doc => <<~DOC
Runs a [lambda](https://puppet.com/docs/puppet/latest/lang_lambdas.html)
repeatedly using each value in a data structure, then returns the values unchanged.
This function take... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/parser/functions/type.rb | Ruby | apache-2.0 | 7,843 | main | 1,571 | # frozen_string_literal: true
Puppet::Parser::Functions.newfunction(
:type,
:type => :rvalue,
:arity => -1,
:doc => <<~DOC
Returns the data type of a given value with a given degree of generality.
```puppet
type InferenceFidelity = Enum[generalized, reduced, detailed]
function type(Any $value... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/parser/functions/hiera_array.rb | Ruby | apache-2.0 | 7,843 | main | 3,661 | # frozen_string_literal: true
require 'hiera_puppet'
module Puppet::Parser::Functions
newfunction(
:hiera_array,
:type => :rvalue,
:arity => -2,
:doc => <<~DOC
Finds all matches of a key throughout the hierarchy and returns them as a single flattened
array of unique values. If any of the... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/parser/functions/sha256.rb | Ruby | apache-2.0 | 7,843 | main | 245 | # frozen_string_literal: true
require 'digest/sha2'
Puppet::Parser::Functions.newfunction(:sha256, :type => :rvalue, :arity => 1, :doc => "Returns a SHA256 hash value from a provided string.") do |args|
Digest::SHA256.hexdigest(args[0])
end |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/parser/functions/template.rb | Ruby | apache-2.0 | 7,843 | main | 1,671 | # frozen_string_literal: true
Puppet::Parser::Functions.newfunction(:template, :type => :rvalue, :arity => -2, :doc =>
"Loads an ERB template from a module, evaluates it, and returns the resulting
value as a string.
The argument to this function should be a `<MODULE NAME>/<TEMPLATE FILE>`
reference, which wil... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/parser/functions/match.rb | Ruby | apache-2.0 | 7,843 | main | 1,476 | # frozen_string_literal: true
Puppet::Parser::Functions.newfunction(
:match,
:arity => 2,
:doc => <<~DOC
Matches a regular expression against a string and returns an array containing the match
and any matched capturing groups.
The first argument is a string or array of strings. The second argument i... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/parser/functions/return.rb | Ruby | apache-2.0 | 7,843 | main | 2,919 | # frozen_string_literal: true
Puppet::Parser::Functions.newfunction(
:return,
:arity => -2,
:doc => <<~DOC
Immediately returns the given optional value from a function, class body or user defined type body.
If a value is not given, an `undef` value is returned. This function does not return to the immedi... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/parser/functions/realize.rb | Ruby | apache-2.0 | 7,843 | main | 895 | # frozen_string_literal: true
# This is just syntactic sugar for a collection, although it will generally
# be a good bit faster.
Puppet::Parser::Functions.newfunction(:realize, :arity => -2, :doc => "Make a virtual object real. This is useful
when you want to know the name of the virtual object and don't want t... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/parser/functions/next.rb | Ruby | apache-2.0 | 7,843 | main | 1,458 | # frozen_string_literal: true
Puppet::Parser::Functions.newfunction(
:next,
:arity => -2,
:doc => <<~DOC
Immediately returns the given optional value from a block (lambda), function, class body or user defined type body.
If a value is not given, an `undef` value is returned. This function does not return... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/parser/functions/hiera.rb | Ruby | apache-2.0 | 7,843 | main | 3,898 | # frozen_string_literal: true
require 'hiera_puppet'
module Puppet::Parser::Functions
newfunction(
:hiera,
:type => :rvalue,
:arity => -2,
:doc => <<~DOC
Performs a standard priority lookup of the hierarchy and returns the most specific value
for a given key. The returned value can be an... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/parser/functions/create_resources.rb | Ruby | apache-2.0 | 7,843 | main | 4,459 | # frozen_string_literal: true
Puppet::Parser::Functions.newfunction(:create_resources, :arity => -3, :doc => <<-'ENDHEREDOC') do |args|
Converts a hash into a set of resources and adds them to the catalog.
**Note**: Use this function selectively. It's generally better to write resources in
[Puppet](https... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/parser/functions/lest.rb | Ruby | apache-2.0 | 7,843 | main | 1,371 | # frozen_string_literal: true
Puppet::Parser::Functions.newfunction(
:lest,
:type => :rvalue,
:arity => -2,
:doc => <<~DOC
Call a [lambda](https://puppet.com/docs/puppet/latest/lang_lambdas.html)
(which should accept no arguments) if the argument given to the function is `undef`.
Returns the result... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/parser/functions/strftime.rb | Ruby | apache-2.0 | 7,843 | main | 7,072 | # frozen_string_literal: true
Puppet::Parser::Functions.newfunction(
:strftime,
:type => :rvalue,
:arity => -3,
:doc => <<~DOC
Formats timestamp or timespan according to the directives in the given format string. The directives begins with a percent (%) character.
Any text not listed as a directive wil... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/parser/functions/find_file.rb | Ruby | apache-2.0 | 7,843 | main | 1,087 | # frozen_string_literal: true
Puppet::Parser::Functions.newfunction(
:find_file,
:type => :rvalue,
:arity => -2,
:doc => <<~DOC
Finds an existing file from a module and returns its path.
The argument to this function should be a String as a `<MODULE NAME>/<FILE>`
reference, which will search for `... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/parser/functions/regsubst.rb | Ruby | apache-2.0 | 7,843 | main | 3,009 | # frozen_string_literal: true
# Copyright (C) 2009 Thomas Bellman
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, cop... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/parser/functions/reverse_each.rb | Ruby | apache-2.0 | 7,843 | main | 2,540 | # frozen_string_literal: true
Puppet::Parser::Functions.newfunction(
:reverse_each,
:type => :rvalue,
:arity => -1,
:doc => <<~DOC
Reverses the order of the elements of something that is iterable and optionally runs a
[lambda](https://puppet.com/docs/puppet/latest/lang_lambdas.html) for each
elemen... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/parser/functions/fqdn_rand.rb | Ruby | apache-2.0 | 7,843 | main | 2,220 | # frozen_string_literal: true
require 'digest/md5'
require 'digest/sha2'
Puppet::Parser::Functions.newfunction(:fqdn_rand, :arity => -2, :type => :rvalue, :doc =>
"Usage: `fqdn_rand(MAX, [SEED], [DOWNCASE])`. MAX is required and must be a positive
integer; SEED is optional and may be any number or string; DOWNCAS... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/parser/functions/generate.rb | Ruby | apache-2.0 | 7,843 | main | 1,899 | # frozen_string_literal: true
# Runs an external command and returns the results
Puppet::Parser::Functions.newfunction(:generate, :arity => -2, :type => :rvalue,
:doc => "Calls an external command on the Puppet master and returns
the results of the command. Any argu... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/parser/functions/slice.rb | Ruby | apache-2.0 | 7,843 | main | 1,673 | # frozen_string_literal: true
Puppet::Parser::Functions.newfunction(
:slice,
:type => :rvalue,
:arity => -3,
:doc => <<~DOC
This function takes two mandatory arguments: the first should be an array or hash, and the second specifies
the number of elements to include in each slice.
When the first ar... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/parser/functions/versioncmp.rb | Ruby | apache-2.0 | 7,843 | main | 705 | # frozen_string_literal: true
require_relative '../../../puppet/util/package'
Puppet::Parser::Functions.newfunction(:versioncmp, :type => :rvalue, :arity => 2, :doc =>
"Compares two version numbers.
Prototype:
\$result = versioncmp(a, b)
Where a and b are arbitrary version strings.
This function returns:
* `... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/parser/functions/then.rb | Ruby | apache-2.0 | 7,843 | main | 2,680 | # frozen_string_literal: true
Puppet::Parser::Functions.newfunction(
:then,
:type => :rvalue,
:arity => -2,
:doc => <<~DOC
Call a [lambda](https://puppet.com/docs/puppet/latest/lang_lambdas.html)
with the given argument unless the argument is undef. Return `undef` if argument is
`undef`, and otherw... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/parser/functions/md5.rb | Ruby | apache-2.0 | 7,843 | main | 235 | # frozen_string_literal: true
require 'digest/md5'
Puppet::Parser::Functions.newfunction(:md5, :type => :rvalue, :arity => 1, :doc => "Returns a MD5 hash value from a provided string.") do |args|
Digest::MD5.hexdigest(args[0])
end |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/parser/functions/binary_file.rb | Ruby | apache-2.0 | 7,843 | main | 853 | # frozen_string_literal: true
Puppet::Parser::Functions.newfunction(
:binary_file,
:type => :rvalue,
:arity => 1,
:doc => <<~DOC
Loads a binary file from a module or file system and returns its contents as a Binary.
The argument to this function should be a `<MODULE NAME>/<FILE>`
reference, which ... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/parser/functions/include.rb | Ruby | apache-2.0 | 7,843 | main | 1,903 | # frozen_string_literal: true
# Include the specified classes
Puppet::Parser::Functions.newfunction(:include, :arity => -2, :doc =>
"Declares one or more classes, causing the resources in them to be
evaluated and added to the catalog. Accepts a class name, an array of class
names, or a comma-separated list of class na... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/parser/functions/fail.rb | Ruby | apache-2.0 | 7,843 | main | 352 | # frozen_string_literal: true
Puppet::Parser::Functions.newfunction(
:fail,
:arity => -1,
:doc => <<~DOC
Fail with a parse error. Any parameters will be stringified,
concatenated, and passed to the exception-handler.
DOC
) do |vals|
vals = vals.collect(&:to_s).join(" ") if vals.is_a? Array
raise Pu... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/parser/functions/filter.rb | Ruby | apache-2.0 | 7,843 | main | 3,200 | # frozen_string_literal: true
Puppet::Parser::Functions.newfunction(
:filter,
:type => :rvalue,
:arity => -3,
:doc => <<~DOC
Applies a [lambda](https://puppet.com/docs/puppet/latest/lang_lambdas.html)
to every value in a data structure and returns an array or hash containing any elements
for which ... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/parser/functions/require.rb | Ruby | apache-2.0 | 7,843 | main | 1,668 | # frozen_string_literal: true
# Requires the specified classes
Puppet::Parser::Functions.newfunction(
:require,
:arity => -2,
:doc => "Evaluate one or more classes, adding the required class as a dependency.
The relationship metaparameters work well for specifying relationships
between individual resources, b... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/parser/functions/new.rb | Ruby | apache-2.0 | 7,843 | main | 37,519 | # frozen_string_literal: true
Puppet::Parser::Functions.newfunction(
:new,
:type => :rvalue,
:arity => -1,
:doc => <<~DOC
Creates a new instance/object of a given data type.
This function makes it possible to create new instances of
concrete data types. If a block is given it is called with the
... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/parser/functions/reduce.rb | Ruby | apache-2.0 | 7,843 | main | 5,084 | # frozen_string_literal: true
Puppet::Parser::Functions.newfunction(
:reduce,
:type => :rvalue,
:arity => -3,
:doc => <<~DOC
Applies a [lambda](https://puppet.com/docs/puppet/latest/lang_lambdas.html)
to every value in a data structure from the first argument, carrying over the returned
value of ea... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/parser/functions/inline_epp.rb | Ruby | apache-2.0 | 7,843 | main | 2,282 | # frozen_string_literal: true
Puppet::Parser::Functions.newfunction(:inline_epp, :type => :rvalue, :arity => -2, :doc =>
"Evaluates an Embedded Puppet (EPP) template string and returns the rendered
text result as a String.
`inline_epp('<EPP TEMPLATE STRING>', <PARAMETER HASH>)`
The first argument to this function sh... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/parser/functions/step.rb | Ruby | apache-2.0 | 7,843 | main | 2,707 | # frozen_string_literal: true
Puppet::Parser::Functions.newfunction(
:step,
:type => :rvalue,
:arity => -1,
:doc => <<~DOC
Provides stepping with given interval over elements in an iterable and optionally runs a
[lambda](https://puppet.com/docs/puppet/latest/lang_lambdas.html) for each
element.
... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/parser/functions/hiera_include.rb | Ruby | apache-2.0 | 7,843 | main | 4,121 | # frozen_string_literal: true
require 'hiera_puppet'
module Puppet::Parser::Functions
newfunction(
:hiera_include,
:arity => -2,
:doc => <<~DOC
Assigns classes to a node using an
[array merge lookup](https://puppet.com/docs/hiera/latest/lookup_types.html#array-merge)
that retrieves the... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/parser/functions/map.rb | Ruby | apache-2.0 | 7,843 | main | 2,643 | # frozen_string_literal: true
Puppet::Parser::Functions.newfunction(
:map,
:type => :rvalue,
:arity => -3,
:doc => <<~DOC
Applies a [lambda](https://puppet.com/docs/puppet/latest/lang_lambdas.html)
to every value in a data structure and returns an array containing the results.
This function takes ... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/parser/functions/dig.rb | Ruby | apache-2.0 | 7,843 | main | 1,341 | # frozen_string_literal: true
Puppet::Parser::Functions.newfunction(
:dig,
:type => :rvalue,
:arity => -1,
:doc => <<~DOC
Returns a value for a sequence of given keys/indexes into a structure, such as
an array or hash.
This function is used to "dig into" a complex data structure by
using a sequ... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/parser/functions/tag.rb | Ruby | apache-2.0 | 7,843 | main | 505 | # frozen_string_literal: true
# Tag the current scope with each passed name
Puppet::Parser::Functions.newfunction(:tag, :arity => -2, :doc => "Add the specified tags to the containing class
or definition. All contained objects will then acquire that tag, also.
") do |vals|
if Puppet[:tasks]
raise Puppet::Pa... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/parser/functions/file.rb | Ruby | apache-2.0 | 7,843 | main | 1,137 | # frozen_string_literal: true
require_relative '../../../puppet/file_system'
Puppet::Parser::Functions.newfunction(
:file, :arity => -2, :type => :rvalue,
:doc => "Loads a file from a module and returns its contents as a string.
The argument to this function should be a `<MODULE NAME>/<FILE>`
referenc... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/parser/functions/shellquote.rb | Ruby | apache-2.0 | 7,843 | main | 2,468 | # frozen_string_literal: true
# Copyright (C) 2009 Thomas Bellman
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, cop... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/parser/functions/tagged.rb | Ruby | apache-2.0 | 7,843 | main | 836 | # frozen_string_literal: true
# Test whether a given tag is set. This functions as a big OR -- if any of the specified tags are unset, we return false.
Puppet::Parser::Functions.newfunction(:tagged, :type => :rvalue, :arity => -2, :doc => "A boolean function that
tells you whether the current container is tagged wi... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/parser/functions/sha1.rb | Ruby | apache-2.0 | 7,843 | main | 239 | # frozen_string_literal: true
require 'digest/sha1'
Puppet::Parser::Functions.newfunction(:sha1, :type => :rvalue, :arity => 1, :doc => "Returns a SHA1 hash value from a provided string.") do |args|
Digest::SHA1.hexdigest(args[0])
end |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/parser/functions/split.rb | Ruby | apache-2.0 | 7,843 | main | 876 | # frozen_string_literal: true
module Puppet::Parser::Functions
newfunction(
:split, :type => :rvalue,
:arity => 2,
:doc => "\
Split a string variable into an array using the specified split regexp.
*Example:*
$string = 'v1.v2:v3.v4'
$array_var1 = split($string, ':')
$ar... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/type/package.rb | Ruby | apache-2.0 | 7,843 | main | 25,972 | # coding: utf-8
# frozen_string_literal: true
# Define the different packaging systems. Each package system is implemented
# in a module, which then gets used to individually extend each package object.
# This allows packages to exist on the same machine using different packaging
# systems.
require_relative '../../p... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/type/filebucket.rb | Ruby | apache-2.0 | 7,843 | main | 4,111 | # frozen_string_literal: true
module Puppet
require_relative '../../puppet/file_bucket/dipper'
Type.newtype(:filebucket) do
@doc = <<-EOT
A repository for storing and retrieving file content by cryptographic checksum. Can
be local to each agent node, or centralized on a primary Puppet server. All
... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/type/tidy.rb | Ruby | apache-2.0 | 7,843 | main | 11,457 | # frozen_string_literal: true
require_relative '../../puppet/parameter/boolean'
Puppet::Type.newtype(:tidy) do
require_relative '../../puppet/file_serving/fileset'
require_relative '../../puppet/file_bucket/dipper'
@doc = "Remove unwanted files based on specific criteria. Multiple
criteria are OR'd togeth... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/type/user.rb | Ruby | apache-2.0 | 7,843 | main | 29,540 | # frozen_string_literal: true
require 'etc'
require_relative '../../puppet/parameter/boolean'
require_relative '../../puppet/property/list'
require_relative '../../puppet/property/ordered_list'
require_relative '../../puppet/property/keyvalue'
module Puppet
Type.newtype(:user) do
@doc = "Manage users. This typ... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/type/notify.rb | Ruby | apache-2.0 | 7,843 | main | 1,232 | # frozen_string_literal: true
#
# Simple module for logging messages on the client-side
module Puppet
Type.newtype(:notify) do
@doc = "Sends an arbitrary message, specified as a string, to the agent run-time log. It's important to note that the notify resource type is not idempotent. As a result, notifications ... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/type/schedule.rb | Ruby | apache-2.0 | 7,843 | main | 15,158 | # frozen_string_literal: true
module Puppet
Type.newtype(:schedule) do
@doc = <<-'EOT'
Define schedules for Puppet. Resources can be limited to a schedule by using the
[`schedule`](https://puppet.com/docs/puppet/latest/metaparameter.html#schedule)
metaparameter.
Currently, **schedules ca... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/type/whit.rb | Ruby | apache-2.0 | 7,843 | main | 1,334 | # frozen_string_literal: true
Puppet::Type.newtype(:whit) do
desc "Whits are internal artifacts of Puppet's current implementation, and
Puppet suppresses their appearance in all logs. We make no guarantee of
the whit's continued existence, and it should never be used in an actual
manifest. Use the `ancho... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/type/file.rb | Ruby | apache-2.0 | 7,843 | main | 40,745 | # coding: utf-8
# frozen_string_literal: true
require 'digest/md5'
require 'cgi'
require 'etc'
require 'uri'
require 'fileutils'
require 'pathname'
require_relative '../../puppet/parameter/boolean'
require_relative '../../puppet/util/diff'
require_relative '../../puppet/util/checksums'
require_relative '../../puppet/u... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/type/group.rb | Ruby | apache-2.0 | 7,843 | main | 8,092 | # frozen_string_literal: true
require 'etc'
require_relative '../../puppet/property/keyvalue'
require_relative '../../puppet/parameter/boolean'
module Puppet
Type.newtype(:group) do
@doc = "Manage groups. On most platforms this can only create groups.
Group membership must be managed on individual users.
... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/type/exec.rb | Ruby | apache-2.0 | 7,843 | main | 25,761 | # frozen_string_literal: true
module Puppet
Type.newtype(:exec) do
include Puppet::Util::Execution
require 'timeout'
@doc = "Executes external commands.
Any command in an `exec` resource **must** be able to run multiple times
without causing harm --- that is, it must be *idempotent*. There ... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/type/stage.rb | Ruby | apache-2.0 | 7,843 | main | 894 | # frozen_string_literal: true
Puppet::Type.newtype(:stage) do
desc "A resource type for creating new run stages. Once a stage is available,
classes can be assigned to it by declaring them with the resource-like syntax
and using
[the `stage` metaparameter](https://puppet.com/docs/puppet/latest/metaparame... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/type/component.rb | Ruby | apache-2.0 | 7,843 | main | 2,206 | # frozen_string_literal: true
require_relative '../../puppet'
require_relative '../../puppet/type'
require_relative '../../puppet/transaction'
Puppet::Type.newtype(:component) do
include Enumerable
newparam(:name) do
desc "The name of the component. Generally optional."
isnamevar
end
# Override how... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/type/resources.rb | Ruby | apache-2.0 | 7,843 | main | 6,109 | # frozen_string_literal: true
require_relative '../../puppet'
require_relative '../../puppet/parameter/boolean'
Puppet::Type.newtype(:resources) do
@doc = "This is a metatype that can manage other resource types. Any
metaparams specified here will be passed on to any generated resources,
so you can purge u... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/type/service.rb | Ruby | apache-2.0 | 7,843 | main | 11,814 | # frozen_string_literal: true
# This is our main way of managing processes right now.
#
# a service is distinct from a process in that services
# can only be managed through the interface of an init script
# which is why they have a search path for initscripts and such
module Puppet
Type.newtype(:service) do
@d... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/type/file/selcontext.rb | Ruby | apache-2.0 | 7,843 | main | 4,914 | # frozen_string_literal: true
# Manage SELinux context of files.
#
# This code actually manages three pieces of data in the context.
#
# [root@delenn files]# ls -dZ /
# drwxr-xr-x root root system_u:object_r:root_t /
#
# The context of '/' here is 'system_u:object_r:root_t'. This is
# three separate fields:
... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/type/file/group.rb | Ruby | apache-2.0 | 7,843 | main | 1,538 | # frozen_string_literal: true
require_relative '../../../puppet/util/posix'
module Puppet
# Manage file group ownership.
Puppet::Type.type(:file).newproperty(:group) do
desc <<-EOT
Which group should own the file. Argument can be either a group
name or a group ID.
On Windows, a user (such ... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/type/file/mtime.rb | Ruby | apache-2.0 | 7,843 | main | 491 | # frozen_string_literal: true
module Puppet
Puppet::Type.type(:file).newproperty(:mtime) do
desc "A read-only state to check the file mtime. On \*nix-like systems, this
is the time of the most recent change to the content of the file."
def retrieve
current_value = :absent
stat = @resource.... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/type/file/mode.rb | Ruby | apache-2.0 | 7,843 | main | 7,523 | # frozen_string_literal: true
# Manage file modes. This state should support different formats
# for specification (e.g., u+rwx, or -0011), but for now only supports
# specifying the full mode.
module Puppet
Puppet::Type.type(:file).newproperty(:mode) do
require_relative '../../../puppet/util/symbolic_file_mod... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/type/file/source.rb | Ruby | apache-2.0 | 7,843 | main | 14,324 | # frozen_string_literal: true
require_relative '../../../puppet/file_serving/content'
require_relative '../../../puppet/file_serving/metadata'
require_relative '../../../puppet/file_serving/terminus_helper'
require_relative '../../../puppet/http'
module Puppet
# Copy files from a local or remote source. This stat... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/type/file/type.rb | Ruby | apache-2.0 | 7,843 | main | 401 | # frozen_string_literal: true
module Puppet
Puppet::Type.type(:file).newproperty(:type) do
require 'etc'
desc "A read-only state to check the file type."
def retrieve
current_value = :absent
stat = @resource.stat
if stat
current_value = stat.ftype
end
current_value
... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/type/file/ctime.rb | Ruby | apache-2.0 | 7,843 | main | 539 | # frozen_string_literal: true
module Puppet
Puppet::Type.type(:file).newproperty(:ctime) do
desc "A read-only state to check the file ctime. On most modern \*nix-like
systems, this is the time of the most recent change to the owner, group,
permissions, or content of the file."
def retrieve
... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/type/file/content.rb | Ruby | apache-2.0 | 7,843 | main | 6,315 | # frozen_string_literal: true
require 'net/http'
require 'uri'
require 'tempfile'
require_relative '../../../puppet/util/checksums'
require_relative '../../../puppet/type/file/data_sync'
module Puppet
Puppet::Type.type(:file).newproperty(:content) do
include Puppet::Util::Checksums
include Puppet::DataSync... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/type/file/data_sync.rb | Ruby | apache-2.0 | 7,843 | main | 3,093 | # frozen_string_literal: true
require_relative '../../../puppet/util/checksums'
require_relative '../../../puppet/util/diff'
require 'date'
require 'tempfile'
module Puppet
module DataSync
include Puppet::Util::Checksums
include Puppet::Util::Diff
def write_temporarily(param)
tempfile = Tempfile.... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/type/file/checksum_value.rb | Ruby | apache-2.0 | 7,843 | main | 1,920 | # frozen_string_literal: true
require_relative '../../../puppet/util/checksums'
require_relative '../../../puppet/type/file/data_sync'
module Puppet
Puppet::Type.type(:file).newproperty(:checksum_value) do
include Puppet::Util::Checksums
include Puppet::DataSync
desc "The checksum of the source content... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/type/file/checksum.rb | Ruby | apache-2.0 | 7,843 | main | 1,557 | # frozen_string_literal: true
require_relative '../../../puppet/util/checksums'
# Specify which checksum algorithm to use when checksumming
# files.
Puppet::Type.type(:file).newparam(:checksum) do
include Puppet::Util::Checksums
# The default is defined in Puppet.default_digest_algorithm
desc "The checksum typ... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/type/file/target.rb | Ruby | apache-2.0 | 7,843 | main | 2,455 | # frozen_string_literal: true
module Puppet
Puppet::Type.type(:file).newproperty(:target) do
desc "The target for creating a link. Currently, symlinks are the
only type supported. This attribute is mutually exclusive with `source`
and `content`.
Symlink targets can be relative, as well as abs... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/type/file/owner.rb | Ruby | apache-2.0 | 7,843 | main | 1,521 | # frozen_string_literal: true
module Puppet
Puppet::Type.type(:file).newproperty(:owner) do
include Puppet::Util::Warnings
desc <<-EOT
The user to whom the file should belong. Argument can be a user name or a
user ID.
On Windows, a group (such as "Administrators") can be set as a file's ... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/type/file/ensure.rb | Ruby | apache-2.0 | 7,843 | main | 6,214 | # frozen_string_literal: true
module Puppet
Puppet::Type.type(:file).ensurable do
require 'etc'
require_relative '../../../puppet/util/symbolic_file_mode'
include Puppet::Util::SymbolicFileMode
desc <<-EOT
Whether the file should exist, and if so what kind of file it should be.
Possible ... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/property/keyvalue.rb | Ruby | apache-2.0 | 7,843 | main | 5,423 | # frozen_string_literal: true
require_relative '../../puppet/property'
module Puppet
class Property
# This subclass of {Puppet::Property} manages string key value pairs.
# In order to use this property:
#
# * the _should_ value must be an array of key-value pairs separated by the 'separator'
# *... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/property/ordered_list.rb | Ruby | apache-2.0 | 7,843 | main | 868 | # frozen_string_literal: true
require_relative '../../puppet/property/list'
module Puppet
class Property
# This subclass of {Puppet::Property} manages an ordered list of values.
# The maintained order is the order defined by the 'current' set of values (i.e. the
# original order is not disrupted). Any a... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.