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/util/windows/security_descriptor.rb | Ruby | apache-2.0 | 7,843 | main | 2,029 | # frozen_string_literal: true
# Windows Security Descriptor
#
# Represents a security descriptor that can be applied to any Windows securable
# object, e.g. file, registry key, service, etc. It consists of an owner, group,
# flags, DACL, and SACL. The SACL is not currently supported, though it has the
# same layout as... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/util/windows/monkey_patches/process.rb | Ruby | apache-2.0 | 7,843 | main | 13,020 | # frozen_string_literal: true
require 'ffi'
require_relative '../../../../puppet/ffi/windows'
require_relative '../../../../puppet/util/windows/string'
module Process
extend FFI::Library
extend Puppet::Util::Windows::String
extend Puppet::FFI::Windows::APITypes
extend Puppet::FFI::Windows::Functions
extend... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/util/command_line/trollop.rb | Ruby | apache-2.0 | 7,843 | main | 33,067 | # frozen_string_literal: true
## lib/trollop.rb -- trollop command-line processing library
## Author:: William Morgan (mailto: wmorgan-trollop@masanjin.net)
## Copyright:: Copyright 2007 William Morgan
## License:: the same terms as ruby itself
##
## 2012-03: small changes made by cprice (chris@puppetlabs.com);
#... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/util/command_line/puppet_option_parser.rb | Ruby | apache-2.0 | 7,843 | main | 3,186 | # frozen_string_literal: true
require_relative '../../../puppet/util/command_line/trollop'
module Puppet
module Util
class CommandLine
class PuppetOptionError < Puppet::Error
end
class TrollopCommandlineError < Puppet::Util::CommandLine::Trollop::CommandlineError; end
# This is a comma... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/context/trusted_information.rb | Ruby | apache-2.0 | 7,843 | main | 3,486 | # frozen_string_literal: true
require_relative '../../puppet/trusted_external'
# @api private
class Puppet::Context::TrustedInformation
# one of 'remote', 'local', or false, where 'remote' is authenticated via cert,
# 'local' is trusted by virtue of running on the same machine (not a remote
# request), and fals... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/interface/option.rb | Ruby | apache-2.0 | 7,843 | main | 6,255 | # frozen_string_literal: true
# This represents an option on an action or face (to be globally applied
# to its actions). Options should be constructed by calling
# {Puppet::Interface::OptionManager#option}, which is available on
# {Puppet::Interface}, and then calling methods of
# {Puppet::Interface::OptionBuilder} i... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/interface/option_manager.rb | Ruby | apache-2.0 | 7,843 | main | 3,183 | # frozen_string_literal: true
# This class is not actually public API, but the method
# {Puppet::Interface::OptionManager#option option} is public when used
# as part of the Faces DSL (i.e. from within a
# {Puppet::Interface.define define} block).
# @api public
module Puppet::Interface::OptionManager
# @api private
... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/interface/option_builder.rb | Ruby | apache-2.0 | 7,843 | main | 3,849 | # frozen_string_literal: true
# @api public
class Puppet::Interface::OptionBuilder
# The option under construction
# @return [Puppet::Interface::Option]
# @api private
attr_reader :option
# Build an option
# @return [Puppet::Interface::Option]
# @api private
def self.build(face, *declaration, &block)
... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/interface/action.rb | Ruby | apache-2.0 | 7,843 | main | 14,509 | # coding: utf-8
# frozen_string_literal: true
require 'prettyprint'
# This represents an action that is attached to a face. Actions should
# be constructed by calling {Puppet::Interface::ActionManager#action},
# which is available on {Puppet::Interface}, and then calling methods of
# {Puppet::Interface::ActionBuilder... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/interface/face_collection.rb | Ruby | apache-2.0 | 7,843 | main | 5,193 | # frozen_string_literal: true
module Puppet::Interface::FaceCollection
@faces = Hash.new { |hash, key| hash[key] = {} }
@loader = Puppet::Util::Autoload.new(:application, 'puppet/face')
def self.faces
unless @loaded
@loaded = true
names = @loader.files_to_load(Puppet.lookup(:current_environment... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/interface/action_manager.rb | Ruby | apache-2.0 | 7,843 | main | 3,283 | # frozen_string_literal: true
# This class is not actually public API, but the method
# {Puppet::Interface::ActionManager#action action} is public when used
# as part of the Faces DSL (i.e. from within a
# {Puppet::Interface.define define} block).
# @api public
module Puppet::Interface::ActionManager
# Declare that ... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/interface/action_builder.rb | Ruby | apache-2.0 | 7,843 | main | 5,659 | # frozen_string_literal: true
# This class is used to build {Puppet::Interface::Action actions}.
# When an action is defined with
# {Puppet::Interface::ActionManager#action} the block is evaluated
# within the context of a new instance of this class.
# @api public
class Puppet::Interface::ActionBuilder
extend Forwar... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/interface/documentation.rb | Ruby | apache-2.0 | 7,843 | main | 12,466 | # frozen_string_literal: true
class Puppet::Interface
# @api private
module DocGen
require_relative '../../puppet/util/docs'
# @api private
def self.strip_whitespace(text)
# I don't want no...
Puppet::Util::Docs.scrub(text)
end
# The documentation attributes all have some common b... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/module/task.rb | Ruby | apache-2.0 | 7,843 | main | 10,984 | # frozen_string_literal: true
require_relative '../../puppet/util/logging'
class Puppet::Module
class Task
class Error < Puppet::Error
attr_accessor :kind, :details
def initialize(message, kind, details = nil)
super(message)
@details = details || {}
@kind = kind
end
... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/module/plan.rb | Ruby | apache-2.0 | 7,843 | main | 5,151 | # frozen_string_literal: true
require_relative '../../puppet/util/logging'
class Puppet::Module
class Plan
class Error < Puppet::Error
attr_accessor :kind, :details
def initialize(message, kind, details = nil)
super(message)
@details = details || {}
@kind = kind
end
... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/module_tool/local_tarball.rb | Ruby | apache-2.0 | 7,843 | main | 2,501 | # frozen_string_literal: true
require 'pathname'
require 'tmpdir'
require_relative '../../puppet/forge'
require_relative '../../puppet/module_tool'
module Puppet::ModuleTool
class LocalTarball < SemanticPuppet::Dependency::Source
attr_accessor :release
def initialize(filename)
unpack(filename, tmpdi... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/module_tool/applications.rb | Ruby | apache-2.0 | 7,843 | main | 414 | # frozen_string_literal: true
require_relative '../../puppet/module_tool'
module Puppet::ModuleTool
module Applications
require_relative 'applications/application'
require_relative 'applications/checksummer'
require_relative 'applications/installer'
require_relative 'applications/unpacker'
requi... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/module_tool/checksums.rb | Ruby | apache-2.0 | 7,843 | main | 1,251 | # frozen_string_literal: true
require 'digest/md5'
require_relative '../../puppet/network/format_support'
module Puppet::ModuleTool
# = Checksums
#
# This class provides methods for generating checksums for data and adding
# them to +Metadata+.
class Checksums
include Puppet::Network::FormatSupport
... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/module_tool/installed_modules.rb | Ruby | apache-2.0 | 7,843 | main | 2,764 | # frozen_string_literal: true
require 'pathname'
require_relative '../../puppet/forge'
require_relative '../../puppet/module_tool'
module Puppet::ModuleTool
class InstalledModules < SemanticPuppet::Dependency::Source
attr_reader :modules, :by_name
def priority
10
end
def initialize(env)
... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/module_tool/dependency.rb | Ruby | apache-2.0 | 7,843 | main | 1,512 | # frozen_string_literal: true
require_relative '../../puppet/module_tool'
require_relative '../../puppet/network/format_support'
module Puppet::ModuleTool
class Dependency
include Puppet::Network::FormatSupport
attr_reader :full_module_name, :username, :name, :version_requirement, :repository
# Instan... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/module_tool/metadata.rb | Ruby | apache-2.0 | 7,843 | main | 7,610 | # frozen_string_literal: true
require_relative '../../puppet/module_tool'
require_relative '../../puppet/network/format_support'
require 'uri'
require_relative '../../puppet/util/json'
require 'set'
module Puppet::ModuleTool
# This class provides a data structure representing a module's metadata.
# @api private
... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/module_tool/tar.rb | Ruby | apache-2.0 | 7,843 | main | 550 | # frozen_string_literal: true
require_relative '../../puppet/module_tool'
require_relative '../../puppet/util'
module Puppet::ModuleTool::Tar
require_relative 'tar/gnu'
require_relative 'tar/mini'
def self.instance
if Puppet.features.minitar? && Puppet.features.zlib?
Mini.new
elsif Puppet::Util.w... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/module_tool/install_directory.rb | Ruby | apache-2.0 | 7,843 | main | 1,448 | # frozen_string_literal: true
require_relative '../../puppet/module_tool'
require_relative '../../puppet/module_tool/errors'
module Puppet
module ModuleTool
# Control the install location for modules.
class InstallDirectory
include Puppet::ModuleTool::Errors
attr_reader :target
def initi... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/module_tool/contents_description.rb | Ruby | apache-2.0 | 7,843 | main | 2,894 | # frozen_string_literal: true
require_relative '../../puppet/module_tool'
module Puppet::ModuleTool
# = ContentsDescription
#
# This class populates +Metadata+'s Puppet type information.
class ContentsDescription
# Instantiate object for string +module_path+.
def initialize(module_path)
@module_... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/module_tool/shared_behaviors.rb | Ruby | apache-2.0 | 7,843 | main | 6,778 | # frozen_string_literal: true
module Puppet::ModuleTool::Shared
include Puppet::ModuleTool::Errors
def get_local_constraints
@local = Hash.new { |h, k| h[k] = {} }
@conditions = Hash.new { |h, k| h[k] = [] }
@installed = Hash.new { |h, k| h[k] = [] }
@environment.modules_by_path.values.flat... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/module_tool/errors.rb | Ruby | apache-2.0 | 7,843 | main | 321 | # frozen_string_literal: true
require_relative '../../puppet/module_tool'
module Puppet::ModuleTool
module Errors
require_relative 'errors/base'
require_relative 'errors/installer'
require_relative 'errors/uninstaller'
require_relative 'errors/upgrader'
require_relative 'errors/shared'
end
end |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/module_tool/applications/unpacker.rb | Ruby | apache-2.0 | 7,843 | main | 3,217 | # frozen_string_literal: true
require 'pathname'
require 'tmpdir'
require_relative '../../../puppet/util/json'
require_relative '../../../puppet/file_system'
module Puppet::ModuleTool
module Applications
class Unpacker < Application
def self.unpack(filename, target)
app = new(filename, :target_dir... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/module_tool/applications/installer.rb | Ruby | apache-2.0 | 7,843 | main | 15,354 | # frozen_string_literal: true
require 'open-uri'
require 'pathname'
require 'fileutils'
require 'tmpdir'
require_relative '../../../puppet/forge'
require_relative '../../../puppet/module_tool'
require_relative '../../../puppet/module_tool/shared_behaviors'
require_relative '../../../puppet/module_tool/install_directo... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/module_tool/applications/upgrader.rb | Ruby | apache-2.0 | 7,843 | main | 10,953 | # frozen_string_literal: true
require 'pathname'
require_relative '../../../puppet/forge'
require_relative '../../../puppet/module_tool'
require_relative '../../../puppet/module_tool/shared_behaviors'
require_relative '../../../puppet/module_tool/install_directory'
require_relative '../../../puppet/module_tool/instal... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/module_tool/applications/checksummer.rb | Ruby | apache-2.0 | 7,843 | main | 1,860 | # frozen_string_literal: true
require_relative '../../../puppet/util/json'
require_relative '../../../puppet/module_tool/checksums'
module Puppet::ModuleTool
module Applications
class Checksummer < Application
def initialize(path, options = {})
@path = Pathname.new(path)
super(options)
... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/module_tool/applications/application.rb | Ruby | apache-2.0 | 7,843 | main | 2,963 | # frozen_string_literal: true
require 'net/http'
require_relative '../../../puppet/util/json'
require_relative '../../../puppet/util/colors'
module Puppet::ModuleTool
module Applications
class Application
include Puppet::Util::Colors
def self.run(*args)
new(*args).run
end
attr_... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/module_tool/applications/uninstaller.rb | Ruby | apache-2.0 | 7,843 | main | 3,945 | # frozen_string_literal: true
module Puppet::ModuleTool
module Applications
class Uninstaller < Application
include Puppet::ModuleTool::Errors
def initialize(name, options)
@name = name
@options = options
@errors = Hash.new { |h, k| h[k] = {} }
@unfilt... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/module_tool/errors/base.rb | Ruby | apache-2.0 | 7,843 | main | 387 | # frozen_string_literal: true
module Puppet::ModuleTool::Errors
class ModuleToolError < Puppet::Error
def v(version)
(version || '???').to_s.sub(/^(?=\d)/, 'v')
end
def vstring
if @action == :upgrade
"#{v(@installed_version)} -> #{v(@requested_version)}"
else
v(@install... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/module_tool/errors/shared.rb | Ruby | apache-2.0 | 7,843 | main | 11,345 | # frozen_string_literal: true
module Puppet::ModuleTool::Errors
class NoVersionsSatisfyError < ModuleToolError
def initialize(options)
@requested_name = options[:requested_name]
@requested_version = options[:requested_version]
@installed_version = options[:installed_version]
@condition... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/module_tool/errors/uninstaller.rb | Ruby | apache-2.0 | 7,843 | main | 2,444 | # frozen_string_literal: true
module Puppet::ModuleTool::Errors
class UninstallError < ModuleToolError; end
class NoVersionMatchesError < UninstallError
def initialize(options)
@module_name = options[:module_name]
@modules = options[:installed_modules]
@version = options[:version_ran... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/module_tool/errors/upgrader.rb | Ruby | apache-2.0 | 7,843 | main | 2,633 | # frozen_string_literal: true
module Puppet::ModuleTool::Errors
class UpgradeError < ModuleToolError
def initialize(msg)
@action = :upgrade
super
end
end
class VersionAlreadyInstalledError < UpgradeError
attr_reader :newer_versions
def initialize(options)
@module_name = ... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/module_tool/errors/installer.rb | Ruby | apache-2.0 | 7,843 | main | 4,736 | # frozen_string_literal: true
module Puppet::ModuleTool::Errors
class InstallError < ModuleToolError; end
class AlreadyInstalledError < InstallError
def initialize(options)
@module_name = options[:module_name]
@installed_version = v(options[:installed_version])
@requested_version = v(o... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/module_tool/tar/gnu.rb | Ruby | apache-2.0 | 7,843 | main | 989 | # frozen_string_literal: true
require 'shellwords'
class Puppet::ModuleTool::Tar::Gnu
def unpack(sourcefile, destdir, owner)
safe_sourcefile = Shellwords.shellescape(File.expand_path(sourcefile))
destdir = File.expand_path(destdir)
safe_destdir = Shellwords.shellescape(destdir)
Puppet::Util::Execut... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/module_tool/tar/mini.rb | Ruby | apache-2.0 | 7,843 | main | 4,136 | # frozen_string_literal: true
class Puppet::ModuleTool::Tar::Mini
def unpack(sourcefile, destdir, _)
Zlib::GzipReader.open(sourcefile) do |reader|
# puppet doesn't have a hard dependency on minitar, so we
# can't be certain which version is installed. If it's 0.9
# or above then we can prevent ... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/settings/array_setting.rb | Ruby | apache-2.0 | 7,843 | main | 363 | # frozen_string_literal: true
class Puppet::Settings::ArraySetting < Puppet::Settings::BaseSetting
def type
:array
end
def munge(value)
case value
when String
value.split(/\s*,\s*/)
when Array
value
else
raise ArgumentError, _("Expected an Array or String, got a %{klass}") ... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/settings/directory_setting.rb | Ruby | apache-2.0 | 7,843 | main | 624 | # frozen_string_literal: true
class Puppet::Settings::DirectorySetting < Puppet::Settings::FileSetting
def type
:directory
end
# @api private
#
# @param option [String] Extra file operation mode information to use
# (defaults to read-only mode 'r')
# This is the standard mechanism Ruby uses in t... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/settings/duration_setting.rb | Ruby | apache-2.0 | 7,843 | main | 1,073 | # frozen_string_literal: true
# A setting that represents a span of time, and evaluates to an integer
# number of seconds after being parsed
class Puppet::Settings::DurationSetting < Puppet::Settings::BaseSetting
# How we convert from various units to seconds.
UNITMAP = {
# 365 days isn't technically a year, b... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/settings/value_translator.rb | Ruby | apache-2.0 | 7,843 | main | 377 | # frozen_string_literal: true
# Convert arguments into booleans, integers, or whatever.
class Puppet::Settings::ValueTranslator
def [](value)
# Handle different data types correctly
case value
when /^false$/i; false
when /^true$/i; true
when true; true
when false; false
else
value.g... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/settings/server_list_setting.rb | Ruby | apache-2.0 | 7,843 | main | 602 | # frozen_string_literal: true
class Puppet::Settings::ServerListSetting < Puppet::Settings::ArraySetting
def type
:server_list
end
def print(value)
if value.is_a?(Array)
# turn into a string
value.map { |item| item.join(":") }.join(",")
else
value
end
end
def munge(value)
... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/settings/base_setting.rb | Ruby | apache-2.0 | 7,843 | main | 7,234 | # frozen_string_literal: true
require 'set'
require_relative '../../puppet/settings/errors'
# The base setting type
class Puppet::Settings::BaseSetting
attr_writer :default
attr_accessor :name, :desc, :section
attr_reader :short, :deprecated, :call_hook
# Hooks are called during different parts of the settin... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/settings/terminus_setting.rb | Ruby | apache-2.0 | 7,843 | main | 360 | # frozen_string_literal: true
class Puppet::Settings::TerminusSetting < Puppet::Settings::BaseSetting
def munge(value)
case value
when '', nil
nil
when String
value.intern
when Symbol
value
else
raise Puppet::Settings::ValidationError, _("Invalid terminus setting: %{value}... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/settings/ttl_setting.rb | Ruby | apache-2.0 | 7,843 | main | 1,716 | # frozen_string_literal: true
# A setting that represents a span of time to live, and evaluates to Numeric
# seconds to live where 0 means shortest possible time to live, a positive numeric value means time
# to live in seconds, and the symbolic entry 'unlimited' is an infinite amount of time.
#
class Puppet::Settings... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/settings/alias_setting.rb | Ruby | apache-2.0 | 7,843 | main | 689 | # frozen_string_literal: true
class Puppet::Settings::AliasSetting
attr_reader :name, :alias_name
def initialize(args = {})
@name = args[:name]
@alias_name = args[:alias_for]
@alias_for = Puppet.settings.setting(alias_name)
end
def optparse_args
args = @alias_for.optparse_args
args[0].gsu... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/settings/http_extra_headers_setting.rb | Ruby | apache-2.0 | 7,843 | main | 682 | # frozen_string_literal: true
class Puppet::Settings::HttpExtraHeadersSetting < Puppet::Settings::BaseSetting
def type
:http_extra_headers
end
def munge(headers)
return headers if headers.is_a?(Hash)
headers = headers.split(/\s*,\s*/) if headers.is_a?(String)
raise ArgumentError, _("Expected a... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/settings/integer_setting.rb | Ruby | apache-2.0 | 7,843 | main | 453 | # frozen_string_literal: true
class Puppet::Settings::IntegerSetting < Puppet::Settings::BaseSetting
def munge(value)
return value if value.is_a?(Integer)
begin
value = Integer(value)
rescue ArgumentError, TypeError
raise Puppet::Settings::ValidationError, _("Cannot convert '%{value}' to an ... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/settings/environment_conf.rb | Ruby | apache-2.0 | 7,843 | main | 8,083 | # frozen_string_literal: true
# Configuration settings for a single directory Environment.
# @api private
class Puppet::Settings::EnvironmentConf
ENVIRONMENT_CONF_ONLY_SETTINGS = [:modulepath, :manifest, :config_version].freeze
VALID_SETTINGS = (ENVIRONMENT_CONF_ONLY_SETTINGS + [:environment_timeout, :environment_... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/settings/certificate_revocation_setting.rb | Ruby | apache-2.0 | 7,843 | main | 575 | # frozen_string_literal: true
require_relative '../../puppet/settings/base_setting'
class Puppet::Settings::CertificateRevocationSetting < Puppet::Settings::BaseSetting
def type
:certificate_revocation
end
def munge(value)
case value
when 'chain', 'true', TrueClass
:chain
when 'leaf'
... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/settings/file_setting.rb | Ruby | apache-2.0 | 7,843 | main | 6,737 | # frozen_string_literal: true
# A file.
class Puppet::Settings::FileSetting < Puppet::Settings::StringSetting
class SettingError < StandardError; end
# An unspecified user or group
#
# @api private
class Unspecified
def value
nil
end
end
# A "root" user or group
#
# @api private
cla... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/settings/port_setting.rb | Ruby | apache-2.0 | 7,843 | main | 398 | # frozen_string_literal: true
class Puppet::Settings::PortSetting < Puppet::Settings::IntegerSetting
def munge(value)
value = super(value)
if value < 0 || value > 65_535
raise Puppet::Settings::ValidationError, _("Value '%{value}' is not a valid port number for parameter: %{name}") % { value: value.in... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/settings/path_setting.rb | Ruby | apache-2.0 | 7,843 | main | 282 | # frozen_string_literal: true
class Puppet::Settings::PathSetting < Puppet::Settings::StringSetting
def munge(value)
if value.is_a?(String)
value = value.split(File::PATH_SEPARATOR).map { |d| File.expand_path(d) }.join(File::PATH_SEPARATOR)
end
value
end
end |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/settings/errors.rb | Ruby | apache-2.0 | 7,843 | main | 350 | # frozen_string_literal: true
# Exceptions for the settings module
require_relative '../../puppet/error'
class Puppet::Settings
class SettingsError < Puppet::Error; end
class ValidationError < SettingsError; end
class InterpolationError < SettingsError; end
class ParseError < SettingsError
include Puppet... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/settings/config_file.rb | Ruby | apache-2.0 | 7,843 | main | 4,877 | # frozen_string_literal: true
require_relative '../../puppet/settings/ini_file'
##
# @api private
#
# Parses puppet configuration files
#
class Puppet::Settings::ConfigFile
##
# @param value_converter [Proc] a function that will convert strings into ruby types
def initialize(value_converter)
@value_converte... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/settings/boolean_setting.rb | Ruby | apache-2.0 | 7,843 | main | 854 | # frozen_string_literal: true
# A simple boolean.
class Puppet::Settings::BooleanSetting < Puppet::Settings::BaseSetting
# get the arguments in getopt format
def getopt_args
if short
[["--#{name}", "-#{short}", GetoptLong::NO_ARGUMENT], ["--no-#{name}", GetoptLong::NO_ARGUMENT]]
else
[["--#{nam... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/settings/symbolic_enum_setting.rb | Ruby | apache-2.0 | 7,843 | main | 496 | # frozen_string_literal: true
class Puppet::Settings::SymbolicEnumSetting < Puppet::Settings::BaseSetting
attr_accessor :values
def type
:symbolic_enum
end
def munge(value)
sym = value.to_sym
if values.include?(sym)
sym
else
raise Puppet::Settings::ValidationError,
_("... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/settings/string_setting.rb | Ruby | apache-2.0 | 7,843 | main | 201 | # frozen_string_literal: true
class Puppet::Settings::StringSetting < Puppet::Settings::BaseSetting
def type
:string
end
def validate(value)
value.nil? or value.is_a?(String)
end
end |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/settings/enum_setting.rb | Ruby | apache-2.0 | 7,843 | main | 460 | # frozen_string_literal: true
class Puppet::Settings::EnumSetting < Puppet::Settings::BaseSetting
attr_accessor :values
def type
:enum
end
def munge(value)
if values.include?(value)
value
else
raise Puppet::Settings::ValidationError,
_("Invalid value '%{value}' for paramet... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/settings/priority_setting.rb | Ruby | apache-2.0 | 7,843 | main | 1,315 | # frozen_string_literal: true
require_relative '../../puppet/settings/base_setting'
# A setting that represents a scheduling priority, and evaluates to an
# OS-specific priority level.
class Puppet::Settings::PrioritySetting < Puppet::Settings::BaseSetting
PRIORITY_MAP =
if Puppet::Util::Platform.windows?
... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/settings/file_or_directory_setting.rb | Ruby | apache-2.0 | 7,843 | main | 1,025 | # frozen_string_literal: true
class Puppet::Settings::FileOrDirectorySetting < Puppet::Settings::FileSetting
def type
if Puppet::FileSystem.directory?(value) || @path_ends_with_slash
:directory
else
:file
end
end
# Overrides munge to be able to read the un-munged value (the FileSetting.m... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/settings/ini_file.rb | Ruby | apache-2.0 | 7,843 | main | 5,277 | # frozen_string_literal: true
# @api private
class Puppet::Settings::IniFile
DEFAULT_SECTION_NAME = "main"
def self.update(config_fh, &block)
config = parse(config_fh)
manipulator = Manipulator.new(config)
yield manipulator
config.write(config_fh)
end
def self.parse(config_fh)
config = ne... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/settings/autosign_setting.rb | Ruby | apache-2.0 | 7,843 | main | 742 | # frozen_string_literal: true
require_relative '../../puppet/settings/base_setting'
# A specialization of the file setting to allow boolean values.
#
# The autosign value can be either a boolean or a file path, and if the setting
# is a file path then it may have a owner/group/mode specified.
#
# @api private
class P... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/metatype/manager.rb | Ruby | apache-2.0 | 7,843 | main | 6,802 | # frozen_string_literal: true
require_relative '../../puppet'
require_relative '../../puppet/util/classgen'
require_relative '../../puppet/node/environment'
# This module defines methods dealing with Type management.
# This module gets included into the Puppet::Type class, it's just split out here for clarity.
# @api... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/gettext/config.rb | Ruby | apache-2.0 | 7,843 | main | 10,290 | # frozen_string_literal: true
require_relative '../../puppet/util/platform'
require_relative '../../puppet/file_system'
module Puppet::GettextConfig
LOCAL_PATH = File.absolute_path('../../../locales', File.dirname(__FILE__))
POSIX_PATH = File.absolute_path('../../../../../share/locale', File.dirname(__FILE__))
... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/gettext/stubs.rb | Ruby | apache-2.0 | 7,843 | main | 283 | # frozen_string_literal: true
# These stub the translation methods normally brought in
# by FastGettext. Used when Gettext could not be properly
# initialized.
def _(msg)
msg
end
def n_(*args, &block)
plural = args[2] == 1 ? args[0] : args[1]
block ? block.call : plural
end |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/gettext/module_translations.rb | Ruby | apache-2.0 | 7,843 | main | 1,900 | # frozen_string_literal: true
require_relative '../../puppet/gettext/config'
module Puppet::ModuleTranslations
# @api private
# Loads translation files for each of the specified modules,
# if present. Requires the modules to have `forge_name` specified.
# @param [[Module]] modules a list of modules for which ... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/concurrent/thread_local_singleton.rb | Ruby | apache-2.0 | 7,843 | main | 387 | # frozen_string_literal: true
module Puppet
module Concurrent
module ThreadLocalSingleton
def singleton
key = (name + ".singleton").intern
thread = Thread.current
value = thread.thread_variable_get(key)
if value.nil?
value = new
thread.thread_variable_set... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/concurrent/lock.rb | Ruby | apache-2.0 | 7,843 | main | 286 | # frozen_string_literal: true
require_relative '../../puppet/concurrent/synchronized'
module Puppet
module Concurrent
# A simple lock that at the moment only does any locking on jruby
class Lock
include Puppet::Concurrent::Synchronized
def synchronize
yield
end
end
end
end |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/concurrent/synchronized.rb | Ruby | apache-2.0 | 7,843 | main | 402 | # frozen_string_literal: true
module Puppet
module Concurrent
# Including Puppet::Concurrent::Synchronized into a class when running on JRuby
# causes all of its instance methods to be synchronized on the instance itself.
# When running on MRI it has no effect.
if RUBY_PLATFORM == 'java'
require 'jruby/synchronized'... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/pal/function_signature.rb | Ruby | apache-2.0 | 7,843 | main | 2,266 | # frozen_string_literal: true
module Puppet
module Pal
# A FunctionSignature is returned from `function_signature`. Its purpose is to answer questions about the function's parameters
# and if it can be called with a set of parameters.
#
# It is also possible to get an array of puppet Callable data type where e... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/pal/json_catalog_encoder.rb | Ruby | apache-2.0 | 7,843 | main | 2,713 | # frozen_string_literal: true
# The JsonCatalogEncoder is a wrapper around a catalog produced by the Pal::CatalogCompiler.with_json_encoding
# method.
# It allows encoding the entire catalog or an individual resource as Rich Data Json.
#
# @api public
#
module Puppet
module Pal
class JsonCatalogEncoder
# Is the resu... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/pal/catalog_compiler.rb | Ruby | apache-2.0 | 7,843 | main | 3,937 | # frozen_string_literal: true
module Puppet
module Pal
# A CatalogCompiler is a compiler that builds a catalog of resources and dependencies as a side effect of
# evaluating puppet language code.
# When the compilation of the given input manifest(s)/code string/file is finished the catalog is complete
# for en... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/pal/task_signature.rb | Ruby | apache-2.0 | 7,843 | main | 2,400 | # frozen_string_literal: true
module Puppet
module Pal
# A TaskSignature is returned from `task_signature`. Its purpose is to answer questions about the task's parameters
# and if it can be run/called with a hash of named parameters.
#
class TaskSignature
def initialize(task)
@task = task
end
... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/pal/compiler.rb | Ruby | apache-2.0 | 7,843 | main | 10,359 | # frozen_string_literal: true
module Puppet
module Pal
# A configured compiler as obtained in the callback from `Puppet::Pal.with_script_compiler`.
# (Later, there may also be a catalog compiler available.)
#
class Compiler
attr_reader :internal_compiler
protected :internal_compiler
attr_reader :i... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/pal/plan_signature.rb | Ruby | apache-2.0 | 7,843 | main | 2,805 | # frozen_string_literal: true
module Puppet
module Pal
# A PlanSignature is returned from `plan_signature`. Its purpose is to answer questions about the plans's parameters
# and if it can be called with a hash of named parameters.
#
# @api public
#
class PlanSignature
def initialize(plan_function)
... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/pal/script_compiler.rb | Ruby | apache-2.0 | 7,843 | main | 3,366 | # frozen_string_literal: true
module Puppet
module Pal
class ScriptCompiler < Compiler
# Returns the signature of the given plan name
# @param plan_name [String] the name of the plan to get the signature of
# @return [Puppet::Pal::PlanSignature, nil] returns a PlanSignature, or nil if plan is not found
... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/pal/pal_impl.rb | Ruby | apache-2.0 | 7,843 | main | 26,600 | # frozen_string_literal: true
# Puppet as a Library "PAL"
# Yes, this requires all of puppet for now because 'settings' and many other things...
require_relative '../../puppet'
require_relative '../../puppet/parser/script_compiler'
require_relative '../../puppet/parser/catalog_compiler'
module Puppet
# This is the m... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/pal/pal_api.rb | Ruby | apache-2.0 | 7,843 | main | 625 | # frozen_string_literal: true
module Puppet
require_relative '../../puppet/parser/script_compiler'
require_relative '../../puppet/parser/catalog_compiler'
module Pal
require_relative '../../puppet/pal/json_catalog_encoder'
require_relative '../../puppet/pal/function_signature'
require_relative '../.... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/file_serving/terminus_helper.rb | Ruby | apache-2.0 | 7,843 | main | 1,143 | # frozen_string_literal: true
require_relative '../../puppet/file_serving'
require_relative '../../puppet/file_serving/fileset'
# Define some common methods for FileServing termini.
module Puppet::FileServing::TerminusHelper
# Create model instance for a file in a file server.
def path2instance(request, path, op... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/file_serving/terminus_selector.rb | Ruby | apache-2.0 | 7,843 | main | 849 | # frozen_string_literal: true
require_relative '../../puppet/file_serving'
# This module is used to pick the appropriate terminus
# in file-serving indirections. This is necessary because
# the terminus varies based on the URI asked for.
module Puppet::FileServing::TerminusSelector
def select(request)
# We rel... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/file_serving/fileset.rb | Ruby | apache-2.0 | 7,843 | main | 6,721 | # frozen_string_literal: true
require 'find'
require_relative '../../puppet/file_serving'
require_relative '../../puppet/file_serving/metadata'
# Operate recursively on a path, returning a set of file paths.
class Puppet::FileServing::Fileset
attr_reader :path, :ignore, :links
attr_accessor :recurse, :recurselimi... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/file_serving/mount.rb | Ruby | apache-2.0 | 7,843 | main | 843 | # frozen_string_literal: true
require_relative '../../puppet/util/logging'
require_relative '../../puppet/file_serving'
require_relative '../../puppet/file_serving/metadata'
require_relative '../../puppet/file_serving/content'
# Broker access to the filesystem, converting local URIs into metadata
# or content objects... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/file_serving/configuration.rb | Ruby | apache-2.0 | 7,843 | main | 3,395 | # frozen_string_literal: true
require_relative '../../puppet'
require_relative '../../puppet/file_serving'
require_relative '../../puppet/file_serving/mount'
require_relative '../../puppet/file_serving/mount/file'
require_relative '../../puppet/file_serving/mount/modules'
require_relative '../../puppet/file_serving/mo... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/file_serving/metadata.rb | Ruby | apache-2.0 | 7,843 | main | 5,556 | # frozen_string_literal: true
require_relative '../../puppet'
require_relative '../../puppet/indirector'
require_relative '../../puppet/file_serving'
require_relative '../../puppet/file_serving/base'
require_relative '../../puppet/util/checksums'
require 'uri'
# A class that handles retrieving file metadata.
class Pu... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/file_serving/content.rb | Ruby | apache-2.0 | 7,843 | main | 1,194 | # frozen_string_literal: true
require_relative '../../puppet/indirector'
require_relative '../../puppet/file_serving'
require_relative '../../puppet/file_serving/base'
# A class that handles retrieving file contents.
# It only reads the file when its content is specifically
# asked for.
class Puppet::FileServing::Con... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/file_serving/base.rb | Ruby | apache-2.0 | 7,843 | main | 2,552 | # frozen_string_literal: true
require_relative '../../puppet/file_serving'
require_relative '../../puppet/util'
# The base class for Content and Metadata; provides common
# functionality like the behaviour around links.
class Puppet::FileServing::Base
# This is for external consumers to store the source that was us... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/file_serving/http_metadata.rb | Ruby | apache-2.0 | 7,843 | main | 1,906 | # frozen_string_literal: true
require_relative '../../puppet/file_serving/metadata'
# Simplified metadata representation, suitable for the information
# that is available from HTTP headers.
class Puppet::FileServing::HttpMetadata < Puppet::FileServing::Metadata
def initialize(http_response, path = '/dev/null')
... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/file_serving/configuration/parser.rb | Ruby | apache-2.0 | 7,843 | main | 3,867 | # frozen_string_literal: true
require_relative '../../../puppet/file_serving/configuration'
require_relative '../../../puppet/util/watched_file'
class Puppet::FileServing::Configuration::Parser
Mount = Puppet::FileServing::Mount
MODULES = 'modules'
# Parse our configuration file.
def parse
raise(_("File ... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/file_serving/mount/pluginfacts.rb | Ruby | apache-2.0 | 7,843 | main | 1,136 | # frozen_string_literal: true
require_relative '../../../puppet/file_serving/mount'
# Find files in the modules' pluginfacts directories.
# This is a very strange mount because it merges
# many directories into one.
class Puppet::FileServing::Mount::PluginFacts < Puppet::FileServing::Mount
# Return an instance of t... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/file_serving/mount/tasks.rb | Ruby | apache-2.0 | 7,843 | main | 533 | # frozen_string_literal: true
require_relative '../../../puppet/file_serving/mount'
class Puppet::FileServing::Mount::Tasks < Puppet::FileServing::Mount
def find(path, request)
raise _("No task specified") if path.to_s.empty?
module_name, task_path = path.split("/", 2)
mod = request.environment.module(... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/file_serving/mount/locales.rb | Ruby | apache-2.0 | 7,843 | main | 1,111 | # frozen_string_literal: true
require_relative '../../../puppet/file_serving/mount'
# Find files in the modules' locales directories.
# This is a very strange mount because it merges
# many directories into one.
class Puppet::FileServing::Mount::Locales < Puppet::FileServing::Mount
# Return an instance of the appro... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/file_serving/mount/scripts.rb | Ruby | apache-2.0 | 7,843 | main | 573 | # frozen_string_literal: true
require 'puppet/file_serving/mount'
class Puppet::FileServing::Mount::Scripts < Puppet::FileServing::Mount
# Return an instance of the appropriate class.
def find(path, request)
raise _("No module specified") if path.to_s.empty?
module_name, relative_path = path.split("/", 2... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/file_serving/mount/plugins.rb | Ruby | apache-2.0 | 7,843 | main | 1,111 | # frozen_string_literal: true
require_relative '../../../puppet/file_serving/mount'
# Find files in the modules' plugins directories.
# This is a very strange mount because it merges
# many directories into one.
class Puppet::FileServing::Mount::Plugins < Puppet::FileServing::Mount
# Return an instance of the appro... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/file_serving/mount/modules.rb | Ruby | apache-2.0 | 7,843 | main | 685 | # frozen_string_literal: true
require_relative '../../../puppet/file_serving/mount'
# This is the modules-specific mount: it knows how to search through
# modules for files. Yay.
class Puppet::FileServing::Mount::Modules < Puppet::FileServing::Mount
# Return an instance of the appropriate class.
def find(path, r... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/file_serving/mount/file.rb | Ruby | apache-2.0 | 7,843 | main | 3,157 | # frozen_string_literal: true
require_relative '../../../puppet/file_serving/mount'
class Puppet::FileServing::Mount::File < Puppet::FileServing::Mount
def self.localmap
@localmap ||= {
"h" => Puppet.runtime[:facter].value('networking.hostname'),
"H" => [
Puppet.runtime[:facter].value('netwo... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/pops/adapters.rb | Ruby | apache-2.0 | 7,843 | main | 5,409 | # frozen_string_literal: true
# The Adapters module contains adapters for Documentation, Origin, SourcePosition, and Loader.
#
module Puppet::Pops
module Adapters
class ObjectIdCacheAdapter < Puppet::Pops::Adaptable::Adapter
attr_accessor :cache
def initialize
@cache = {}
end
# Retrieves a mu... |
github | puppetlabs/puppet | https://github.com/puppetlabs/puppet | lib/puppet/pops/adaptable.rb | Ruby | apache-2.0 | 7,843 | main | 8,032 | # frozen_string_literal: true
# Adaptable is a mix-in module that adds adaptability to a class.
# This means that an adapter can
# associate itself with an instance of the class and store additional data/have behavior.
#
# This mechanism should be used when there is a desire to keep implementation concerns separate.
#... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.