Module: Puppet

Extended by:
Util, Util::Logging
Defined in:
lib/puppet.rb,
lib/puppet/type.rb,
lib/puppet/util.rb,
lib/puppet/error.rb,
lib/puppet/defaults.rb,
lib/puppet/type/zfs.rb,
lib/puppet/type/exec.rb,
lib/puppet/type/host.rb,
lib/puppet/type/user.rb,
lib/puppet/type/group.rb,
lib/puppet/type/mount.rb,
lib/puppet/type/zpool.rb,
lib/puppet/application.rb,
lib/puppet/type/notify.rb,
lib/puppet/type/sshkey.rb,
lib/puppet/type/package.rb,
lib/puppet/type/service.rb,
lib/puppet/type/yumrepo.rb,
lib/puppet/util/plugins.rb,
lib/puppet/parser/parser.rb,
lib/puppet/parser/parser.rb,
lib/puppet/property/list.rb,
lib/puppet/transportable.rb,
lib/puppet/type/maillist.rb,
lib/puppet/type/schedule.rb,
lib/puppet/util/classgen.rb,
lib/puppet/util/run_mode.rb,
lib/puppet/type/file/mode.rb,
lib/puppet/type/file/type.rb,
lib/puppet/type/mailalias.rb,
lib/puppet/resource/status.rb,
lib/puppet/type/file/ctime.rb,
lib/puppet/type/file/group.rb,
lib/puppet/type/file/mtime.rb,
lib/puppet/type/file/owner.rb,
lib/puppet/type/filebucket.rb,
lib/puppet/type/selboolean.rb,
lib/puppet/util/loadedfile.rb,
lib/puppet/type/file/ensure.rb,
lib/puppet/type/file/source.rb,
lib/puppet/type/file/target.rb,
lib/puppet/network/authstore.rb,
lib/puppet/property/keyvalue.rb,
lib/puppet/type/file/content.rb,
lib/puppet/util/command_line.rb,
lib/puppet/network/authconfig.rb,
lib/puppet/type/file/selcontext.rb,
lib/puppet/property/ordered_list.rb,
lib/puppet/network/rest_authconfig.rb,
lib/puppet/type/ssh_authorized_key.rb,
lib/puppet/network/http_server/webrick.rb,
lib/puppet/ssl/certificate_authority/interface.rb

Overview

This class is basically a hidden class that knows how to act on the CA. It’s only used by the ‘puppetca’ executable, and its job is to provide a CLI-like interface to the CA class.

Defined Under Namespace

Modules: DSL, FileBucket, FileBucketFile, Indirector, MetaType, Network, Parser, SSL, SSLCertificates, Util Classes: Agent, AlreadyImportedError, Application, AuthStoreError, AuthorizationError, ConfigurationError, Configurer, ConstantAlreadyDefined, Daemon, DevError, Error, ExecutionFailure, FileCollection, FileServing, ImportError, IniProperty, Module, NoSuchFile, Node, Parameter, ParseError, Plugins, Property, Provider, Relationship, Reports, Resource, Run, SELFileContext, ServerError, SimpleGraph, Status, SubclassAlreadyDefined, TransBucket, TransObject, Transaction, Type

Constant Summary collapse

PUPPETVERSION =
'2.6.9'
Log =

This is for backward compatibility from when we changed the constant to Puppet::Util::Log because the reports include the constant name. Apparently the alias was created in March 2007, should could probably be removed soon.

Puppet::Util::Log
Metric =

This is necessary because we changed the class path in early 2007, and reports directly yaml-dump these metrics, so both client and server have to agree on the class name.

Puppet::Util::Metric
ABSENT_DOC =

Doc string for properties that can be made ‘absent’

"Set this to 'absent' to remove it from the file completely"
ResourceType =
self
@@settings =

the hash that determines how our system behaves

Puppet::Util::Settings.new

Class Attribute Summary collapse

Class Method Summary collapse

Methods included from Util

activerecord_version, benchmark, chuser, classproxy, execfail, execpipe, execute, logmethods, memory, proxy, secure_open, symbolize, symbolizehash, symbolizehash!, synchronize_on, thinmark, threadlock, which, withumask

Methods included from Util::POSIX

#get_posix_field, #gid, #idfield, #methodbyid, #methodbyname, #search_posix_field, #uid

Methods included from Util::Logging

send_log

Class Attribute Details

.featuresObject (readonly)

Returns the value of attribute features.



35
36
37
# File 'lib/puppet.rb', line 35

def features
  @features
end

.name=(value) ⇒ Object (writeonly)

Sets the attribute name

Parameters:

  • value

    the value to set the attribute name to.



36
37
38
# File 'lib/puppet.rb', line 36

def name=(value)
  @name = value
end

Class Method Details

.[](param) ⇒ Object

configuration parameter access and stuff



61
62
63
64
65
66
67
# File 'lib/puppet.rb', line 61

def self.[](param)
  if param == :debug
    return Puppet::Util::Log.level == :debug
  else
    return @@settings[param]
  end
end

.[]=(param, value) ⇒ Object

configuration parameter access and stuff



70
71
72
# File 'lib/puppet.rb', line 70

def self.[]=(param,value)
  @@settings[param] = value
end

.application_nameObject



94
95
96
# File 'lib/puppet.rb', line 94

def self.application_name
  $puppet_application_name ||= "apply"
end

.clearObject



74
75
76
# File 'lib/puppet.rb', line 74

def self.clear
  @@settings.clear
end

.debug=(value) ⇒ Object



78
79
80
81
82
83
84
# File 'lib/puppet.rb', line 78

def self.debug=(value)
  if value
    Puppet::Util::Log.level=(:debug)
  else
    Puppet::Util::Log.level=(:notice)
  end
end

.genmanifestObject



101
102
103
104
105
106
# File 'lib/puppet.rb', line 101

def self.genmanifest
  if Puppet[:genmanifest]
    puts Puppet.settings.to_manifest
    exit(0)
  end
end

.newtype(name, options = {}, &block) ⇒ Object

Create a new type. Just proxy to the Type class.



144
145
146
# File 'lib/puppet.rb', line 144

def self.newtype(name, options = {}, &block)
  Puppet::Type.newtype(name, options, &block)
end

.parse_configObject

Parse the config file for this process.



109
110
111
# File 'lib/puppet.rb', line 109

def self.parse_config
  Puppet.settings.parse
end

.recmkdir(dir, mode = 0755) ⇒ Object

XXX this should all be done using puppet objects, not using normal mkdir



115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# File 'lib/puppet.rb', line 115

def self.recmkdir(dir,mode = 0755)
  if FileTest.exist?(dir)
    return false
  else
    tmp = dir.sub(/^\//,'')
    path = [File::SEPARATOR]
    tmp.split(File::SEPARATOR).each { |dir|
      path.push dir
      if ! FileTest.exist?(File.join(path))
        begin
          Dir.mkdir(File.join(path), mode)
        rescue Errno::EACCES => detail
          Puppet.err detail.to_s
          return false
        rescue => detail
          Puppet.err "Could not create #{path}: #{detail}"
          return false
        end
      elsif FileTest.directory?(File.join(path))
        next
      else FileTest.exist?(File.join(path))
        raise Puppet::Error, "Cannot create #{dir}: basedir #{File.join(path)} is a file"
      end
    }
    return true
  end
end

.run_modeObject



90
91
92
# File 'lib/puppet.rb', line 90

def self.run_mode
  $puppet_application_mode || Puppet::Util::RunMode[:user]
end

.setdefaults(section, hash) ⇒ Object

Store a new default value.



56
57
58
# File 'lib/puppet.rb', line 56

def self.setdefaults(section, hash)
  @@settings.setdefaults(section, hash)
end

.settingsObject



86
87
88
# File 'lib/puppet.rb', line 86

def self.settings
  @@settings
end

.type(name) ⇒ Object

Retrieve a type by name. Just proxy to the Type class.



149
150
151
152
153
# File 'lib/puppet.rb', line 149

def self.type(name)
  # LAK:DEP Deprecation notice added 12/17/2008
  Puppet.warning "Puppet.type is deprecated; use Puppet::Type.type"
  Puppet::Type.type(name)
end

.versionObject



29
30
31
# File 'lib/puppet.rb', line 29

def Puppet.version
  PUPPETVERSION
end