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/psych_support.rb
Ruby
apache-2.0
7,843
main
1,423
# frozen_string_literal: true # This module should be included when a class can be serialized to yaml and # needs to handle the deserialization from Psych with more control. Psych normally # pokes values directly into an instance using `instance_variable_set` which completely # bypasses encapsulation. # # The class th...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/network_device.rb
Ruby
apache-2.0
7,843
main
602
# frozen_string_literal: true class Puppet::Util::NetworkDevice class << self attr_reader :current end def self.init(device) require "puppet/util/network_device/#{device.provider}/device" @current = Puppet::Util::NetworkDevice.const_get(device.provider.capitalize).const_get(:Device).new(device.url, ...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/character_encoding.rb
Ruby
apache-2.0
7,843
main
3,779
# frozen_string_literal: true # A module to centralize heuristics/practices for managing character encoding in Puppet module Puppet::Util::CharacterEncoding class << self # Given a string, attempts to convert a copy of the string to UTF-8. Conversion uses # encode - the string's internal byte representation...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/symbolic_file_mode.rb
Ruby
apache-2.0
7,843
main
4,804
# frozen_string_literal: true require_relative '../../puppet/util' module Puppet module Util module SymbolicFileMode SetUIDBit = ReadBit = 4 SetGIDBit = WriteBit = 2 StickyBit = ExecBit = 1 SymbolicMode = { 'x' => ExecBit, 'w' => WriteBit, 'r' => ReadBit } SymbolicSpecialToBit = { 't' => { 'u' => Stic...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/watched_file.rb
Ruby
apache-2.0
7,843
main
1,309
# frozen_string_literal: true require_relative '../../puppet/util/watcher' # Monitor a given file for changes on a periodic interval. Changes are detected # by looking for a change in the file ctime. class Puppet::Util::WatchedFile # @!attribute [r] filename # @return [String] The fully qualified path to the fi...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/checksums.rb
Ruby
apache-2.0
7,843
main
7,614
# frozen_string_literal: true require 'digest/md5' require 'digest/sha1' require 'time' # A stand-alone module for calculating checksums # in a generic way. module Puppet::Util::Checksums module_function # If you modify this, update puppet/type/file/checksum.rb too KNOWN_CHECKSUMS = [ :sha256, :sha256lite,...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/watcher.rb
Ruby
apache-2.0
7,843
main
446
# frozen_string_literal: true module Puppet::Util::Watcher require_relative 'watcher/timer' require_relative 'watcher/change_watcher' require_relative 'watcher/periodic_watcher' module Common def self.file_ctime_change_watcher(filename) Puppet::Util::Watcher::ChangeWatcher.watch(lambda do Pu...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/tag_set.rb
Ruby
apache-2.0
7,843
main
511
# frozen_string_literal: true require 'set' require_relative '../../puppet/network/format_support' class Puppet::Util::TagSet < Set include Puppet::Network::FormatSupport def self.from_yaml(yaml) new(Puppet::Util::Yaml.safe_load(yaml, [Symbol])) end def to_yaml @hash.keys.to_yaml end def self.f...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/log.rb
Ruby
apache-2.0
7,843
main
12,632
# frozen_string_literal: true require_relative '../../puppet/util/tagging' require_relative '../../puppet/util/classgen' require_relative '../../puppet/util/psych_support' require_relative '../../puppet/network/format_support' # Pass feedback to the user. Log levels are modeled after syslog's, and it is # expected t...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/metaid.rb
Ruby
apache-2.0
7,843
main
561
# frozen_string_literal: true class Object # The hidden singleton lurks behind everyone def singleton_class; class << self; self; end; end def meta_eval(&blk); singleton_class.instance_eval(&blk); end # Adds methods to a singleton_class def meta_def(name, &blk) meta_eval { define_method name, &blk } e...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/file_watcher.rb
Ruby
apache-2.0
7,843
main
462
# frozen_string_literal: true class Puppet::Util::FileWatcher include Enumerable def each(&blk) @files.keys.each(&blk) end def initialize @files = {} end def changed? @files.values.any?(&:changed?) end def watch(filename) return if watching?(filename) @files[filename] = Puppet:...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/suidmanager.rb
Ruby
apache-2.0
7,843
main
5,508
# frozen_string_literal: true require_relative '../../puppet/util/warnings' require 'forwardable' require 'etc' module Puppet::Util::SUIDManager include Puppet::Util::Warnings extend Forwardable # Note groups= is handled specially due to a bug in OS X 10.6, 10.7, # and probably upcoming releases... to_dele...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/storage.rb
Ruby
apache-2.0
7,843
main
2,693
# frozen_string_literal: true require 'yaml' require 'singleton' require_relative '../../puppet/util/yaml' # a class for storing state class Puppet::Util::Storage include Singleton include Puppet::Util def self.state @@state end def initialize self.class.load end # Return a hash that will be ...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/classgen.rb
Ruby
apache-2.0
7,843
main
7,508
# frozen_string_literal: true module Puppet class ConstantAlreadyDefined < Error; end class SubclassAlreadyDefined < Error; end end # This is a utility module for generating classes. # @api public # module Puppet::Util::ClassGen include Puppet::Util # Create a new class. # @param name [String] the name of ...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/diff.rb
Ruby
apache-2.0
7,843
main
2,075
# frozen_string_literal: true require 'tempfile' # Provide a diff between two strings. module Puppet::Util::Diff include Puppet::Util::Execution require 'tempfile' def diff(old, new) diff_cmd = Puppet[:diff] return '' unless diff_cmd && diff_cmd != "" command = [diff_cmd] args = Puppet[:diff_a...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/json.rb
Ruby
apache-2.0
7,843
main
3,164
# frozen_string_literal: true module Puppet::Util module Json class ParseError < StandardError attr_reader :cause, :data def self.build(original_exception, data) new(original_exception.message).tap do |exception| exception.instance_eval do @cause = original_exception ...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/errors.rb
Ruby
apache-2.0
7,843
main
6,268
# frozen_string_literal: true # Some helper methods for throwing and populating errors. # # @api public module Puppet::Util::Errors # Throw a Puppet::DevError with the specified message. Used for unknown or # internal application failures. # # @param msg [String] message used in raised error # @raise [Puppe...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/terminal.rb
Ruby
apache-2.0
7,843
main
559
# frozen_string_literal: true module Puppet::Util::Terminal # Attempts to determine the width of the terminal. This is currently only # supported on POSIX systems, and relies on the claims of `stty` (or `tput`). # # Inspired by code from Thor; thanks wycats! # @return [Number] The column width of the termin...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/rubygems.rb
Ruby
apache-2.0
7,843
main
1,745
# frozen_string_literal: true require_relative '../../puppet/util' module Puppet::Util::RubyGems # Base/factory class for rubygems source. These classes introspec into # rubygems to in order to list where the rubygems system will look for files # to load. class Source class << self # @api private ...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/libuser.rb
Ruby
apache-2.0
7,843
main
232
# frozen_string_literal: true module Puppet::Util::Libuser def self.getconf File.expand_path('libuser.conf', __dir__) end def self.getenv newenv = {} newenv['LIBUSER_CONF'] = getconf newenv end end
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/user_attr.rb
Ruby
apache-2.0
7,843
main
485
# frozen_string_literal: true class UserAttr def self.get_attributes_by_name(name) attributes = nil File.readlines('/etc/user_attr').each do |line| next if line =~ /^#/ token = line.split(':') next unless token[0] == name attributes = { :name => name } token[4].split(';').ea...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/tagging.rb
Ruby
apache-2.0
7,843
main
3,718
# frozen_string_literal: true require_relative '../../puppet/util/tag_set' module Puppet::Util::Tagging ValidTagRegex = /\A[[:alnum:]_][[:alnum:]_:.-]*\Z/u # Add a tag to the current tag set. # When a tag set is used for a scope, these tags will be added to all of # the objects contained in this scope when t...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/rpm_compare.rb
Ruby
apache-2.0
7,843
main
6,429
# frozen_string_literal: true require 'English' module Puppet::Util::RpmCompare ARCH_LIST = %w[ noarch i386 i686 ppc ppc64 armv3l armv4b armv4l armv4tl armv5tel armv5tejl armv6l armv7l m68kmint s390 s390x ia64 x86_64 sh3 sh4 ].freeze ARCH_REGEX = Regexp.new(ARCH_LIST.map { |arch| "\\.#{arch}" }.join('|'...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/yaml.rb
Ruby
apache-2.0
7,843
main
2,390
# frozen_string_literal: true require 'yaml' module Puppet::Util::Yaml YamlLoadExceptions = [::StandardError, ::Psych::Exception] class YamlLoadError < Puppet::Error; end # Safely load the content as YAML. By default only the following # classes can be deserialized: # # * TrueClass # * FalseClass # ...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/inifile.rb
Ruby
apache-2.0
7,843
main
8,386
# frozen_string_literal: true # Module Puppet::IniConfig # A generic way to parse .ini style files and manipulate them in memory # One 'file' can be made up of several physical files. Changes to sections # on the file are tracked so that only the physical files in which # something has changed are written back to disk...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/plist.rb
Ruby
apache-2.0
7,843
main
6,204
# frozen_string_literal: true require 'cfpropertylist' if Puppet.features.cfpropertylist? require_relative '../../puppet/util/execution' module Puppet::Util::Plist class FormatError < RuntimeError; end # So I don't have to prepend every method name with 'self.' Most of the # methods are going to be Provider me...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/provider_features.rb
Ruby
apache-2.0
7,843
main
5,900
# frozen_string_literal: true # Provides feature definitions. require_relative '../../puppet/util/docs' require_relative '../../puppet/util' # This module models provider features and handles checking whether the features # are present. # @todo Unclear what is api and what is private in this module. # module Puppet::U...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/posix.rb
Ruby
apache-2.0
7,843
main
6,209
# frozen_string_literal: true # Utility methods for interacting with POSIX objects; mostly user and group module Puppet::Util::POSIX # This is a list of environment variables that we will set when we want to override the POSIX locale LOCALE_ENV_VARS = %w[LANG LC_ALL LC_MESSAGES LANGUAGE LC_C...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/autoload.rb
Ruby
apache-2.0
7,843
main
7,186
# frozen_string_literal: true require 'pathname' require_relative '../../puppet/util/rubygems' require_relative '../../puppet/util/warnings' require_relative '../../puppet/pops/adaptable' require_relative '../../puppet/concurrent/synchronized' # An adapter that ties the module_directories cache to the environment whe...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/at_fork.rb
Ruby
apache-2.0
7,843
main
1,623
# frozen_string_literal: true require_relative '../../puppet' # A module for building AtFork handlers. These handlers are objects providing # pre/post fork callbacks modeled after those registered by the `pthread_atfork` # function. # Currently there are two AtFork handler implementations: # - a noop implementation u...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/limits.rb
Ruby
apache-2.0
7,843
main
372
# frozen_string_literal: true require_relative '../../puppet/util' module Puppet::Util::Limits # @api private def setpriority(priority) return unless priority Process.setpriority(0, Process.pid, priority) rescue Errno::EACCES, NotImplementedError Puppet.warning(_("Failed to set process priority to ...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/splayer.rb
Ruby
apache-2.0
7,843
main
513
# frozen_string_literal: true # Handle splay options (sleeping for a random interval before executing) module Puppet::Util::Splayer # Have we splayed already? def splayed? !!@splayed end # Sleep when splay is enabled; else just return. def splay(do_splay = Puppet[:splay]) return unless do_splay ...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/feature.rb
Ruby
apache-2.0
7,843
main
4,240
# frozen_string_literal: true require_relative '../../puppet' require_relative '../../puppet/util/warnings' class Puppet::Util::Feature include Puppet::Util::Warnings attr_reader :path # Create a new feature test. You have to pass the feature name, and it must be # unique. You can pass a block to determine ...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/colors.rb
Ruby
apache-2.0
7,843
main
3,901
# frozen_string_literal: true require_relative '../../puppet/util/platform' module Puppet::Util::Colors BLACK = { :console => "\e[0;30m", :html => "color: #FFA0A0" } RED = { :console => "\e[0;31m", :html => "color: #FFA0A0" } GREEN = { :console => "\e[0;32m", :html => "color: #00CD00...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/selinux.rb
Ruby
apache-2.0
7,843
main
10,937
# frozen_string_literal: true # Provides utility functions to help interface Puppet to SELinux. # # This requires the very new SELinux Ruby bindings. These bindings closely # mirror the SELinux C library interface. # # Support for the command line tools is not provided because the performance # was abysmal. At this ...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/platform.rb
Ruby
apache-2.0
7,843
main
2,193
# frozen_string_literal: true module Puppet module Util module Platform FIPS_STATUS_FILE = "/proc/sys/crypto/fips_enabled" WINDOWS_FIPS_REGISTRY_KEY = 'System\\CurrentControlSet\\Control\\Lsa\\FipsAlgorithmPolicy' def windows? # Ruby only sets File::ALT_SEPARATOR on Windows and the Rub...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/execution.rb
Ruby
apache-2.0
7,843
main
18,086
# frozen_string_literal: true require 'timeout' require_relative '../../puppet/file_system/uniquefile' module Puppet require 'rbconfig' require_relative '../../puppet/error' # A command failed to execute. # @api public class ExecutionFailure < Puppet::Error end end # This module defines methods for exec...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/constant_inflector.rb
Ruby
apache-2.0
7,843
main
733
# frozen_string_literal: true # Created on 2008-02-12 # Copyright Luke Kanies # NOTE: I think it might be worth considering moving these methods directly into Puppet::Util. # A common module for converting between constants and # file names. module Puppet module Util module ConstantInflector def file2co...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/fileparsing.rb
Ruby
apache-2.0
7,843
main
11,406
# frozen_string_literal: true # A mini-language for parsing files. This is only used file the ParsedFile # provider, but it makes more sense to split it out so it's easy to maintain # in one place. # # You can use this module to create simple parser/generator classes. For instance, # the following parser should go m...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/execution_stub.rb
Ruby
apache-2.0
7,843
main
790
# frozen_string_literal: true module Puppet::Util class ExecutionStub class << self # Set a stub block that Puppet::Util::Execution.execute() should invoke instead # of actually executing commands on the target machine. Intended # for spec testing. # # The arguments passed to the b...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/instance_loader.rb
Ruby
apache-2.0
7,843
main
1,899
# frozen_string_literal: true require_relative '../../puppet/util/autoload' require_relative '../../puppet/util' require_relative '../../puppet/concurrent/lock' # A module that can easily autoload things for us. Uses an instance # of Puppet::Util::Autoload module Puppet::Util::InstanceLoader include Puppet::Util ...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/retry_action.rb
Ruby
apache-2.0
7,843
main
1,633
# frozen_string_literal: true module Puppet::Util::RetryAction class RetryException < Exception; end # rubocop:disable Lint/InheritException class RetryException::NoBlockGiven < RetryException; end class RetryException::NoRetriesGiven < RetryException; end class RetryException::RetriesExceeded < RetryException...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/multi_match.rb
Ruby
apache-2.0
7,843
main
1,430
# frozen_string_literal: true # MultiMatch allows multiple values to be tested at once in a case expression. # This class is needed since Array does not implement the === operator to mean # "each v === other.each v". # # This class is useful in situations when the Puppet Type System cannot be used # (e.g. in Logging, ...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/monkey_patches.rb
Ruby
apache-2.0
7,843
main
3,129
# frozen_string_literal: true require_relative '../../puppet/util/platform' module Puppet::Util::MonkeyPatches end begin Process.maxgroups = 1024 rescue NotImplementedError # Actually, I just want to ignore it, since various platforms - JRuby, # Windows, and so forth - don't support it, but only because it isn...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/resource_template.rb
Ruby
apache-2.0
7,843
main
2,226
# frozen_string_literal: true require_relative '../../puppet/util' require_relative '../../puppet/util/logging' require 'erb' # A template wrapper that evaluates a template in the # context of a resource, allowing the resource attributes # to be looked up from within the template. # This provides functionality essen...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/pidlock.rb
Ruby
apache-2.0
7,843
main
2,559
# frozen_string_literal: true require 'fileutils' require_relative '../../puppet/util/lockfile' class Puppet::Util::Pidlock def initialize(lockfile) @lockfile = Puppet::Util::Lockfile.new(lockfile) end def locked? clear_if_stale @lockfile.locked? end def mine? Process.pid == lock_pid end...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/metric.rb
Ruby
apache-2.0
7,843
main
1,442
# frozen_string_literal: true # included so we can test object types require_relative '../../puppet' require_relative '../../puppet/network/format_support' # A class for handling metrics. This is currently ridiculously hackish. class Puppet::Util::Metric include Puppet::Util::PsychSupport include Puppet::Network...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/filetype.rb
Ruby
apache-2.0
7,843
main
11,853
# frozen_string_literal: true # Basic classes for reading, writing, and emptying files. Not much # to see here. require_relative '../../puppet/util/selinux' require 'tempfile' require 'fileutils' class Puppet::Util::FileType attr_accessor :loaded, :path, :synced class FileReadError < Puppet::Error; end incl...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/skip_tags.rb
Ruby
apache-2.0
7,843
main
263
# frozen_string_literal: true require_relative '../../puppet/util/tagging' class Puppet::Util::SkipTags include Puppet::Util::Tagging def initialize(stags) self.tags = stags unless defined?(@tags) end def split_qualified_tags? false end end
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/profiler/logging.rb
Ruby
apache-2.0
7,843
main
903
# frozen_string_literal: true class Puppet::Util::Profiler::Logging def initialize(logger, identifier) @logger = logger @identifier = identifier @sequence = Sequence.new end def start(description, metric_id) @sequence.next @sequence.down do_start(description, metric_id) end def fini...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/profiler/object_counts.rb
Ruby
apache-2.0
7,843
main
431
# frozen_string_literal: true require_relative '../../../puppet/util/profiler/logging' class Puppet::Util::Profiler::ObjectCounts < Puppet::Util::Profiler::Logging def start ObjectSpace.count_objects end def finish(before) after = ObjectSpace.count_objects diff = before.collect do |type, count| ...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/profiler/wall_clock.rb
Ruby
apache-2.0
7,843
main
926
# frozen_string_literal: true require_relative '../../../puppet/util/profiler/logging' # A profiler implementation that measures the number of seconds a segment of # code takes to execute and provides a callback with a string representation of # the profiling information. # # @api private class Puppet::Util::Profiler...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/profiler/aggregate.rb
Ruby
apache-2.0
7,843
main
1,822
# frozen_string_literal: true require_relative '../../../puppet/util/profiler' require_relative '../../../puppet/util/profiler/wall_clock' class Puppet::Util::Profiler::Aggregate < Puppet::Util::Profiler::WallClock def initialize(logger, identifier) super(logger, identifier) @metrics_hash = Metric.new end...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/profiler/around_profiler.rb
Ruby
apache-2.0
7,843
main
1,766
# frozen_string_literal: true # A Profiler that can be used to wrap around blocks of code. It is configured # with other profilers and controls them to start before the block is executed # and finish after the block is executed. # # @api private class Puppet::Util::Profiler::AroundProfiler def initialize @profil...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/network_device/base.rb
Ruby
apache-2.0
7,843
main
868
# frozen_string_literal: true require_relative '../../../puppet/util/autoload' require 'uri' require_relative '../../../puppet/util/network_device/transport' require_relative '../../../puppet/util/network_device/transport/base' class Puppet::Util::NetworkDevice::Base attr_accessor :url, :transport def initialize...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/network_device/config.rb
Ruby
apache-2.0
7,843
main
3,302
# frozen_string_literal: true require 'ostruct' require_relative '../../../puppet/util/watched_file' require_relative '../../../puppet/util/network_device' class Puppet::Util::NetworkDevice::Config def self.main @main ||= new end def self.devices main.devices || [] end attr_reader :devices def ...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/network_device/transport/base.rb
Ruby
apache-2.0
7,843
main
551
# frozen_string_literal: true require_relative '../../../../puppet/util/network_device' require_relative '../../../../puppet/util/network_device/transport' class Puppet::Util::NetworkDevice::Transport::Base attr_accessor :user, :password, :host, :port attr_accessor :default_prompt, :timeout def initialize ...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/rdoc/parser.rb
Ruby
apache-2.0
7,843
main
512
# frozen_string_literal: true # Puppet "parser" for the rdoc system # The parser uses puppet parser and traverse the AST to instruct RDoc about # our current structures. It also parses ruby files that could contain # either custom facts or puppet plugins (functions, types...) # rdoc2 includes require 'rdoc/code_objec...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/rdoc/code_objects.rb
Ruby
apache-2.0
7,843
main
6,712
# frozen_string_literal: true require 'rdoc/code_objects' module RDoc # This modules contains various class that are used to hold information # about the various Puppet language structures we found while parsing. # # Those will be mapped to their html counterparts which are defined in # PuppetGenerator. ...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/rdoc/parser/puppet_parser_rdoc2.rb
Ruby
apache-2.0
7,843
main
346
# frozen_string_literal: true require_relative '../../../../puppet/util/rdoc/parser/puppet_parser_core' module RDoc PUPPET_RDOC_VERSION = 2 # @api private class PuppetParserRDoc2 < Parser include PuppetParserCore def create_rdoc_preprocess Markup::PreProcess.new(@input_file_name, @options.rdoc_i...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/rdoc/parser/puppet_parser_core.rb
Ruby
apache-2.0
7,843
main
8,731
# frozen_string_literal: true # Functionality common to both our RDoc version 1 and 2 parsers. module RDoc::PuppetParserCore SITE = "__site__" def self.included(base) base.class_eval do attr_accessor :input_file_name, :top_level # parser registration into RDoc parse_files_matching(/\.(rb)$/...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/rdoc/generators/puppet_generator.rb
Ruby
apache-2.0
7,843
main
24,241
# frozen_string_literal: true require 'rdoc/generators/html_generator' require_relative '../../../../puppet/util/rdoc/code_objects' require 'digest/md5' module Generators # This module holds all the classes needed to generate the HTML documentation # of a bunch of puppet manifests. # # It works by traversing ...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/rdoc/generators/template/puppet/puppet.rb
Ruby
apache-2.0
7,843
main
24,478
# frozen_string_literal: true # # = CSS2 RDoc HTML template # # This is a template for RDoc that uses XHTML 1.0 Transitional and dictates a # bit more of the appearance of the output to cascading stylesheets than the # default. It was designed for clean inline code display, and uses DHTMl to # toggle the visbility of ...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/package/version/debian.rb
Ruby
apache-2.0
7,843
main
5,763
# frozen_string_literal: true module Puppet::Util::Package::Version class Debian < Numeric include Comparable # Version string matching regexes REGEX_EPOCH = '(?:([0-9]+):)?' # alphanumerics and the characters . + - ~ , starts with a digit, ~ only of debian_revision is present REGEX_UPSTREAM_VER...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/package/version/rpm.rb
Ruby
apache-2.0
7,843
main
1,922
# frozen_string_literal: true require_relative '../../../../puppet/util/rpm_compare' module Puppet::Util::Package::Version class Rpm < Numeric # provides Rpm parsing and comparison extend Puppet::Util::RpmCompare include Puppet::Util::RpmCompare include Comparable class ValidationFailure < Argu...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/package/version/gem.rb
Ruby
apache-2.0
7,843
main
467
# frozen_string_literal: true module Puppet::Util::Package::Version class Gem < ::Gem::Version def self.parse(version) raise ValidationFailure, version unless version.is_a? String raise ValidationFailure, version unless version =~ ANCHORED_VERSION_PATTERN new(version) end class Valida...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/package/version/range.rb
Ruby
apache-2.0
7,843
main
1,962
# frozen_string_literal: true require_relative 'range/lt' require_relative 'range/lt_eq' require_relative 'range/gt' require_relative 'range/gt_eq' require_relative 'range/eq' require_relative 'range/min_max' module Puppet::Util::Package::Version class Range class ValidationFailure < ArgumentError; end # Pa...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/package/version/pip.rb
Ruby
apache-2.0
7,843
main
5,733
# frozen_string_literal: true module Puppet::Util::Package::Version class Pip include Comparable VERSION_PATTERN = " v? (?: (?:(?<epoch>[0-9]+)!)? # epoch (?<release>[0-9]+(?:\\.[0-9]+)*) # release segment (?<pre> ...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/package/version/range/lt.rb
Ruby
apache-2.0
7,843
main
313
# frozen_string_literal: true require_relative '../../../../../puppet/util/package/version/range/simple' module Puppet::Util::Package::Version class Range class Lt < Simple def to_s "<#{@version}" end def include?(version) version < @version end end end end
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/package/version/range/min_max.rb
Ruby
apache-2.0
7,843
main
477
# frozen_string_literal: true require_relative '../../../../../puppet/util/package/version/range' module Puppet::Util::Package::Version class Range class MinMax def initialize(min, max) @min = min @max = max end def to_s "#{@min} #{@max}" end def to_gem_ve...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/package/version/range/lt_eq.rb
Ruby
apache-2.0
7,843
main
317
# frozen_string_literal: true require_relative '../../../../../puppet/util/package/version/range/simple' module Puppet::Util::Package::Version class Range class LtEq < Simple def to_s "<=#{@version}" end def include?(version) version <= @version end end end end
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/package/version/range/gt_eq.rb
Ruby
apache-2.0
7,843
main
317
# frozen_string_literal: true require_relative '../../../../../puppet/util/package/version/range/simple' module Puppet::Util::Package::Version class Range class GtEq < Simple def to_s ">=#{@version}" end def include?(version) version >= @version end end end end
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/package/version/range/eq.rb
Ruby
apache-2.0
7,843
main
313
# frozen_string_literal: true require_relative '../../../../../puppet/util/package/version/range/simple' module Puppet::Util::Package::Version class Range class Eq < Simple def to_s @version.to_s end def include?(version) version == @version end end end end
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/package/version/range/gt.rb
Ruby
apache-2.0
7,843
main
313
# frozen_string_literal: true require_relative '../../../../../puppet/util/package/version/range/simple' module Puppet::Util::Package::Version class Range class Gt < Simple def to_s ">#{@version}" end def include?(version) version > @version end end end end
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/package/version/range/simple.rb
Ruby
apache-2.0
7,843
main
254
# frozen_string_literal: true require_relative '../../../../../puppet/util/package/version/range' module Puppet::Util::Package::Version class Range class Simple def initialize(version) @version = version end end end end
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/watcher/change_watcher.rb
Ruby
apache-2.0
7,843
main
807
# frozen_string_literal: true # Watches for changes over time. It only re-examines the values when it is requested to update readings. # @api private class Puppet::Util::Watcher::ChangeWatcher def self.watch(reader) Puppet::Util::Watcher::ChangeWatcher.new(nil, nil, reader).next_reading end def initialize(p...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/watcher/periodic_watcher.rb
Ruby
apache-2.0
7,843
main
962
# frozen_string_literal: true # Monitor a given watcher for changes on a periodic interval. class Puppet::Util::Watcher::PeriodicWatcher # @param watcher [Puppet::Util::Watcher::ChangeWatcher] a watcher for the value to watch # @param timer [Puppet::Util::Watcher::Timer] A timer to determine when to # recheck ...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/watcher/timer.rb
Ruby
apache-2.0
7,843
main
283
# frozen_string_literal: true class Puppet::Util::Watcher::Timer attr_reader :timeout def initialize(timeout) @timeout = timeout end def start @start_time = now end def expired? (now - @start_time) >= @timeout end def now Time.now.to_i end end
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/at_fork/noop.rb
Ruby
apache-2.0
7,843
main
327
# frozen_string_literal: true # A noop implementation of the Puppet::Util::AtFork handler class Puppet::Util::AtFork::Noop class << self def new # no need to instantiate every time, return the class object itself self end def prepare end def parent end def child end e...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/at_fork/solaris.rb
Ruby
apache-2.0
7,843
main
4,902
# frozen_string_literal: true require_relative '../../../puppet' require 'fiddle' # Early versions of Fiddle relied on the deprecated DL module and used # classes defined in the namespace of that module instead of classes defined # in the Fiddle's own namespace e.g. DL::Handle instead of Fiddle::Handle. # We don't su...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/ldap/generator.rb
Ruby
apache-2.0
7,843
main
731
# frozen_string_literal: true require_relative '../../../puppet/util/ldap' class Puppet::Util::Ldap::Generator # Declare the attribute we'll use to generate the value. def from(source) @source = source self end # Actually do the generation. def generate(value = nil) if value.nil? @generat...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/ldap/manager.rb
Ruby
apache-2.0
7,843
main
8,029
# frozen_string_literal: true require_relative '../../../puppet/util/ldap' require_relative '../../../puppet/util/ldap/connection' require_relative '../../../puppet/util/ldap/generator' # The configuration class for LDAP providers, plus # connection handling for actually interacting with ldap. class Puppet::Util::Lda...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/ldap/connection.rb
Ruby
apache-2.0
7,843
main
1,886
# frozen_string_literal: true require_relative '../../../puppet/util/ldap' class Puppet::Util::Ldap::Connection attr_accessor :host, :port, :user, :password, :reset, :ssl attr_reader :connection # Return a default connection, using our default settings. def self.instance ssl = if Puppet[:ldaptls] ...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/windows/registry.rb
Ruby
apache-2.0
7,843
main
16,673
# frozen_string_literal: true require_relative '../../../puppet/util/windows' module Puppet::Util::Windows module Registry require 'ffi' extend FFI::Library # https://msdn.microsoft.com/en-us/library/windows/desktop/aa384129(v=vs.85).aspx KEY64 = 0x100 KEY32 = 0x200 KEY_READ = 0x2001...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/windows/security.rb
Ruby
apache-2.0
7,843
main
37,652
# frozen_string_literal: true # This class maps POSIX owner, group, and modes to the Windows # security model, and back. # # The primary goal of this mapping is to ensure that owner, group, and # modes can be round-tripped in a consistent and deterministic # way. Otherwise, Puppet might think file resources are out-of...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/windows/daemon.rb
Ruby
apache-2.0
7,843
main
11,093
# frozen_string_literal: true require_relative '../../../puppet/ffi/windows' module Puppet::Util::Windows # The Daemon class, based on the chef/win32-service implementation class Daemon include Puppet::FFI::Windows::Constants extend Puppet::FFI::Windows::Constants include Puppet::FFI::Windows::Struct...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/windows/adsi.rb
Ruby
apache-2.0
7,843
main
21,604
# frozen_string_literal: true module Puppet::Util::Windows::ADSI require 'ffi' # https://docs.microsoft.com/en-us/windows/win32/api/dsrole/ne-dsrole-dsrole_machine_role STANDALONE_WORKSTATION = 0 MEMBER_WORKSTATION = 1 STANDALONE_SERVER = 2 MEMBER_SERVER = 3 BACKUP_DOMAIN_CONTROLLER = 4 PRIMARY_DOMAIN...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/windows/access_control_entry.rb
Ruby
apache-2.0
7,843
main
2,516
# frozen_string_literal: true # Windows Access Control Entry # # Represents an access control entry, which grants or denies a subject, # identified by a SID, rights to a securable object. # # @see https://msdn.microsoft.com/en-us/library/windows/desktop/aa374868(v=vs.85).aspx # @api private class Puppet::Util::Windows...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/windows/principal.rb
Ruby
apache-2.0
7,843
main
9,087
# frozen_string_literal: true require_relative '../../../puppet/util/windows' module Puppet::Util::Windows::SID class Principal extend FFI::Library attr_reader :account, :sid_bytes, :sid, :domain, :domain_account, :account_type def initialize(account, sid_bytes, sid, domain, account_type) # This ...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/windows/access_control_list.rb
Ruby
apache-2.0
7,843
main
3,597
# frozen_string_literal: true # Windows Access Control List # # Represents a list of access control entries (ACEs). # # @see https://msdn.microsoft.com/en-us/library/windows/desktop/aa374872(v=vs.85).aspx # @api private class Puppet::Util::Windows::AccessControlList include Enumerable ACCESS_ALLOWED_ACE_TYPE ...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/windows/eventlog.rb
Ruby
apache-2.0
7,843
main
6,950
# frozen_string_literal: true require 'ffi' # Puppet::Util::Windows::EventLog needs to be requirable without having loaded # any other parts of Puppet so it can be leveraged independently by the code # that runs Puppet as a service on Windows. # # For this reason we: # - Define Puppet::Util::Windows # - Replicate log...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/windows/string.rb
Ruby
apache-2.0
7,843
main
357
# frozen_string_literal: true module Puppet module Util module Windows module String def wide_string(str) # if given a nil string, assume caller wants to pass a nil pointer to win32 return nil if str.nil? str.encode('UTF-16LE') end module_function :wid...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/windows/com.rb
Ruby
apache-2.0
7,843
main
6,099
# frozen_string_literal: true require 'ffi' module Puppet::Util::Windows::COM extend FFI::Library ffi_convention :stdcall S_OK = 0 S_FALSE = 1 def SUCCEEDED(hr) hr >= 0 end def FAILED(hr) hr < 0 end module_function :SUCCEEDED, :FAILED def raise_if_hresult_failed(name, *args) failed = FAILED(r...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/windows/process.rb
Ruby
apache-2.0
7,843
main
12,722
# frozen_string_literal: true require_relative '../../../puppet/util/windows/monkey_patches/process' require_relative '../../../puppet/ffi/windows' module Puppet::Util::Windows::Process extend Puppet::FFI::Windows::Functions include Puppet::FFI::Windows::Structs extend Puppet::Util::Windows::String WAIT_TIME...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/windows/sid.rb
Ruby
apache-2.0
7,843
main
11,325
# frozen_string_literal: true require_relative '../../../puppet/util/windows' module Puppet::Util::Windows module SID require 'ffi' extend FFI::Library # missing from Windows::Error ERROR_NONE_MAPPED = 1332 ERROR_INVALID_SID_STRUCTURE = 1337 ERROR_TRUSTED_DOMAIN_FAIL...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/windows/user.rb
Ruby
apache-2.0
7,843
main
23,455
# frozen_string_literal: true require_relative '../../../puppet/util/windows' require 'ffi' module Puppet::Util::Windows::User extend Puppet::Util::Windows::String extend FFI::Library def admin? return false unless check_token_membership # if Vista or later, check for unrestricted process token e...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/windows/root_certs.rb
Ruby
apache-2.0
7,843
main
3,241
# frozen_string_literal: true require_relative '../../../puppet/util/windows' require_relative '../../../puppet/ssl/openssl_loader' require 'ffi' # Represents a collection of trusted root certificates. # # @api public class Puppet::Util::Windows::RootCerts include Enumerable extend FFI::Library def initialize(...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/windows/file.rb
Ruby
apache-2.0
7,843
main
11,420
# frozen_string_literal: true require_relative '../../../puppet/ffi/windows' module Puppet::Util::Windows::File extend Puppet::Util::Windows::String include Puppet::FFI::Windows::Constants extend Puppet::FFI::Windows::Structs include Puppet::FFI::Windows::Structs include Puppet::FFI::Windows::Functions ...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/windows/error.rb
Ruby
apache-2.0
7,843
main
3,189
# frozen_string_literal: true require_relative '../../../puppet/util/windows' require_relative '../../../puppet/error' # represents an error resulting from a Win32 error code class Puppet::Util::Windows::Error < Puppet::Error require 'ffi' extend FFI::Library attr_reader :code # NOTE: FFI.errno only works p...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/util/windows/service.rb
Ruby
apache-2.0
7,843
main
31,744
# coding: utf-8 # frozen_string_literal: true require_relative '../../../puppet/ffi/windows' module Puppet::Util::Windows # This module is designed to provide an API between the windows system and puppet for # service management. # # for an overview of the service state transitions see: https://docs.microsoft...