puppet 0.23.0 → 0.23.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of puppet might be problematic. Click here for more details.
- data/CHANGELOG +58 -0
- data/Rakefile +1 -1
- data/bin/filebucket +6 -6
- data/bin/puppetca +11 -1
- data/bin/puppetmasterd +7 -6
- data/conf/redhat/client.init +1 -0
- data/conf/redhat/{puppetd.conf → puppet.conf} +1 -1
- data/conf/redhat/puppet.spec +43 -31
- data/conf/redhat/server.init +1 -0
- data/lib/puppet.rb +3 -3
- data/lib/puppet/configuration.rb +16 -5
- data/lib/puppet/metatype/attributes.rb +12 -19
- data/lib/puppet/metatype/evaluation.rb +10 -1
- data/lib/puppet/metatype/instances.rb +39 -15
- data/lib/puppet/metatype/manager.rb +1 -28
- data/lib/puppet/metatype/metaparams.rb +20 -16
- data/lib/puppet/metatype/providers.rb +8 -2
- data/lib/puppet/metatype/schedules.rb +14 -19
- data/lib/puppet/{modules.rb → module.rb} +2 -0
- data/lib/puppet/network/authstore.rb +5 -1
- data/lib/puppet/network/client/dipper.rb +2 -2
- data/lib/puppet/network/client/master.rb +18 -9
- data/lib/puppet/network/handler/fileserver.rb +3 -6
- data/lib/puppet/network/handler/report.rb +2 -1
- data/lib/puppet/network/server/mongrel.rb +4 -2
- data/lib/puppet/network/xmlrpc/client.rb +10 -3
- data/lib/puppet/parameter.rb +11 -4
- data/lib/puppet/parser/ast/collexpr.rb +10 -10
- data/lib/puppet/parser/ast/hostclass.rb +2 -2
- data/lib/puppet/parser/ast/resourceparam.rb +4 -3
- data/lib/puppet/parser/ast/resourceref.rb +16 -2
- data/lib/puppet/parser/collector.rb +8 -4
- data/lib/puppet/parser/functions.rb +5 -2
- data/lib/puppet/parser/interpreter.rb +48 -9
- data/lib/puppet/parser/lexer.rb +2 -1
- data/lib/puppet/parser/parser.rb +669 -589
- data/lib/puppet/parser/resource.rb +20 -11
- data/lib/puppet/parser/resource/param.rb +21 -10
- data/lib/puppet/parser/resource/reference.rb +2 -2
- data/lib/puppet/parser/scope.rb +22 -10
- data/lib/puppet/{type/property.rb → property.rb} +48 -15
- data/lib/puppet/propertychange.rb +3 -3
- data/lib/puppet/provider/cron/crontab.rb +38 -36
- data/lib/puppet/provider/host/netinfo.rb +1 -2
- data/lib/puppet/provider/mailalias/aliases.rb +31 -0
- data/lib/puppet/provider/maillist/mailman.rb +113 -0
- data/lib/puppet/provider/mount.rb +5 -11
- data/lib/puppet/provider/mount/parsed.rb +2 -2
- data/lib/puppet/provider/package/appdmg.rb +1 -2
- data/lib/puppet/provider/package/apt.rb +3 -1
- data/lib/puppet/provider/package/aptrpm.rb +14 -4
- data/lib/puppet/provider/package/blastwave.rb +6 -4
- data/lib/puppet/provider/package/dpkg.rb +12 -4
- data/lib/puppet/provider/package/pkgdmg.rb +2 -2
- data/lib/puppet/provider/package/rpm.rb +11 -1
- data/lib/puppet/provider/package/rug.rb +1 -0
- data/lib/puppet/provider/package/urpmi.rb +11 -1
- data/lib/puppet/provider/package/yum.rb +12 -2
- data/lib/puppet/provider/parsedfile.rb +36 -6
- data/lib/puppet/rails.rb +9 -2
- data/lib/puppet/rails/param_name.rb +2 -3
- data/lib/puppet/rails/param_value.rb +20 -1
- data/lib/puppet/rails/resource.rb +8 -2
- data/lib/puppet/reference/configuration.rb +14 -16
- data/lib/puppet/reference/type.rb +4 -4
- data/lib/puppet/transaction.rb +4 -4
- data/lib/puppet/type.rb +19 -6
- data/lib/puppet/type/component.rb +9 -3
- data/lib/puppet/type/cron.rb +10 -4
- data/lib/puppet/type/exec.rb +9 -5
- data/lib/puppet/type/group.rb +2 -3
- data/lib/puppet/type/mailalias.rb +50 -0
- data/lib/puppet/type/maillist.rb +57 -0
- data/lib/puppet/type/mount.rb +25 -11
- data/lib/puppet/type/package.rb +6 -27
- data/lib/puppet/type/pfile.rb +5 -6
- data/lib/puppet/type/pfile/source.rb +8 -2
- data/lib/puppet/type/pfilebucket.rb +4 -3
- data/lib/puppet/type/resources.rb +1 -3
- data/lib/puppet/type/schedule.rb +16 -16
- data/lib/puppet/type/service.rb +4 -1
- data/lib/puppet/type/tidy.rb +1 -2
- data/lib/puppet/type/user.rb +2 -3
- data/lib/puppet/type/yumrepo.rb +2 -2
- data/lib/puppet/util.rb +29 -4
- data/lib/puppet/util/autoload.rb +45 -16
- data/lib/puppet/util/fileparsing.rb +23 -6
- data/lib/puppet/util/filetype.rb +12 -1
- data/lib/puppet/util/log.rb +2 -2
- data/lib/puppet/util/log_paths.rb +16 -0
- data/lib/puppet/util/reference.rb +2 -2
- data/test/language/ast/hostclass.rb +21 -4
- data/test/language/ast/resourceref.rb +95 -0
- data/test/language/functions.rb +5 -5
- data/test/language/interpreter.rb +129 -1
- data/test/language/node.rb +13 -2
- data/test/language/resource.rb +26 -1
- data/test/language/scope.rb +25 -5
- data/test/lib/puppettest/support/collection.rb +2 -2
- data/test/network/client/master.rb +28 -42
- data/test/network/server/mongrel_test.rb +7 -1
- data/test/other/propertychange.rb +2 -2
- data/test/other/transactions.rb +44 -5
- data/test/puppet/modules.rb +2 -1
- data/test/rails/ast.rb +7 -8
- data/test/rails/collection.rb +2 -2
- data/test/rails/railsresource.rb +21 -5
- data/test/ral/manager/attributes.rb +33 -1
- data/test/ral/manager/instances.rb +33 -6
- data/test/ral/manager/type.rb +29 -49
- data/test/ral/providers/cron/crontab.rb +61 -13
- data/test/ral/providers/mailalias/aliases.rb +57 -0
- data/test/ral/providers/mount/parsed.rb +4 -4
- data/test/ral/providers/package/apt.rb +13 -1
- data/test/ral/providers/parsedfile.rb +20 -7
- data/test/ral/types/cron.rb +17 -1
- data/test/ral/types/mailalias.rb +50 -0
- data/test/ral/types/mount.rb +35 -2
- data/test/ral/types/package.rb +10 -2
- data/test/ral/types/parameter.rb +4 -4
- data/test/ral/types/property.rb +39 -1
- data/test/util/autoload.rb +33 -18
- data/test/util/filetype.rb +49 -3
- metadata +13 -6
- data/lib/puppet/element.rb +0 -52
data/lib/puppet/rails.rb
CHANGED
@@ -12,6 +12,13 @@ module Puppet::Rails
|
|
12
12
|
Puppet.config.use(:main, :rails, :puppetmasterd)
|
13
13
|
|
14
14
|
ActiveRecord::Base.logger = Logger.new(Puppet[:railslog])
|
15
|
+
begin
|
16
|
+
loglevel = Logger.const_get(Puppet[:rails_loglevel].upcase)
|
17
|
+
ActiveRecord::Base.logger.level = loglevel
|
18
|
+
rescue => detail
|
19
|
+
Puppet.warning "'%s' is not a valid Rails log level; using debug" % Puppet[:rails_loglevel]
|
20
|
+
ActiveRecord::Base.logger.level = Logger::DEBUG
|
21
|
+
end
|
15
22
|
ActiveRecord::Base.allow_concurrency = true
|
16
23
|
ActiveRecord::Base.verify_active_connections!
|
17
24
|
|
@@ -28,7 +35,7 @@ module Puppet::Rails
|
|
28
35
|
|
29
36
|
# The arguments for initializing the database connection.
|
30
37
|
def self.database_arguments
|
31
|
-
args = {:adapter => Puppet[:dbadapter]}
|
38
|
+
args = {:adapter => Puppet[:dbadapter], :log_level => Puppet[:rails_loglevel]}
|
32
39
|
|
33
40
|
case Puppet[:dbadapter]
|
34
41
|
when "sqlite3":
|
@@ -117,4 +124,4 @@ if Puppet.features.rails?
|
|
117
124
|
require 'puppet/rails/host'
|
118
125
|
end
|
119
126
|
|
120
|
-
# $Id: rails.rb
|
127
|
+
# $Id: rails.rb 2667 2007-07-09 23:15:01Z luke $
|
@@ -12,12 +12,11 @@ class Puppet::Rails::ParamName < ActiveRecord::Base
|
|
12
12
|
hash[:value] = resource.param_values.find(:all, :conditions => [ "param_name_id = ?", self]).collect { |v| v.value }
|
13
13
|
if hash[:value].length == 1
|
14
14
|
hash[:value] = hash[:value].shift
|
15
|
-
|
16
|
-
if hash[:value].empty?
|
15
|
+
elsif hash[:value].empty?
|
17
16
|
hash[:value] = nil
|
18
17
|
end
|
19
18
|
Puppet::Parser::Resource::Param.new hash
|
20
19
|
end
|
21
20
|
end
|
22
21
|
|
23
|
-
# $Id: param_name.rb
|
22
|
+
# $Id: param_name.rb 2706 2007-07-18 19:47:09Z luke $
|
@@ -1,6 +1,25 @@
|
|
1
1
|
class Puppet::Rails::ParamValue < ActiveRecord::Base
|
2
2
|
belongs_to :param_name
|
3
3
|
belongs_to :resource
|
4
|
+
|
5
|
+
def value
|
6
|
+
val = self[:value]
|
7
|
+
if val =~ /^--- \!/
|
8
|
+
YAML.load(val)
|
9
|
+
else
|
10
|
+
val
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
# I could not find a cleaner way to handle making sure that resource references
|
15
|
+
# were consistently serialized and deserialized.
|
16
|
+
def value=(val)
|
17
|
+
if val.is_a?(Puppet::Parser::Resource::Reference)
|
18
|
+
self[:value] = YAML.dump(val)
|
19
|
+
else
|
20
|
+
self[:value] = val
|
21
|
+
end
|
22
|
+
end
|
4
23
|
end
|
5
24
|
|
6
|
-
# $Id: param_value.rb
|
25
|
+
# $Id: param_value.rb 2706 2007-07-18 19:47:09Z luke $
|
@@ -45,7 +45,8 @@ class Puppet::Rails::Resource < ActiveRecord::Base
|
|
45
45
|
def get_tag_hash(tags = nil)
|
46
46
|
tags ||= resource_tags.find(:all, :include => :puppet_tag)
|
47
47
|
return tags.inject({}) do |hash, tag|
|
48
|
-
|
48
|
+
# We have to store the tag object, not just the tag name.
|
49
|
+
hash[tag.puppet_tag.name] = tag
|
49
50
|
hash
|
50
51
|
end
|
51
52
|
end
|
@@ -105,7 +106,12 @@ class Puppet::Rails::Resource < ActiveRecord::Base
|
|
105
106
|
hash[:source] = scope.source
|
106
107
|
obj = Puppet::Parser::Resource.new(hash)
|
107
108
|
|
109
|
+
names = []
|
108
110
|
self.param_names.each do |pname|
|
111
|
+
# We can get the same name multiple times because of how the
|
112
|
+
# db layout works.
|
113
|
+
next if names.include?(pname.name)
|
114
|
+
names << pname.name
|
109
115
|
obj.set(pname.to_resourceparam(self, scope.source))
|
110
116
|
end
|
111
117
|
|
@@ -116,4 +122,4 @@ class Puppet::Rails::Resource < ActiveRecord::Base
|
|
116
122
|
end
|
117
123
|
end
|
118
124
|
|
119
|
-
# $Id: resource.rb
|
125
|
+
# $Id: resource.rb 2705 2007-07-18 17:32:46Z luke $
|
@@ -46,25 +46,23 @@ Specifying Configuration Parameters
|
|
46
46
|
On The Command-Line
|
47
47
|
+++++++++++++++++++
|
48
48
|
Every Puppet executable (with the exception of ``puppetdoc``) accepts all of
|
49
|
-
the
|
50
|
-
Each
|
49
|
+
the parameters below, but not all of the arguments make sense for every executable.
|
50
|
+
Each parameter has a section listed with it in parentheses; often, that section
|
51
51
|
will map to an executable (e.g., ``puppetd``), in which case it probably only
|
52
|
-
makes sense for that one executable. If ``
|
52
|
+
makes sense for that one executable. If ``main`` is listed as the section,
|
53
53
|
it is most likely an option that is valid for everyone.
|
54
54
|
|
55
|
-
|
56
|
-
|
57
|
-
argument is appropriate or not.
|
55
|
+
I have tried to be as thorough as possible in the descriptions of the
|
56
|
+
arguments, so it should be obvious whether an argument is appropriate or not.
|
58
57
|
|
59
|
-
These
|
60
|
-
|
61
|
-
|
62
|
-
to ``/private/puppet``::
|
58
|
+
These parameters can be supplied to the executables either as command-line
|
59
|
+
options or in the configuration file. For instance, the command-line
|
60
|
+
invocation below would set the configuration directory to ``/private/puppet``::
|
63
61
|
|
64
62
|
$ puppetd --confdir=/private/puppet
|
65
63
|
|
66
|
-
Note that boolean options are turned on and off with a slightly different
|
67
|
-
on the command line::
|
64
|
+
Note that boolean options are turned on and off with a slightly different
|
65
|
+
syntax on the command line::
|
68
66
|
|
69
67
|
$ puppetd --storeconfigs
|
70
68
|
|
@@ -76,14 +74,14 @@ the client configuration.
|
|
76
74
|
Configuration Files
|
77
75
|
+++++++++++++++++++
|
78
76
|
As mentioned above, the configuration parameters can also be stored in a
|
79
|
-
configuration file located in the configuration directory (`/etc/puppet`
|
80
|
-
by default).
|
81
|
-
configuration directory (although they
|
77
|
+
configuration file, located in the configuration directory (`/etc/puppet`
|
78
|
+
by default). As of 0.23.0, all executables look for ``puppet.conf`` in their
|
79
|
+
configuration directory (although they previously looked for separate files).
|
82
80
|
|
83
81
|
All executables will set any parameters set within the ``main`` section,
|
84
82
|
while each executable will also look for a section named for the executable
|
85
83
|
and load those parameters. For example, ``puppetd`` will look for a
|
86
|
-
section named ``puppetd
|
84
|
+
section named ``puppetd``, and ``puppetmasterd`` looks for a section
|
87
85
|
named ``puppetmasterd``. This allows you to use a single configuration file
|
88
86
|
to customize the settings for all of your executables.
|
89
87
|
|
@@ -11,7 +11,7 @@ type = Puppet::Util::Reference.newreference :type, :doc => "All Puppet resource
|
|
11
11
|
str = %{
|
12
12
|
Metaparameters
|
13
13
|
--------------
|
14
|
-
Metaparameters are parameters that work with any
|
14
|
+
Metaparameters are parameters that work with any resource type; they are part of the
|
15
15
|
Puppet framework itself rather than being part of the implementation of any
|
16
16
|
given instance. Thus, any defined metaparameter can be used with any instance
|
17
17
|
in your manifest, including defined components.
|
@@ -66,9 +66,6 @@ Resource Types
|
|
66
66
|
dependency handling), and because ``path`` is the namevar for ``file``, that
|
67
67
|
string is assigned to the ``path`` parameter.
|
68
68
|
|
69
|
-
- *Features* are abilities that some providers might not support. You can use the list
|
70
|
-
of supported features to determine how a given provider can be used.
|
71
|
-
|
72
69
|
- *Parameters* determine the specific configuration of the instance. They either
|
73
70
|
directly modify the system (internally, these are called properties) or they affect
|
74
71
|
how the instance behaves (e.g., adding a search path for ``exec`` instances
|
@@ -82,6 +79,9 @@ Resource Types
|
|
82
79
|
binaries indicate that Puppet will search for the binary using the shell
|
83
80
|
path.
|
84
81
|
|
82
|
+
- *Features* are abilities that some providers might not support. You can use the list
|
83
|
+
of supported features to determine how a given provider can be used.
|
84
|
+
|
85
85
|
Resource types define features they can use, and providers can be tested to see
|
86
86
|
which features they provide.
|
87
87
|
|
data/lib/puppet/transaction.rb
CHANGED
@@ -68,7 +68,7 @@ class Transaction
|
|
68
68
|
resourceevents = apply_changes(resource, changes)
|
69
69
|
|
70
70
|
# If there were changes and the resource isn't in noop mode...
|
71
|
-
unless changes.empty? or
|
71
|
+
unless changes.empty? or resource.noop
|
72
72
|
# Record when we last synced
|
73
73
|
resource.cache(:synced, Time.now)
|
74
74
|
|
@@ -490,12 +490,12 @@ class Transaction
|
|
490
490
|
if Puppet[:trace]
|
491
491
|
puts detail.backtrace
|
492
492
|
end
|
493
|
-
Puppet.err "Could not prefetch % provider %s: %s" % [
|
493
|
+
Puppet.err "Could not prefetch %s provider '%s': %s" % [provider.resource_type.name, provider.name, detail]
|
494
494
|
end
|
495
495
|
end
|
496
496
|
end
|
497
497
|
|
498
|
-
# Prepare to evaluate the
|
498
|
+
# Prepare to evaluate the resources in a transaction.
|
499
499
|
def prepare
|
500
500
|
prefetch()
|
501
501
|
|
@@ -737,4 +737,4 @@ end
|
|
737
737
|
|
738
738
|
require 'puppet/transaction/report'
|
739
739
|
|
740
|
-
# $Id: transaction.rb
|
740
|
+
# $Id: transaction.rb 2678 2007-07-11 19:30:42Z luke $
|
data/lib/puppet/type.rb
CHANGED
@@ -1,18 +1,25 @@
|
|
1
1
|
require 'puppet'
|
2
2
|
require 'puppet/util/log'
|
3
|
-
require 'puppet/element'
|
4
3
|
require 'puppet/event'
|
5
4
|
require 'puppet/util/metric'
|
6
|
-
require 'puppet/
|
5
|
+
require 'puppet/property'
|
7
6
|
require 'puppet/parameter'
|
8
7
|
require 'puppet/util'
|
9
8
|
require 'puppet/util/autoload'
|
10
9
|
require 'puppet/metatype/manager'
|
10
|
+
require 'puppet/util/errors'
|
11
|
+
require 'puppet/util/log_paths'
|
12
|
+
require 'puppet/util/logging'
|
11
13
|
|
12
14
|
# see the bottom of the file for the rest of the inclusions
|
13
15
|
|
14
16
|
module Puppet
|
15
|
-
class Type
|
17
|
+
class Type
|
18
|
+
include Puppet::Util
|
19
|
+
include Puppet::Util::Errors
|
20
|
+
include Puppet::Util::LogPaths
|
21
|
+
include Puppet::Util::Logging
|
22
|
+
|
16
23
|
# Nearly all of the code in this class is stored in files in the
|
17
24
|
# metatype/ directory. This is a temporary measure until I get a chance
|
18
25
|
# to refactor this class entirely. There's still more simplification to
|
@@ -28,7 +35,7 @@ class Type < Puppet::Element
|
|
28
35
|
require 'puppet/metatype/schedules'
|
29
36
|
require 'puppet/metatype/tags'
|
30
37
|
|
31
|
-
# Types (which map to
|
38
|
+
# Types (which map to resources in the languages) are entirely composed of
|
32
39
|
# attribute value pairs. Generally, Puppet calls any of these things an
|
33
40
|
# 'attribute', but these attributes always take one of three specific
|
34
41
|
# forms: parameters, metaparams, or properties.
|
@@ -40,6 +47,7 @@ class Type < Puppet::Element
|
|
40
47
|
attr_reader :parent
|
41
48
|
|
42
49
|
attr_writer :title
|
50
|
+
attr_writer :noop
|
43
51
|
|
44
52
|
include Enumerable
|
45
53
|
|
@@ -53,6 +61,9 @@ class Type < Puppet::Element
|
|
53
61
|
attr_accessor :self_refresh
|
54
62
|
include Enumerable, Puppet::Util::ClassGen
|
55
63
|
include Puppet::MetaType::Manager
|
64
|
+
|
65
|
+
include Puppet::Util
|
66
|
+
include Puppet::Util::Logging
|
56
67
|
end
|
57
68
|
|
58
69
|
# all of the variables that must be initialized for each subclass
|
@@ -241,10 +252,12 @@ class Type < Puppet::Element
|
|
241
252
|
rescue ArgumentError, Puppet::Error, TypeError
|
242
253
|
raise
|
243
254
|
rescue => detail
|
244
|
-
|
255
|
+
error = Puppet::DevError.new(
|
245
256
|
"Could not set %s on %s: %s" %
|
246
257
|
[attr, self.class.name, detail]
|
247
258
|
)
|
259
|
+
error.set_backtrace(detail.backtrace)
|
260
|
+
raise error
|
248
261
|
end
|
249
262
|
hash.delete attr
|
250
263
|
end
|
@@ -381,4 +394,4 @@ require 'puppet/type/tidy'
|
|
381
394
|
|
382
395
|
|
383
396
|
|
384
|
-
# $Id: type.rb
|
397
|
+
# $Id: type.rb 2684 2007-07-12 16:39:47Z luke $
|
@@ -95,6 +95,12 @@ Puppet::Type.newtype(:component) do
|
|
95
95
|
def initialize(args)
|
96
96
|
@children = []
|
97
97
|
super(args)
|
98
|
+
|
99
|
+
# If the title isn't a full resource reference, assume
|
100
|
+
# we're a class and make an alias for that.
|
101
|
+
unless @title.to_s.include?("[")
|
102
|
+
self.class.alias("class[%s]" % @title, self)
|
103
|
+
end
|
98
104
|
end
|
99
105
|
|
100
106
|
def initvars
|
@@ -131,10 +137,10 @@ Puppet::Type.newtype(:component) do
|
|
131
137
|
if parentof?(child)
|
132
138
|
devfail "Already the parent of %s[%s]" % [child.class.name, child.title]
|
133
139
|
end
|
134
|
-
unless child.is_a?(Puppet::
|
140
|
+
unless child.is_a?(Puppet::Type)
|
135
141
|
self.debug "Got object of type %s" % child.class
|
136
142
|
self.devfail(
|
137
|
-
"Containers can only contain Puppet
|
143
|
+
"Containers can only contain Puppet resources, not %s" %
|
138
144
|
child.class
|
139
145
|
)
|
140
146
|
end
|
@@ -230,4 +236,4 @@ Puppet::Type.newtype(:component) do
|
|
230
236
|
end
|
231
237
|
end
|
232
238
|
|
233
|
-
# $Id: component.rb
|
239
|
+
# $Id: component.rb 2715 2007-07-19 19:23:56Z luke $
|
data/lib/puppet/type/cron.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
require 'etc'
|
2
2
|
require 'facter'
|
3
|
-
require 'puppet/type/property'
|
4
3
|
require 'puppet/util/filetype'
|
5
4
|
|
6
5
|
Puppet::Type.newtype(:cron) do
|
@@ -92,6 +91,9 @@ Puppet::Type.newtype(:cron) do
|
|
92
91
|
|
93
92
|
def should_to_s(newvalue = @should)
|
94
93
|
if newvalue
|
94
|
+
unless newvalue.is_a?(Array)
|
95
|
+
newvalue = [newvalue]
|
96
|
+
end
|
95
97
|
if self.name == :command or newvalue[0].is_a? Symbol
|
96
98
|
newvalue[0]
|
97
99
|
else
|
@@ -302,8 +304,12 @@ Puppet::Type.newtype(:cron) do
|
|
302
304
|
end
|
303
305
|
|
304
306
|
def is_to_s(newvalue)
|
305
|
-
if newvalue
|
306
|
-
newvalue.
|
307
|
+
if newvalue
|
308
|
+
if newvalue.is_a?(Array)
|
309
|
+
newvalue.join(",")
|
310
|
+
else
|
311
|
+
newvalue
|
312
|
+
end
|
307
313
|
else
|
308
314
|
nil
|
309
315
|
end
|
@@ -402,5 +408,5 @@ Puppet::Type.newtype(:cron) do
|
|
402
408
|
end
|
403
409
|
|
404
410
|
|
405
|
-
# $Id: cron.rb
|
411
|
+
# $Id: cron.rb 2698 2007-07-14 21:18:36Z luke $
|
406
412
|
|
data/lib/puppet/type/exec.rb
CHANGED
@@ -6,7 +6,12 @@ module Puppet
|
|
6
6
|
@doc = "Executes external commands. It is critical that all commands
|
7
7
|
executed using this mechanism can be run multiple times without
|
8
8
|
harm, i.e., they are *idempotent*. One useful way to create idempotent
|
9
|
-
commands is to use the
|
9
|
+
commands is to use the checks like ``creates`` to avoid running the
|
10
|
+
command unless some condition is met.
|
11
|
+
|
12
|
+
Note also that you can restrict an ``exec`` to only run when it receives
|
13
|
+
events by using the ``refreshonly`` parameter; this is a useful way to
|
14
|
+
have your configuration respond to events with arbitrary commands.
|
10
15
|
|
11
16
|
It is worth noting that ``exec`` is special, in that it is not
|
12
17
|
currently considered an error to have multiple ``exec`` instances
|
@@ -48,10 +53,9 @@ module Puppet
|
|
48
53
|
to native Puppet types as quickly as possible. If you find that
|
49
54
|
you are doing a lot of work with ``exec``, please at least notify
|
50
55
|
us at Reductive Labs what you are doing, and hopefully we can work with
|
51
|
-
you to get a native
|
56
|
+
you to get a native resource type for the work you are doing."
|
52
57
|
|
53
58
|
require 'open3'
|
54
|
-
require 'puppet/type/property'
|
55
59
|
|
56
60
|
# Create a new check mechanism. It's basically just a parameter that
|
57
61
|
# provides one extra 'check' method.
|
@@ -197,7 +201,7 @@ module Puppet
|
|
197
201
|
|
198
202
|
newparam(:logoutput) do
|
199
203
|
desc "Whether to log output. Defaults to logging output at the
|
200
|
-
loglevel for the ``exec``
|
204
|
+
loglevel for the ``exec`` resource. Values are **true**, *false*,
|
201
205
|
and any legal log level."
|
202
206
|
|
203
207
|
values = [:true, :false]
|
@@ -598,4 +602,4 @@ module Puppet
|
|
598
602
|
end
|
599
603
|
end
|
600
604
|
|
601
|
-
# $Id: exec.rb
|
605
|
+
# $Id: exec.rb 2696 2007-07-14 20:26:31Z luke $
|
data/lib/puppet/type/group.rb
CHANGED
@@ -8,12 +8,11 @@
|
|
8
8
|
|
9
9
|
require 'etc'
|
10
10
|
require 'facter'
|
11
|
-
require 'puppet/type/property'
|
12
11
|
|
13
12
|
module Puppet
|
14
13
|
newtype(:group) do
|
15
14
|
@doc = "Manage groups. This type can only create groups. Group
|
16
|
-
membership must be managed on individual users. This
|
15
|
+
membership must be managed on individual users. This resource type
|
17
16
|
uses the prescribed native tools for creating groups and generally
|
18
17
|
uses POSIX APIs for retrieving information about them. It does
|
19
18
|
not directly modify ``/etc/group`` or anything.
|
@@ -130,4 +129,4 @@ module Puppet
|
|
130
129
|
end
|
131
130
|
end
|
132
131
|
|
133
|
-
# $Id: group.rb
|
132
|
+
# $Id: group.rb 2665 2007-07-09 21:32:33Z luke $
|
@@ -0,0 +1,50 @@
|
|
1
|
+
module Puppet
|
2
|
+
newtype(:mailalias) do
|
3
|
+
@doc = "Creates an email alias in the local alias database."
|
4
|
+
|
5
|
+
ensurable
|
6
|
+
|
7
|
+
newparam(:name, :namevar => true) do
|
8
|
+
desc "The alias name."
|
9
|
+
end
|
10
|
+
|
11
|
+
newproperty(:recipient, :array_matching => :all) do
|
12
|
+
desc "Where email should should be sent. Multiple values
|
13
|
+
should be specified as an array."
|
14
|
+
|
15
|
+
def is_to_s(value)
|
16
|
+
if value.include?(:absent)
|
17
|
+
super
|
18
|
+
else
|
19
|
+
value.join(",")
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def should
|
24
|
+
@should
|
25
|
+
end
|
26
|
+
|
27
|
+
def should_to_s(value)
|
28
|
+
if value.include?(:absent)
|
29
|
+
super
|
30
|
+
else
|
31
|
+
value.join(",")
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
newproperty(:target) do
|
37
|
+
desc "The file in which to store the aliases. Only used by
|
38
|
+
those providers that write to disk (i.e., not NetInfo)."
|
39
|
+
|
40
|
+
defaultto { if @resource.class.defaultprovider.ancestors.include?(Puppet::Provider::ParsedFile)
|
41
|
+
@resource.class.defaultprovider.default_target
|
42
|
+
else
|
43
|
+
nil
|
44
|
+
end
|
45
|
+
}
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
# $Id: mailalias.rb 2676 2007-07-10 23:24:34Z luke $
|