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/functions/downcase.rb | Ruby | apache-2.0 | 7,843 | main | 2,718 | # frozen_string_literal: true
# Converts a String, Array or Hash (recursively) into lower case.
#
# This function is compatible with the stdlib function with the same name.
#
# The function does the following:
# * For a `String`, its lower case version is returned. This is done using Ruby system locale which handles s... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/functions/hiera_hash.rb | Ruby | apache-2.0 | 7,843 | main | 3,306 | # frozen_string_literal: true
require 'hiera/puppet_function'
# Finds all matches of a key throughout the hierarchy and returns them in a merged hash.
#
# This function is deprecated in favor of the `lookup` function. While this function
# continues to work, it does **not** support:
# * `lookup_options` stored in the... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/functions/capitalize.rb | Ruby | apache-2.0 | 7,843 | main | 1,988 | # frozen_string_literal: true
# Capitalizes the first character of a String, or the first character of every String in an Iterable value (such as an Array).
#
# This function is compatible with the stdlib function with the same name.
#
# The function does the following:
# * For a `String`, a string is returned in whic... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/functions/compare.rb | Ruby | apache-2.0 | 7,843 | main | 3,598 | # frozen_string_literal: true
# Compares two values and returns -1, 0 or 1 if first value is smaller, equal or larger than the second value.
# The compare function accepts arguments of the data types `String`, `Numeric`, `Timespan`, `Timestamp`, and `Semver`,
# such that:
#
# * two of the same data type can be compare... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/functions/rstrip.rb | Ruby | apache-2.0 | 7,843 | main | 1,708 | # frozen_string_literal: true
# Strips trailing spaces from a String
#
# This function is compatible with the stdlib function with the same name.
#
# The function does the following:
# * For a `String` the conversion removes all trailing ASCII white space characters such as space, tab, newline, and return.
# It does... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/functions/hiera_array.rb | Ruby | apache-2.0 | 7,843 | main | 2,979 | # frozen_string_literal: true
require 'hiera/puppet_function'
# Finds all matches of a key throughout the hierarchy and returns them as a single flattened
# array of unique values. If any of the matched values are arrays, they're flattened and
# included in the results. This is called an
# [array merge lookup](https:... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/functions/scanf.rb | Ruby | apache-2.0 | 7,843 | main | 1,321 | # frozen_string_literal: true
# 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 details about the supported formats (which
# are similar but not identical to the formats used in Puppet's `sprintf` function.)... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/functions/convert_to.rb | Ruby | apache-2.0 | 7,843 | main | 1,156 | # frozen_string_literal: true
# The `convert_to(value, type)` is a convenience function that does the same as `new(type, value)`.
# The difference in the argument ordering allows it to be used in chained style for
# improved readability "left to right".
#
# When the function is given a lambda, it is called with the co... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/functions/unwrap.rb | Ruby | apache-2.0 | 7,843 | main | 1,474 | # frozen_string_literal: true
# Unwraps a Sensitive value and returns the wrapped object.
# Returns the Value itself, if it is not Sensitive.
#
# @example Usage of unwrap
#
# ```puppet
# $plaintext = 'hunter2'
# $pw = Sensitive.new($plaintext)
# notice("Wrapped object is $pw") #=> Prints "Wrapped object is Sensitive [... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/functions/include.rb | Ruby | apache-2.0 | 7,843 | main | 2,538 | # frozen_string_literal: true
# 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 names.
#
# The `include` function can be used multiple times on the same class and will
# only decl... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/functions/size.rb | Ruby | apache-2.0 | 7,843 | main | 361 | # frozen_string_literal: true
# The same as length() - returns the size of an Array, Hash, String, or Binary value.
#
# @since 6.0.0 - also supporting Binary
#
Puppet::Functions.create_function(:size) do
dispatch :generic_size do
param 'Variant[Collection, String, Binary]', :arg
end
def generic_size(arg)
... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/functions/flatten.rb | Ruby | apache-2.0 | 7,843 | main | 1,581 | # frozen_string_literal: true
# Returns a flat Array produced from its possibly deeply nested given arguments.
#
# One or more arguments of any data type can be given to this function.
# The result is always a flat array representation where any nested arrays are recursively flattened.
#
# @example Typical use of `fla... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/functions/with.rb | Ruby | apache-2.0 | 7,843 | main | 973 | # frozen_string_literal: true
# Calls a [lambda](https://puppet.com/docs/puppet/latest/lang_lambdas.html)
# with the given arguments and returns the result.
#
# Since a lambda's scope is
# [local](https://puppet.com/docs/puppet/latest/lang_lambdas.html#lambda-scope)
# to the lambda, you can use the `with` function to ... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/functions/reverse_each.rb | Ruby | apache-2.0 | 7,843 | main | 2,781 | # frozen_string_literal: true
# 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
# element.
#
# This function takes one to two arguments:
#
# 1. An `Iterable` that the function will iterate over.
# 2. An ... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/functions/require.rb | Ruby | apache-2.0 | 7,843 | main | 3,223 | # frozen_string_literal: true
# Requires the specified classes.
# Evaluate one or more classes, adding the required class as a dependency.
#
# The relationship metaparameters work well for specifying relationships
# between individual resources, but they can be clumsy for specifying
# relationships between classes. T... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/functions/reduce.rb | Ruby | apache-2.0 | 7,843 | main | 5,422 | # frozen_string_literal: true
# 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 each iteration, and returns the result of the lambda's final iteration. This
# lets you create a new value or d... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/functions/regsubst.rb | Ruby | apache-2.0 | 7,843 | main | 6,369 | # frozen_string_literal: true
# Performs regexp replacement on a string or array of strings.
Puppet::Functions.create_function(:regsubst) do
# @param target [String]
# The string or array of strings to operate on. If an array, the replacement will be
# performed on each of the elements in the array, a... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/functions/unique.rb | Ruby | apache-2.0 | 7,843 | main | 4,876 | # frozen_string_literal: true
# Produces a unique set of values from an `Iterable` argument.
#
# * If the argument is a `String`, the unique set of characters are returned as a new `String`.
# * If the argument is a `Hash`, the resulting hash associates a set of keys with a set of unique values.
# * For all other type... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/functions/strftime.rb | Ruby | apache-2.0 | 7,843 | main | 7,721 | # frozen_string_literal: true
# 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 will be passed through to the output string.
#
# A third optional timezone argument can be provided. The first a... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/functions/hiera_include.rb | Ruby | apache-2.0 | 7,843 | main | 3,964 | # frozen_string_literal: true
require 'hiera/puppet_function'
# Assigns classes to a node using an
# [array merge lookup](https://puppet.com/docs/hiera/latest/lookup_types.html#array-merge)
# that retrieves the value for a user-specified key from Hiera's data.
#
# This function is deprecated in favor of the `lookup` ... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/functions/tree_each.rb | Ruby | apache-2.0 | 7,843 | main | 7,598 | # frozen_string_literal: true
# Runs a [lambda](https://puppet.com/docs/puppet/latest/lang_lambdas.html)
# recursively and repeatedly using values from a data structure, then returns the unchanged data structure, or if
# a lambda is not given, returns an `Iterator` for the tree.
#
# This function takes one mandatory a... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/functions/camelcase.rb | Ruby | apache-2.0 | 7,843 | main | 2,068 | # frozen_string_literal: true
# Creates a Camel Case version of a String
#
# This function is compatible with the stdlib function with the same name.
#
# The function does the following:
# * For a `String` the conversion replaces all combinations of `*_<char>*` with an upcased version of the
# character following th... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/application/script.rb | Ruby | apache-2.0 | 7,843 | main | 8,637 | # frozen_string_literal: true
require_relative '../../puppet/application'
require_relative '../../puppet/configurer'
require_relative '../../puppet/util/profiler/aggregate'
require_relative '../../puppet/parser/script_compiler'
class Puppet::Application::Script < Puppet::Application
option("--debug", "-d")
option... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/application/resource.rb | Ruby | apache-2.0 | 7,843 | main | 8,041 | # frozen_string_literal: true
require_relative '../../puppet/application'
class Puppet::Application::Resource < Puppet::Application
environment_mode :not_required
attr_accessor :host, :extra_params
def preinit
@extra_params = [:provider]
end
option("--debug", "-d")
option("--verbose", "-v")
optio... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/application/describe.rb | Ruby | apache-2.0 | 7,843 | main | 5,568 | # frozen_string_literal: true
require_relative '../../puppet/application'
class Formatter
def initialize(width)
@width = width
end
def wrap(txt, opts)
return "" unless txt && !txt.empty?
work = (opts[:scrub] ? scrub(txt) : txt)
indent = opts[:indent] || 0
textLen = @width - indent
patt... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/application/ssl.rb | Ruby | apache-2.0 | 7,843 | main | 11,546 | # frozen_string_literal: true
require_relative '../../puppet/application'
require_relative '../../puppet/ssl/oids'
class Puppet::Application::Ssl < Puppet::Application
run_mode :agent
def summary
_("Manage SSL keys and certificates for puppet SSL clients")
end
def help
<<~HELP
puppet-ssl(8) --... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/application/agent.rb | Ruby | apache-2.0 | 7,843 | main | 18,987 | # frozen_string_literal: true
require_relative '../../puppet/application'
require_relative '../../puppet/daemon'
require_relative '../../puppet/util/pidlock'
require_relative '../../puppet/agent'
require_relative '../../puppet/configurer'
require_relative '../../puppet/ssl/oids'
class Puppet::Application::Agent < Pup... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/application/apply.rb | Ruby | apache-2.0 | 7,843 | main | 14,733 | # frozen_string_literal: true
require_relative '../../puppet/application'
require_relative '../../puppet/configurer'
require_relative '../../puppet/util/profiler/aggregate'
class Puppet::Application::Apply < Puppet::Application
require_relative '../../puppet/util/splayer'
include Puppet::Util::Splayer
option("... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/application/device.rb | Ruby | apache-2.0 | 7,843 | main | 15,849 | # frozen_string_literal: true
require_relative '../../puppet/application'
require_relative '../../puppet/configurer'
require_relative '../../puppet/util/network_device'
require_relative '../../puppet/ssl/oids'
class Puppet::Application::Device < Puppet::Application
run_mode :agent
attr_accessor :args, :agent, :h... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/application/doc.rb | Ruby | apache-2.0 | 7,843 | main | 6,243 | # frozen_string_literal: true
require_relative '../../puppet/application'
class Puppet::Application::Doc < Puppet::Application
run_mode :server
attr_accessor :unknown_args, :manifest
def preinit
{ :references => [], :mode => :text, :format => :to_markdown }.each do |name, value|
options[name] = valu... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/application/facts.rb | Ruby | apache-2.0 | 7,843 | main | 498 | # frozen_string_literal: true
require_relative '../../puppet/application/indirection_base'
class Puppet::Application::Facts < Puppet::Application::IndirectionBase
# Allows `puppet facts` actions to be run against environments that
# don't exist locally, such as using the `--environment` flag to make a REST
# re... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/application/filebucket.rb | Ruby | apache-2.0 | 7,843 | main | 10,250 | # frozen_string_literal: true
require_relative '../../puppet/application'
class Puppet::Application::Filebucket < Puppet::Application
environment_mode :not_required
option("--bucket BUCKET", "-b")
option("--debug", "-d")
option("--fromdate FROMDATE", "-f")
option("--todate TODATE", "-t")
option("--local"... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/application/lookup.rb | Ruby | apache-2.0 | 7,843 | main | 16,441 | # frozen_string_literal: true
require_relative '../../puppet/application'
require_relative '../../puppet/pops'
require_relative '../../puppet/node'
require_relative '../../puppet/node/server_facts'
require_relative '../../puppet/parser/compiler'
class Puppet::Application::Lookup < Puppet::Application
RUN_HELP = _("... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/application/face_base.rb | Ruby | apache-2.0 | 7,843 | main | 9,967 | # frozen_string_literal: true
require_relative '../../puppet/application'
require_relative '../../puppet/face'
require 'optparse'
class Puppet::Application::FaceBase < Puppet::Application
option("--debug", "-d") do |_arg|
set_log_level(:debug => true)
end
option("--verbose", "-v") do |_|
set_log_level(... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/feature/libuser.rb | Ruby | apache-2.0 | 7,843 | main | 310 | # frozen_string_literal: true
require_relative '../../puppet/util/feature'
require_relative '../../puppet/util/libuser'
Puppet.features.add(:libuser) {
File.executable?("/usr/sbin/lgroupadd") and
File.executable?("/usr/sbin/luseradd") and
Puppet::FileSystem.exist?(Puppet::Util::Libuser.getconf)
} |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/feature/pe_license.rb | Ruby | apache-2.0 | 7,843 | main | 212 | # frozen_string_literal: true
require_relative '../../puppet/util/feature'
# Is the pe license library installed providing the ability to read licenses.
Puppet.features.add(:pe_license, :libs => %(pe_license)) |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/feature/base.rb | Ruby | apache-2.0 | 7,843 | main | 2,083 | # frozen_string_literal: true
require_relative '../../puppet/util/feature'
# Add the simple features, all in one file.
# Order is important as some features depend on others
# We have a syslog implementation
Puppet.features.add(:syslog, :libs => ["syslog"])
# We can use POSIX user functions
Puppet.features.add(:po... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/configurer/plugin_handler.rb | Ruby | apache-2.0 | 7,843 | main | 1,947 | # frozen_string_literal: true
# Break out the code related to plugins. This module is
# just included into the agent, but having it here makes it
# easier to test.
require_relative '../../puppet/configurer'
class Puppet::Configurer::PluginHandler
SUPPORTED_LOCALES_MOUNT_AGENT_VERSION = Gem::Version.new("5.3.4")
... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/configurer/downloader.rb | Ruby | apache-2.0 | 7,843 | main | 2,498 | # frozen_string_literal: true
require_relative '../../puppet/configurer'
require_relative '../../puppet/resource/catalog'
class Puppet::Configurer::Downloader
attr_reader :name, :path, :source, :ignore
# Evaluate our download, returning the list of changed values.
def evaluate
Puppet.info _("Retrieving %{n... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/configurer/fact_handler.rb | Ruby | apache-2.0 | 7,843 | main | 2,012 | # frozen_string_literal: true
require_relative '../../puppet/indirector/facts/facter'
require_relative '../../puppet/configurer'
require_relative '../../puppet/configurer/downloader'
# Break out the code related to facts. This module is
# just included into the agent, but having it here makes it
# easier to test.
m... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/node/facts.rb | Ruby | apache-2.0 | 7,843 | main | 3,942 | # frozen_string_literal: true
require 'time'
require_relative '../../puppet/node'
require_relative '../../puppet/indirector'
require_relative '../../puppet/util/psych_support'
# Manage a given node's facts. This either accepts facts and stores them, or
# returns facts for a given node.
class Puppet::Node::Facts
i... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/node/server_facts.rb | Ruby | apache-2.0 | 7,843 | main | 1,411 | # frozen_string_literal: true
class Puppet::Node::ServerFacts
def self.load
server_facts = {}
# Add our server Puppet Enterprise version, if available.
pe_version_file = '/opt/puppetlabs/server/pe_version'
if File.readable?(pe_version_file) and !File.zero?(pe_version_file)
server_facts['pe_ser... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/node/environment.rb | Ruby | apache-2.0 | 7,843 | main | 21,653 | # frozen_string_literal: true
require_relative '../../puppet/util'
require 'monitor'
require_relative '../../puppet/parser/parser_factory'
require_relative '../../puppet/concurrent/lock'
# Just define it, so this class has fewer load dependencies.
class Puppet::Node
end
# Puppet::Node::Environment acts as a containe... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/network/http.rb | Ruby | apache-2.0 | 7,843 | main | 892 | # frozen_string_literal: true
# This module is used to handle puppet REST requests in puppetserver.
module Puppet::Network::HTTP
HEADER_ENABLE_PROFILING = "X-Puppet-Profiling"
HEADER_PUPPET_VERSION = "X-Puppet-Version"
SERVER_URL_PREFIX = "/puppet"
SERVER_URL_VERSIONS = "v3"
MASTER_URL_PREFIX = SERVER_URL_... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/network/formats.rb | Ruby | apache-2.0 | 7,843 | main | 9,405 | # frozen_string_literal: true
require_relative '../../puppet/network/format_handler'
require_relative '../../puppet/util/json'
Puppet::Network::FormatHandler.create_serialized_formats(:msgpack, :weight => 20, :mime => "application/x-msgpack", :required_methods => [:render_method, :intern_method], :intern_method => :f... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/network/format_support.rb | Ruby | apache-2.0 | 7,843 | main | 4,310 | # frozen_string_literal: true
require_relative '../../puppet/network/format_handler'
# Provides network serialization support when included
# @api public
module Puppet::Network::FormatSupport
def self.included(klass)
klass.extend(ClassMethods)
end
module ClassMethods
def convert_from(format, data)
... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/network/http_pool.rb | Ruby | apache-2.0 | 7,843 | main | 2,926 | # frozen_string_literal: true
require_relative '../../puppet/network/http/connection'
module Puppet::Network; end
# This module is deprecated.
#
# @api public
# @deprecated Use {Puppet::HTTP::Client} instead.
#
module Puppet::Network::HttpPool
@http_client_class = Puppet::Network::HTTP::Connection
def self.http... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/network/uri.rb | Ruby | apache-2.0 | 7,843 | main | 565 | # frozen_string_literal: true
# This module holds funtions for network URI's
module Puppet::Network::Uri
# Mask credentials in given URI or address as string. Resulting string will
# contain '***' in place of password. It will only be replaced if actual
# password is given.
#
# @param uri [URI|String] an uri... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/network/format.rb | Ruby | apache-2.0 | 7,843 | main | 3,615 | # frozen_string_literal: true
require_relative '../../puppet/confiner'
# A simple class for modeling encoding formats for moving
# instances around the network.
class Puppet::Network::Format
include Puppet::Confiner
attr_reader :name, :mime
attr_accessor :intern_method, :render_method, :intern_multiple_method,... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/network/format_handler.rb | Ruby | apache-2.0 | 7,843 | main | 2,919 | # frozen_string_literal: true
require 'yaml'
require_relative '../../puppet/network'
require_relative '../../puppet/network/format'
module Puppet::Network::FormatHandler
class FormatError < Puppet::Error; end
ALL_MEDIA_TYPES = '*/*'
@formats = {}
def self.create(*args, &block)
instance = Puppet::Networ... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/network/authorization.rb | Ruby | apache-2.0 | 7,843 | main | 733 | # frozen_string_literal: true
module Puppet::Network
module Authorization
class << self
# This method is deprecated and will be removed in a future release.
def authconfigloader_class=(klass)
@authconfigloader_class = klass
end
# Verify something external to puppet is authorizing... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/network/client_request.rb | Ruby | apache-2.0 | 7,843 | main | 850 | # frozen_string_literal: true
module Puppet::Network # :nodoc:
# A struct-like class for passing around a client request. It's mostly
# just used for validation and authorization.
class ClientRequest
attr_accessor :name, :ip, :authenticated, :handler, :method
def authenticated?
authenticated
... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/network/http/response.rb | Ruby | apache-2.0 | 7,843 | main | 589 | # frozen_string_literal: true
class Puppet::Network::HTTP::Response
def initialize(handler, response)
@handler = handler
@response = response
end
def respond_with(code, type, body)
format = Puppet::Network::FormatHandler.format_for(type)
mime = format.mime
charset = format.charset
if ch... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/network/http/issues.rb | Ruby | apache-2.0 | 7,843 | main | 536 | # frozen_string_literal: true
module Puppet::Network::HTTP::Issues
NO_INDIRECTION_REMOTE_REQUESTS = :NO_INDIRECTION_REMOTE_REQUESTS
HANDLER_NOT_FOUND = :HANDLER_NOT_FOUND
RESOURCE_NOT_FOUND = :RESOURCE_NOT_FOUND
ENVIRONMENT_NOT_FOUND = :ENVIRONMENT_NOT_FOUND
RUNTIME_ERROR = :RUNTIME_ERROR
MISSING_HEADER_FI... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/network/http/api.rb | Ruby | apache-2.0 | 7,843 | main | 2,047 | # frozen_string_literal: true
class Puppet::Network::HTTP::API
require_relative '../../../puppet/version'
def self.not_found
Puppet::Network::HTTP::Route
.path(/.*/)
.any(lambda do |req, _res|
raise Puppet::Network::HTTP::Error::HTTPNotFoundError.new("No route for #{req.method} #{req.path}... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/network/http/connection.rb | Ruby | apache-2.0 | 7,843 | main | 9,578 | # frozen_string_literal: true
require_relative '../../../puppet/http'
# This will be raised if too many redirects happen for a given HTTP request
class Puppet::Network::HTTP::RedirectionLimitExceededException < Puppet::Error; end
# This class provides simple methods for issuing various types of HTTP
# requests. It'... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/network/http/request.rb | Ruby | apache-2.0 | 7,843 | main | 3,334 | # frozen_string_literal: true
# This class is effectively public API, because a Request object is passed as a
# parameter to the current Handler subclass. Puppetserver implements its own
# Handler
# https://github.com/puppetlabs/puppetserver/blob/8.3.0/src/ruby/puppetserver-lib/puppet/server/network/http/handler.rb#L9... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/network/http/handler.rb | Ruby | apache-2.0 | 7,843 | main | 5,997 | # frozen_string_literal: true
module Puppet::Network::HTTP
end
require_relative '../../../puppet/network/http'
require_relative '../../../puppet/util/profiler'
require_relative '../../../puppet/util/profiler/aggregate'
require 'resolv'
module Puppet::Network::HTTP::Handler
include Puppet::Network::HTTP::Issues
... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/network/http/route.rb | Ruby | apache-2.0 | 7,843 | main | 2,186 | # frozen_string_literal: true
class Puppet::Network::HTTP::Route
MethodNotAllowedHandler = lambda do |req, _res|
raise Puppet::Network::HTTP::Error::HTTPMethodNotAllowedError.new("method #{req.method} not allowed for route #{req.path}", Puppet::Network::HTTP::Issues::UNSUPPORTED_METHOD)
end
NO_HANDLERS = [M... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/network/http/error.rb | Ruby | apache-2.0 | 7,843 | main | 2,201 | # frozen_string_literal: true
require_relative '../../../puppet/util/json'
module Puppet::Network::HTTP::Error
Issues = Puppet::Network::HTTP::Issues
class HTTPError < Exception # rubocop:disable Lint/InheritException
attr_reader :status, :issue_kind
def initialize(message, status, issue_kind)
sup... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/network/http/memory_response.rb | Ruby | apache-2.0 | 7,843 | main | 252 | # frozen_string_literal: true
class Puppet::Network::HTTP::MemoryResponse
attr_reader :code, :type, :body
def initialize
@body = ''.dup
end
def respond_with(code, type, body)
@code = code
@type = type
@body += body
end
end |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/network/http/api/indirected_routes.rb | Ruby | apache-2.0 | 7,843 | main | 10,418 | # frozen_string_literal: true
require_relative '../../../../puppet/network/http/api/indirection_type'
class Puppet::Network::HTTP::API::IndirectedRoutes
# How we map http methods and the indirection name in the URI
# to an indirection method.
METHOD_MAP = {
"GET" => {
:plural => :search,
:singul... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/network/http/api/indirection_type.rb | Ruby | apache-2.0 | 7,843 | main | 748 | # frozen_string_literal: true
class Puppet::Network::HTTP::API::IndirectionType
INDIRECTION_TYPE_MAP = {
"certificate" => :ca,
"certificate_request" => :ca,
"certificate_revocation_list" => :ca,
"certificate_status" => :ca
}
def self.master_url_prefix
"#{Puppet::Network::HTTP::MASTER_URL_PRE... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/network/http/api/server/v3.rb | Ruby | apache-2.0 | 7,843 | main | 1,240 | # frozen_string_literal: true
require_relative 'v3/environments'
require_relative '../../../../../puppet/network/http/api/indirected_routes'
module Puppet
module Network
module HTTP
class API
module Server
class V3
def self.wrap(&block)
lambda do |request, respo... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/network/http/api/server/v3/environments.rb | Ruby | apache-2.0 | 7,843 | main | 1,623 | # frozen_string_literal: true
require_relative '../../../../../../puppet/util/json'
module Puppet
module Network
module HTTP
class API
module Server
class V3
class Environments
def initialize(env_loader)
@env_loader = env_loader
end... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/info_service/task_information_service.rb | Ruby | apache-2.0 | 7,843 | main | 1,581 | # frozen_string_literal: true
class Puppet::InfoService::TaskInformationService
require_relative '../../puppet/module'
def self.tasks_per_environment(environment_name)
# get the actual environment object, raise error if the named env doesn't exist
env = Puppet.lookup(:environments).get!(environment_name)
... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/info_service/class_information_service.rb | Ruby | apache-2.0 | 7,843 | main | 2,947 | # frozen_string_literal: true
require_relative '../../puppet'
require_relative '../../puppet/pops'
require_relative '../../puppet/pops/evaluator/json_strict_literal_evaluator'
class Puppet::InfoService::ClassInformationService
def initialize
@file_to_result = {}
@parser = Puppet::Pops::Parser::EvaluatingPar... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/info_service/plan_information_service.rb | Ruby | apache-2.0 | 7,843 | main | 1,353 | # frozen_string_literal: true
class Puppet::InfoService::PlanInformationService
require_relative '../../puppet/module'
def self.plans_per_environment(environment_name)
# get the actual environment object, raise error if the named env doesn't exist
env = Puppet.lookup(:environments).get!(environment_name)
... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/provider/exec.rb | Ruby | apache-2.0 | 7,843 | main | 3,865 | # frozen_string_literal: true
require_relative '../../puppet/provider'
require_relative '../../puppet/util/execution'
class Puppet::Provider::Exec < Puppet::Provider
include Puppet::Util::Execution
def environment
env = {}
if (path = resource[:path])
env[:PATH] = path.join(File::PATH_SEPARATOR)
... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/provider/nameservice.rb | Ruby | apache-2.0 | 7,843 | main | 9,412 | # frozen_string_literal: true
require_relative '../../puppet'
# This is the parent class of all NSS classes. They're very different in
# their backend, but they're pretty similar on the front-end. This class
# provides a way for them all to be as similar as possible.
class Puppet::Provider::NameService < Puppet::Pr... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/provider/ldap.rb | Ruby | apache-2.0 | 7,843 | main | 3,747 | # frozen_string_literal: true
require_relative '../../puppet/provider'
# The base class for LDAP providers.
class Puppet::Provider::Ldap < Puppet::Provider
require_relative '../../puppet/util/ldap/manager'
class << self
attr_reader :manager
end
# Look up all instances at our location. Yay.
def self.i... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/provider/package_targetable.rb | Ruby | apache-2.0 | 7,843 | main | 3,242 | # frozen_string_literal: true
# Targetable package providers implement a `command` attribute.
#
# The `packages` hash passed to `Puppet::Provider::Package::prefetch` is deduplicated,
# as it is keyed only by name in `Puppet::Transaction::prefetch_if_necessary`.
#
# (The `packages` hash passed to ``Puppet::Provider::Pa... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/provider/network_device.rb | Ruby | apache-2.0 | 7,843 | main | 1,751 | # frozen_string_literal: true
# This is the base class of all prefetched network device provider
class Puppet::Provider::NetworkDevice < Puppet::Provider
def self.device(url)
raise "This provider doesn't implement the necessary device method"
end
def self.lookup(device, name)
raise "This provider doesn'... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/provider/package.rb | Ruby | apache-2.0 | 7,843 | main | 1,757 | # frozen_string_literal: true
require_relative '../../puppet/provider'
class Puppet::Provider::Package < Puppet::Provider
# Prefetch our package list, yo.
def self.prefetch(packages)
instances.each do |prov|
pkg = packages[prov.name]
if pkg
pkg.provider = prov
end
end
end
# ... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/provider/aix_object.rb | Ruby | apache-2.0 | 7,843 | main | 17,895 | # frozen_string_literal: true
# Common code for AIX user/group providers.
class Puppet::Provider::AixObject < Puppet::Provider
desc "Generic AIX resource provider"
# Class representing a MappedObject, which can either be an
# AIX attribute or a Puppet property. This class lets us
# write something like:
#
... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/provider/command.rb | Ruby | apache-2.0 | 7,843 | main | 1,147 | # frozen_string_literal: true
# A command that can be executed on the system
class Puppet::Provider::Command
attr_reader :executable
attr_reader :name
# @param [String] name A way of referencing the name
# @param [String] executable The path to the executable file
# @param resolver An object for resolving t... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/provider/parsedfile.rb | Ruby | apache-2.0 | 7,843 | main | 15,588 | # frozen_string_literal: true
require_relative '../../puppet'
require_relative '../../puppet/util/filetype'
require_relative '../../puppet/util/fileparsing'
# This provider can be used as the parent class for a provider that
# parses and generates files. Its content must be loaded via the
# 'prefetch' method, and th... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/provider/confine.rb | Ruby | apache-2.0 | 7,843 | main | 330 | # frozen_string_literal: true
# Confines have been moved out of the provider as they are also used for other things.
# This provides backwards compatibility for people still including this old location.
require_relative '../../puppet/provider'
require_relative '../../puppet/confine'
Puppet::Provider::Confine = Puppet... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/provider/exec/shell.rb | Ruby | apache-2.0 | 7,843 | main | 795 | # frozen_string_literal: true
Puppet::Type.type(:exec).provide :shell, :parent => :posix do
include Puppet::Util::Execution
confine :feature => :posix
desc <<-EOT
Passes the provided command through `/bin/sh`; only available on
POSIX systems. This allows the use of shell globbing and built-ins, and
... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/provider/exec/posix.rb | Ruby | apache-2.0 | 7,843 | main | 2,123 | # frozen_string_literal: true
require_relative '../../../puppet/provider/exec'
Puppet::Type.type(:exec).provide :posix, :parent => Puppet::Provider::Exec do
has_feature :umask
confine :feature => :posix
defaultfor :feature => :posix
desc <<-EOT
Executes external binaries by invoking Ruby's `Kernel.exec`.... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/provider/exec/windows.rb | Ruby | apache-2.0 | 7,843 | main | 1,901 | # frozen_string_literal: true
require_relative '../../../puppet/provider/exec'
Puppet::Type.type(:exec).provide :windows, :parent => Puppet::Provider::Exec do
confine 'os.name' => :windows
defaultfor 'os.name' => :windows
desc <<-'EOT'
Execute external binaries on Windows systems. As with the `posix`
... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/provider/service/freebsd.rb | Ruby | apache-2.0 | 7,843 | main | 3,953 | # frozen_string_literal: true
Puppet::Type.type(:service).provide :freebsd, :parent => :init do
desc "Provider for FreeBSD and DragonFly BSD. Uses the `rcvar` argument of init scripts and parses/edits rc files."
confine 'os.name' => [:freebsd, :dragonfly]
defaultfor 'os.name' => [:freebsd, :dragonfly]
def rc... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/provider/service/launchd.rb | Ruby | apache-2.0 | 7,843 | main | 12,727 | # frozen_string_literal: true
require_relative '../../../puppet/util/plist'
Puppet::Type.type(:service).provide :launchd, :parent => :base do
desc <<-'EOT'
This provider manages jobs with `launchd`, which is the default service
framework for Mac OS X (and may be available for use on other platforms).
Fo... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/provider/service/gentoo.rb | Ruby | apache-2.0 | 7,843 | main | 1,190 | # frozen_string_literal: true
# Manage gentoo services. Start/stop is the same as InitSvc, but enable/disable
# is special.
Puppet::Type.type(:service).provide :gentoo, :parent => :init do
desc <<-EOT
Gentoo's form of `init`-style service management.
Uses `rc-update` for service enabling and disabling.
... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/provider/service/systemd.rb | Ruby | apache-2.0 | 7,843 | main | 8,502 | # frozen_string_literal: true
# Manage systemd services using systemctl
require_relative '../../../puppet/file_system'
Puppet::Type.type(:service).provide :systemd, :parent => :base do
desc "Manages `systemd` services using `systemctl`.
Because `systemd` defaults to assuming the `.service` unit type, the suffix... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/provider/service/daemontools.rb | Ruby | apache-2.0 | 7,843 | main | 5,199 | # frozen_string_literal: true
# Daemontools service management
#
# author Brice Figureau <brice-puppet@daysofwonder.com>
Puppet::Type.type(:service).provide :daemontools, :parent => :base do
desc <<-'EOT'
Daemontools service management.
This provider manages daemons supervised by D.J. Bernstein daemontools.... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/provider/service/windows.rb | Ruby | apache-2.0 | 7,843 | main | 7,778 | # frozen_string_literal: true
# Windows Service Control Manager (SCM) provider
Puppet::Type.type(:service).provide :windows, :parent => :service do
desc <<-EOT
Support for Windows Service Control Manager (SCM). This provider can
start, stop, enable, and disable services, and the SCM provides working
sta... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/provider/service/redhat.rb | Ruby | apache-2.0 | 7,843 | main | 2,625 | # frozen_string_literal: true
# Manage Red Hat services. Start/stop uses /sbin/service and enable/disable uses chkconfig
Puppet::Type.type(:service).provide :redhat, :parent => :init, :source => :init do
desc "Red Hat's (and probably many others') form of `init`-style service
management. Uses `chkconfig` for s... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/provider/service/openbsd.rb | Ruby | apache-2.0 | 7,843 | main | 2,651 | # frozen_string_literal: true
Puppet::Type.type(:service).provide :openbsd, :parent => :init do
desc "Provider for OpenBSD's rc.d daemon control scripts"
commands :rcctl => '/usr/sbin/rcctl'
confine 'os.name' => :openbsd
defaultfor 'os.name' => :openbsd
has_feature :flaggable
def startcmd
[command(:... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/provider/service/smf.rb | Ruby | apache-2.0 | 7,843 | main | 11,568 | # frozen_string_literal: true
require 'timeout'
# Solaris 10 SMF-style services.
Puppet::Type.type(:service).provide :smf, :parent => :base do
desc <<-EOT
Support for Sun's new Service Management Framework.
When managing the enable property, this provider will try to preserve
the previous ensure state ... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/provider/service/openwrt.rb | Ruby | apache-2.0 | 7,843 | main | 817 | # frozen_string_literal: true
Puppet::Type.type(:service).provide :openwrt, :parent => :init, :source => :init do
desc <<-EOT
Support for OpenWrt flavored init scripts.
Uses /etc/init.d/service_name enable, disable, and enabled.
EOT
defaultfor 'os.name' => :openwrt
confine 'os.name' => :openwrt
h... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/provider/service/debian.rb | Ruby | apache-2.0 | 7,843 | main | 2,770 | # frozen_string_literal: true
# Manage debian services. Start/stop is the same as InitSvc, but enable/disable
# is special.
Puppet::Type.type(:service).provide :debian, :parent => :init do
desc <<-EOT
Debian's form of `init`-style management.
The only differences from `init` are support for enabling and di... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/provider/service/upstart.rb | Ruby | apache-2.0 | 7,843 | main | 10,602 | # frozen_string_literal: true
Puppet::Type.type(:service).provide :upstart, :parent => :debian do
START_ON = /^\s*start\s+on/
COMMENTED_START_ON = /^\s*#+\s*start\s+on/
MANUAL = /^\s*manual\s*$/
desc "Ubuntu service management with `upstart`.
This provider manages `upstart` jobs on Ubuntu. For `upstart` do... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/provider/service/service.rb | Ruby | apache-2.0 | 7,843 | main | 1,910 | # frozen_string_literal: true
Puppet::Type.type(:service).provide :service do
desc "The simplest form of service support."
def self.instances
[]
end
# How to restart the process.
def restart
if @resource[:restart] or restartcmd
service_command(:restart)
nil
else
stop
sta... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/provider/service/openrc.rb | Ruby | apache-2.0 | 7,843 | main | 1,787 | # frozen_string_literal: true
# Gentoo OpenRC
Puppet::Type.type(:service).provide :openrc, :parent => :base do
desc <<-EOT
Support for Gentoo's OpenRC initskripts
Uses rc-update, rc-status and rc-service to manage services.
EOT
defaultfor 'os.name' => :gentoo
defaultfor 'os.name' => :funtoo
has_c... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/provider/service/init.rb | Ruby | apache-2.0 | 7,843 | main | 6,782 | # frozen_string_literal: true
# The standard init-based service type. Many other service types are
# customizations of this module.
Puppet::Type.type(:service).provide :init, :parent => :base do
desc "Standard `init`-style service management."
def self.defpath
case Puppet.runtime[:facter].value('os.name')
... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/provider/service/src.rb | Ruby | apache-2.0 | 7,843 | main | 4,129 | # frozen_string_literal: true
require 'timeout'
# AIX System Resource controller (SRC)
Puppet::Type.type(:service).provide :src, :parent => :base do
desc "Support for AIX's System Resource controller.
Services are started/stopped based on the `stopsrc` and `startsrc`
commands, and some services can be refreshe... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/provider/service/runit.rb | Ruby | apache-2.0 | 7,843 | main | 2,760 | # frozen_string_literal: true
# Daemontools service management
#
# author Brice Figureau <brice-puppet@daysofwonder.com>
Puppet::Type.type(:service).provide :runit, :parent => :daemontools do
desc <<-'EOT'
Runit service management.
This provider manages daemons running supervised by Runit.
When detectin... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/provider/service/base.rb | Ruby | apache-2.0 | 7,843 | main | 4,147 | # frozen_string_literal: true
Puppet::Type.type(:service).provide :base, :parent => :service do
desc "The simplest form of Unix service support.
You have to specify enough about your service for this to work; the
minimum you can specify is a binary for starting the process, and this
same binary will be search... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/provider/service/rcng.rb | Ruby | apache-2.0 | 7,843 | main | 1,643 | # frozen_string_literal: true
Puppet::Type.type(:service).provide :rcng, :parent => :bsd do
desc <<-EOT
RCng service management with rc.d
EOT
defaultfor 'os.name' => [:netbsd, :cargos]
confine 'os.name' => [:netbsd, :cargos]
def self.defpath
"/etc/rc.d"
end
# if the service file exists in rc.c... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.