puppet 2.6.6 → 2.6.7
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 +107 -1
- data/README.queueing +1 -1
- data/Rakefile +1 -1
- data/conf/solaris/smf/svc-puppetd +0 -2
- data/conf/solaris/smf/svc-puppetmasterd +0 -2
- data/examples/etc/init.d/sleeper +0 -2
- data/examples/modules/sample-module/README.txt +2 -2
- data/ext/puppetstoredconfigclean.rb +1 -1
- data/install.rb +20 -25
- data/lib/puppet.rb +1 -1
- data/lib/puppet/application/agent.rb +2 -2
- data/lib/puppet/application/apply.rb +2 -2
- data/lib/puppet/application/cert.rb +27 -11
- data/lib/puppet/application/filebucket.rb +1 -1
- data/lib/puppet/application/inspect.rb +1 -1
- data/lib/puppet/application/kick.rb +2 -2
- data/lib/puppet/application/master.rb +1 -1
- data/lib/puppet/application/queue.rb +2 -2
- data/lib/puppet/configurer/downloader.rb +1 -0
- data/lib/puppet/configurer/plugin_handler.rb +8 -1
- data/lib/puppet/daemon.rb +1 -1
- data/lib/puppet/defaults.rb +18 -2
- data/lib/puppet/external/nagios.rb +0 -2
- data/lib/puppet/external/nagios/base.rb +0 -2
- data/lib/puppet/indirector/facts/inventory_active_record.rb +97 -0
- data/lib/puppet/indirector/facts/rest.rb +2 -0
- data/lib/puppet/indirector/facts/yaml.rb +75 -0
- data/lib/puppet/indirector/indirection.rb +1 -0
- data/lib/puppet/module.rb +1 -1
- data/lib/puppet/network/http/api/v1.rb +3 -4
- data/lib/puppet/network/http/compression.rb +4 -1
- data/lib/puppet/network/http/handler.rb +1 -1
- data/lib/puppet/network/rest_authconfig.rb +1 -1
- data/lib/puppet/node/facts.rb +29 -0
- data/lib/puppet/parser/ast/collection.rb +5 -4
- data/lib/puppet/parser/ast/leaf.rb +1 -1
- data/lib/puppet/parser/functions/regsubst.rb +7 -14
- data/lib/puppet/parser/functions/split.rb +7 -7
- data/lib/puppet/parser/grammar.ra +2 -4
- data/lib/puppet/parser/lexer.rb +4 -1
- data/lib/puppet/parser/parser.rb +2062 -1976
- data/lib/puppet/parser/parser_support.rb +3 -3
- data/lib/puppet/provider/computer/computer.rb +1 -3
- data/lib/puppet/provider/mount.rb +12 -16
- data/lib/puppet/provider/mount/parsed.rb +67 -8
- data/lib/puppet/provider/parsedfile.rb +3 -1
- data/lib/puppet/provider/service/daemontools.rb +6 -6
- data/lib/puppet/provider/service/gentoo.rb +0 -2
- data/lib/puppet/provider/service/launchd.rb +11 -8
- data/lib/puppet/provider/service/runit.rb +4 -4
- data/lib/puppet/provider/user/useradd.rb +6 -1
- data/lib/puppet/rails/database/004_add_inventory_service_tables.rb +36 -0
- data/lib/puppet/rails/database/schema.rb +17 -0
- data/lib/puppet/rails/fact_name.rb +0 -2
- data/lib/puppet/rails/fact_value.rb +0 -2
- data/lib/puppet/rails/inventory_fact.rb +5 -0
- data/lib/puppet/rails/inventory_node.rb +25 -0
- data/lib/puppet/reference/configuration.rb +1 -1
- data/lib/puppet/reference/metaparameter.rb +1 -1
- data/lib/puppet/reports/store.rb +4 -1
- data/lib/puppet/resource.rb +39 -25
- data/lib/puppet/type.rb +5 -5
- data/lib/puppet/type/augeas.rb +4 -4
- data/lib/puppet/type/computer.rb +5 -1
- data/lib/puppet/type/exec.rb +3 -1
- data/lib/puppet/type/file.rb +3 -1
- data/lib/puppet/type/file/content.rb +13 -15
- data/lib/puppet/type/file/ensure.rb +11 -17
- data/lib/puppet/type/file/selcontext.rb +16 -0
- data/lib/puppet/type/file/target.rb +14 -1
- data/lib/puppet/type/k5login.rb +0 -2
- data/lib/puppet/type/macauthorization.rb +4 -1
- data/lib/puppet/type/mcx.rb +4 -1
- data/lib/puppet/type/mount.rb +37 -21
- data/lib/puppet/type/package.rb +5 -1
- data/lib/puppet/type/schedule.rb +20 -20
- data/lib/puppet/type/selmodule.rb +3 -1
- data/lib/puppet/type/ssh_authorized_key.rb +5 -1
- data/lib/puppet/type/user.rb +14 -1
- data/lib/puppet/type/zfs.rb +3 -1
- data/lib/puppet/type/zone.rb +3 -1
- data/lib/puppet/type/zpool.rb +7 -5
- data/lib/puppet/util.rb +5 -0
- data/lib/puppet/util/command_line.rb +1 -1
- data/lib/puppet/util/execution.rb +4 -5
- data/lib/puppet/util/execution_stub.rb +26 -0
- data/lib/puppet/util/monkey_patches.rb +21 -0
- data/lib/puppet/util/rdoc/code_objects.rb +39 -0
- data/lib/puppet/util/rdoc/generators/puppet_generator.rb +18 -0
- data/lib/puppet/util/rdoc/parser.rb +5 -3
- data/lib/puppet/util/settings.rb +1 -1
- data/spec/integration/parser/parser_spec.rb +7 -0
- data/spec/integration/provider/mount_spec.rb +151 -0
- data/spec/integration/type/file_spec.rb +32 -29
- data/spec/spec_helper.rb +2 -0
- data/spec/unit/application/agent_spec.rb +3 -7
- data/spec/unit/application/apply_spec.rb +17 -2
- data/spec/unit/application/cert_spec.rb +54 -14
- data/spec/unit/application/filebucket_spec.rb +1 -1
- data/spec/unit/application/queue_spec.rb +1 -5
- data/spec/unit/configurer/downloader_spec.rb +22 -10
- data/spec/unit/daemon_spec.rb +1 -5
- data/spec/unit/indirector/facts/inventory_active_record_spec.rb +163 -0
- data/spec/unit/indirector/facts/yaml_spec.rb +216 -2
- data/spec/unit/indirector/queue_spec.rb +3 -0
- data/spec/unit/module_spec.rb +2 -2
- data/spec/unit/network/handler/fileserver_spec.rb +1 -1
- data/spec/unit/network/http/api/v1_spec.rb +28 -0
- data/spec/unit/network/http/compression_spec.rb +1 -1
- data/spec/unit/network/http/handler_spec.rb +7 -4
- data/spec/unit/node/facts_spec.rb +24 -0
- data/spec/unit/parser/ast/collection_spec.rb +16 -12
- data/spec/unit/parser/lexer_spec.rb +16 -0
- data/spec/unit/parser/parser_spec.rb +35 -2
- data/spec/unit/provider/mount/parsed_spec.rb +199 -114
- data/spec/unit/provider/mount_spec.rb +54 -53
- data/spec/unit/provider/ssh_authorized_key/parsed_spec.rb +1 -0
- data/spec/unit/provider/user/user_role_add_spec.rb +1 -0
- data/spec/unit/provider/user/useradd_spec.rb +43 -3
- data/spec/unit/reports/store_spec.rb +1 -1
- data/spec/unit/resource_spec.rb +39 -13
- data/spec/unit/type/file/content_spec.rb +38 -137
- data/spec/unit/type/file/selinux_spec.rb +5 -0
- data/spec/unit/type/mount_spec.rb +167 -122
- data/spec/unit/type/user_spec.rb +4 -0
- data/spec/unit/type_spec.rb +12 -1
- data/spec/unit/util/execution_spec.rb +49 -0
- data/spec/unit/util/execution_stub_spec.rb +35 -0
- data/spec/unit/util/rdoc/parser_spec.rb +15 -3
- data/spec/unit/util/settings_spec.rb +11 -2
- data/tasks/rake/git_workflow.rake +1 -1
- data/test/Rakefile +0 -2
- data/test/data/providers/mount/parsed/aix.mount +7 -0
- data/test/data/providers/mount/parsed/darwin.mount +6 -0
- data/test/data/providers/mount/parsed/hpux.mount +17 -0
- data/test/data/providers/mount/parsed/linux.mount +5 -0
- data/test/data/providers/mount/parsed/solaris.mount +6 -0
- data/test/data/types/mount/linux.fstab +1 -0
- data/test/data/types/mount/solaris.fstab +1 -0
- metadata +18 -4
data/lib/puppet/resource.rb
CHANGED
@@ -5,6 +5,11 @@ require 'puppet/util/pson'
|
|
5
5
|
# The simplest resource class. Eventually it will function as the
|
6
6
|
# base class for all resource-like behaviour.
|
7
7
|
class Puppet::Resource
|
8
|
+
# This stub class is only needed for serialization compatibility with 0.25.x.
|
9
|
+
# Specifically, it exists to provide a compatibility API when using YAML
|
10
|
+
# serialized objects loaded from StoreConfigs.
|
11
|
+
Reference = Puppet::Resource
|
12
|
+
|
8
13
|
include Puppet::Util::Tagging
|
9
14
|
|
10
15
|
require 'puppet/resource/type_collection_helper'
|
@@ -87,7 +92,7 @@ class Puppet::Resource
|
|
87
92
|
def yaml_property_munge(x)
|
88
93
|
case x
|
89
94
|
when Hash
|
90
|
-
x.inject({}) { |h,kv|
|
95
|
+
x.inject({}) { |h,kv|
|
91
96
|
k,v = kv
|
92
97
|
h[k] = self.class.value_to_pson_data(v)
|
93
98
|
h
|
@@ -104,7 +109,7 @@ class Puppet::Resource
|
|
104
109
|
# be overridden at some point, but this works for now.
|
105
110
|
%w{has_key? keys length delete empty? <<}.each do |method|
|
106
111
|
define_method(method) do |*args|
|
107
|
-
|
112
|
+
parameters.send(method, *args)
|
108
113
|
end
|
109
114
|
end
|
110
115
|
|
@@ -112,13 +117,13 @@ class Puppet::Resource
|
|
112
117
|
# to lower-case symbols.
|
113
118
|
def []=(param, value)
|
114
119
|
validate_parameter(param) if validate_parameters
|
115
|
-
|
120
|
+
parameters[parameter_name(param)] = value
|
116
121
|
end
|
117
122
|
|
118
123
|
# Return a given parameter's value. Converts all passed names
|
119
124
|
# to lower-case symbols.
|
120
125
|
def [](param)
|
121
|
-
|
126
|
+
parameters[parameter_name(param)]
|
122
127
|
end
|
123
128
|
|
124
129
|
def ==(other)
|
@@ -140,11 +145,11 @@ class Puppet::Resource
|
|
140
145
|
|
141
146
|
# Iterate over each param/value pair, as required for Enumerable.
|
142
147
|
def each
|
143
|
-
|
148
|
+
parameters.each { |p,v| yield p, v }
|
144
149
|
end
|
145
150
|
|
146
151
|
def include?(parameter)
|
147
|
-
super ||
|
152
|
+
super || parameters.keys.include?( parameter_name(parameter) )
|
148
153
|
end
|
149
154
|
|
150
155
|
# These two methods are extracted into a Helper
|
@@ -170,14 +175,6 @@ class Puppet::Resource
|
|
170
175
|
end
|
171
176
|
end
|
172
177
|
|
173
|
-
# This stub class is only needed for serialization compatibility with 0.25.x
|
174
|
-
class Reference
|
175
|
-
attr_accessor :type,:title
|
176
|
-
def initialize(type,title)
|
177
|
-
@type,@title = type,title
|
178
|
-
end
|
179
|
-
end
|
180
|
-
|
181
178
|
# Create our resource.
|
182
179
|
def initialize(type, title = nil, attributes = {})
|
183
180
|
@parameters = {}
|
@@ -204,7 +201,7 @@ class Puppet::Resource
|
|
204
201
|
tag(self.type)
|
205
202
|
tag(self.title) if valid_tag?(self.title)
|
206
203
|
|
207
|
-
@reference =
|
204
|
+
@reference = self # for serialization compatibility with 0.25.x
|
208
205
|
if strict? and ! resource_type
|
209
206
|
if @type == 'Class'
|
210
207
|
raise ArgumentError, "Could not find declared class #{title}"
|
@@ -234,7 +231,7 @@ class Puppet::Resource
|
|
234
231
|
|
235
232
|
# Produce a simple hash of our parameters.
|
236
233
|
def to_hash
|
237
|
-
parse_title.merge
|
234
|
+
parse_title.merge parameters
|
238
235
|
end
|
239
236
|
|
240
237
|
def to_s
|
@@ -255,15 +252,26 @@ class Puppet::Resource
|
|
255
252
|
|
256
253
|
# Convert our resource to Puppet code.
|
257
254
|
def to_manifest
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
255
|
+
# Collect list of attributes to align => and move ensure first
|
256
|
+
attr = parameters.keys
|
257
|
+
attr_max = attr.inject(0) { |max,k| k.to_s.length > max ? k.to_s.length : max }
|
258
|
+
|
259
|
+
attr.sort!
|
260
|
+
if attr.first != :ensure && attr.include?(:ensure)
|
261
|
+
attr.delete(:ensure)
|
262
|
+
attr.unshift(:ensure)
|
263
|
+
end
|
264
|
+
|
265
|
+
attributes = attr.collect { |k|
|
266
|
+
v = parameters[k]
|
267
|
+
if v.is_a? Array
|
268
|
+
" %-#{attr_max}s => %s,\n" % [ k, "[\'#{v.join("', '")}\']" ]
|
269
|
+
else
|
270
|
+
" %-#{attr_max}s => %s,\n" % [ k, "\'#{v}\'" ]
|
271
|
+
end
|
272
|
+
}
|
273
|
+
|
274
|
+
"%s { '%s':\n%s}" % [self.type.to_s.downcase, self.title, attributes]
|
267
275
|
end
|
268
276
|
|
269
277
|
def to_ref
|
@@ -422,4 +430,10 @@ class Puppet::Resource
|
|
422
430
|
return { :name => title.to_s }
|
423
431
|
end
|
424
432
|
end
|
433
|
+
|
434
|
+
def parameters
|
435
|
+
# @parameters could have been loaded from YAML, causing it to be nil (by
|
436
|
+
# bypassing initialize).
|
437
|
+
@parameters ||= {}
|
438
|
+
end
|
425
439
|
end
|
data/lib/puppet/type.rb
CHANGED
@@ -200,7 +200,7 @@ class Type
|
|
200
200
|
end
|
201
201
|
|
202
202
|
def uniqueness_key
|
203
|
-
|
203
|
+
self.class.key_attributes.sort_by { |attribute_name| attribute_name.to_s }.map{ |attribute_name| self[attribute_name] }
|
204
204
|
end
|
205
205
|
|
206
206
|
# Create a new parameter. Requires a block and a name, stores it in the
|
@@ -382,8 +382,8 @@ class Type
|
|
382
382
|
|
383
383
|
fail("Invalid parameter #{name}(#{name.inspect})") unless self.class.validattr?(name)
|
384
384
|
|
385
|
-
if name == :name
|
386
|
-
name =
|
385
|
+
if name == :name && nv = name_var
|
386
|
+
name = nv
|
387
387
|
end
|
388
388
|
|
389
389
|
if obj = @parameters[name]
|
@@ -403,8 +403,8 @@ class Type
|
|
403
403
|
|
404
404
|
fail("Invalid parameter #{name}") unless self.class.validattr?(name)
|
405
405
|
|
406
|
-
if name == :name
|
407
|
-
name =
|
406
|
+
if name == :name && nv = name_var
|
407
|
+
name = nv
|
408
408
|
end
|
409
409
|
raise Puppet::Error.new("Got nil value for #{name}") if value.nil?
|
410
410
|
|
data/lib/puppet/type/augeas.rb
CHANGED
@@ -98,10 +98,10 @@ Puppet::Type.newtype(:augeas) do
|
|
98
98
|
can be either a string which contains a command or an array of commands.
|
99
99
|
Commands supported are:
|
100
100
|
|
101
|
-
set [PATH] [VALUE]
|
102
|
-
rm [PATH]
|
103
|
-
remove [PATH]
|
104
|
-
clear [PATH]
|
101
|
+
set [PATH] [VALUE] Sets the value VALUE at loction PATH
|
102
|
+
rm [PATH] Removes the node at location PATH
|
103
|
+
remove [PATH] Synonym for rm
|
104
|
+
clear [PATH] Keeps the node at PATH, but removes the value.
|
105
105
|
ins [LABEL] [WHERE] [PATH] Inserts an empty node LABEL either [WHERE={before|after}] PATH.
|
106
106
|
insert [LABEL] [WHERE] [PATH] Synonym for ins
|
107
107
|
|
data/lib/puppet/type/computer.rb
CHANGED
@@ -14,7 +14,11 @@ Puppet::Type.newtype(:computer) do
|
|
14
14
|
type as per other platforms.
|
15
15
|
|
16
16
|
This type primarily exists to create localhost Computer objects that MCX
|
17
|
-
policy can then be attached to.
|
17
|
+
policy can then be attached to.
|
18
|
+
|
19
|
+
**Autorequires:** If Puppet is managing the plist file representing a
|
20
|
+
Computer object (located at `/var/db/dslocal/nodes/Default/computers/{name}.plist`),
|
21
|
+
the Computer resource will autorequire it."
|
18
22
|
|
19
23
|
# ensurable
|
20
24
|
|
data/lib/puppet/type/exec.rb
CHANGED
@@ -22,7 +22,9 @@ module Puppet
|
|
22
22
|
to native Puppet types as quickly as possible. If you find that
|
23
23
|
you are doing a lot of work with `exec`, please at least notify
|
24
24
|
us at Puppet Labs what you are doing, and hopefully we can work with
|
25
|
-
you to get a native resource type for the work you are doing.
|
25
|
+
you to get a native resource type for the work you are doing.
|
26
|
+
|
27
|
+
**Autorequires:** If Puppet is managing an exec's cwd or the executable file used in an exec's command, the exec resource will autorequire those files. If Puppet is managing the user that an exec should run as, the exec resource will autorequire that user."
|
26
28
|
|
27
29
|
require 'open3'
|
28
30
|
|
data/lib/puppet/type/file.rb
CHANGED
@@ -22,7 +22,9 @@ Puppet::Type.newtype(:file) do
|
|
22
22
|
If you find that you are often copying files in from a central
|
23
23
|
location, rather than using native resources, please contact
|
24
24
|
Puppet Labs and we can hopefully work with you to develop a
|
25
|
-
native resource to support what you are doing.
|
25
|
+
native resource to support what you are doing.
|
26
|
+
|
27
|
+
**Autorequires:** If Puppet is managing the user or group that owns a file, the file resource will autorequire them. If Puppet is managing any parent directories of a file, the file resource will autorequire them."
|
26
28
|
|
27
29
|
def self.title_patterns
|
28
30
|
[ [ /^(.*?)\/*\Z/m, [ [ :path, lambda{|x| x} ] ] ] ]
|
@@ -17,22 +17,21 @@ module Puppet
|
|
17
17
|
|
18
18
|
desc "Specify the contents of a file as a string. Newlines, tabs, and
|
19
19
|
spaces can be specified using the escaped syntax (e.g., \\n for a newline). The primary purpose of this parameter is to provide a
|
20
|
-
kind of limited templating
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
20
|
+
kind of limited templating:
|
21
|
+
|
22
|
+
define resolve(nameserver1, nameserver2, domain, search) {
|
23
|
+
$str = \"search $search
|
24
|
+
domain $domain
|
25
|
+
nameserver $nameserver1
|
26
|
+
nameserver $nameserver2
|
27
|
+
\"
|
28
|
+
|
29
|
+
file { \"/etc/resolv.conf\":
|
30
|
+
content => $str
|
31
|
+
}
|
31
32
|
}
|
32
|
-
}
|
33
33
|
|
34
|
-
This attribute is especially useful when used with
|
35
|
-
`PuppetTemplating templating`:trac:."
|
34
|
+
This attribute is especially useful when used with templating."
|
36
35
|
|
37
36
|
# Store a checksum as the value, rather than the actual content.
|
38
37
|
# Simplifies everything.
|
@@ -201,7 +200,6 @@ module Puppet
|
|
201
200
|
connection = Puppet::Network::HttpPool.http_instance(source_or_content.server, source_or_content.port)
|
202
201
|
connection.request_get(indirection2uri(request), add_accept_encoding({"Accept" => "raw"})) do |response|
|
203
202
|
case response.code
|
204
|
-
when "404"; nil
|
205
203
|
when /^2/; uncompress(response) { |uncompressor| response.read_body { |chunk| yield uncompressor.uncompress(chunk) } }
|
206
204
|
else
|
207
205
|
# Raise the http error if we didn't get a 'success' of some kind.
|
@@ -7,29 +7,23 @@ module Puppet
|
|
7
7
|
if the file is missing will create an empty file. Specifying
|
8
8
|
`absent` will delete the file (and directory if recurse => true).
|
9
9
|
|
10
|
-
Anything other than those values will
|
11
|
-
|
10
|
+
Anything other than those values will create a symlink. In the interest of readability and clarity, you should use `ensure => link` and explicitly specify a
|
11
|
+
target; however, if a `target` attribute isn't provided, the value of the `ensure`
|
12
|
+
attribute will be used as the symlink target:
|
12
13
|
|
13
|
-
# Useful on
|
14
|
+
# (Useful on Solaris)
|
15
|
+
# Less maintainable:
|
14
16
|
file { \"/etc/inetd.conf\":
|
15
|
-
ensure => \"/etc/inet/inetd.conf\"
|
17
|
+
ensure => \"/etc/inet/inetd.conf\",
|
16
18
|
}
|
17
19
|
|
18
|
-
|
19
|
-
|
20
|
-
# Useful on solaris
|
20
|
+
# More maintainable:
|
21
21
|
file { \"/etc/inetd.conf\":
|
22
|
-
ensure =>
|
22
|
+
ensure => link,
|
23
|
+
target => \"/etc/inet/inetd.conf\",
|
23
24
|
}
|
24
|
-
|
25
|
-
|
26
|
-
as one of the valid values, you must prefix it with `./` or
|
27
|
-
something similar.
|
28
|
-
|
29
|
-
You can also make recursive symlinks, which will create a
|
30
|
-
directory structure that maps to the target directory,
|
31
|
-
with directories corresponding to each directory
|
32
|
-
and links corresponding to each file."
|
25
|
+
|
26
|
+
These two declarations are equivalent."
|
33
27
|
|
34
28
|
# Most 'ensure' properties have a default, but with files we, um, don't.
|
35
29
|
nodefault
|
@@ -32,9 +32,14 @@ module Puppet
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def retrieve_default_context(property)
|
35
|
+
if @resource[:selinux_ignore_defaults] == :true
|
36
|
+
return nil
|
37
|
+
end
|
38
|
+
|
35
39
|
unless context = self.get_selinux_default_context(@resource[:path])
|
36
40
|
return nil
|
37
41
|
end
|
42
|
+
|
38
43
|
property_default = self.parse_selinux_context(property, context)
|
39
44
|
self.debug "Found #{property} default '#{property_default}' for #{@resource[:path]}" if not property_default.nil?
|
40
45
|
property_default
|
@@ -54,6 +59,17 @@ module Puppet
|
|
54
59
|
end
|
55
60
|
end
|
56
61
|
|
62
|
+
Puppet::Type.type(:file).newparam(:selinux_ignore_defaults) do
|
63
|
+
desc "If this is set then Puppet will not ask SELinux (via matchpathcon) to
|
64
|
+
supply defaults for the SELinux attributes (seluser, selrole,
|
65
|
+
seltype, and selrange). In general, you should leave this set at its
|
66
|
+
default and only set it to true when you need Puppet to not try to fix
|
67
|
+
SELinux labels automatically."
|
68
|
+
newvalues(:true, :false)
|
69
|
+
|
70
|
+
defaultto :false
|
71
|
+
end
|
72
|
+
|
57
73
|
Puppet::Type.type(:file).newproperty(:seluser, :parent => Puppet::SELFileContext) do
|
58
74
|
desc "What the SELinux user component of the context of the file should be.
|
59
75
|
Any valid SELinux user component is accepted. For example `user_u`.
|
@@ -1,7 +1,20 @@
|
|
1
1
|
module Puppet
|
2
2
|
Puppet::Type.type(:file).newproperty(:target) do
|
3
3
|
desc "The target for creating a link. Currently, symlinks are the
|
4
|
-
only type supported.
|
4
|
+
only type supported.
|
5
|
+
|
6
|
+
You can make relative links:
|
7
|
+
|
8
|
+
# (Useful on Solaris)
|
9
|
+
file { \"/etc/inetd.conf\":
|
10
|
+
ensure => link,
|
11
|
+
target => \"inet/inetd.conf\",
|
12
|
+
}
|
13
|
+
|
14
|
+
You can also make recursive symlinks, which will create a
|
15
|
+
directory structure that maps to the target directory,
|
16
|
+
with directories corresponding to each directory
|
17
|
+
and links corresponding to each file."
|
5
18
|
|
6
19
|
newvalue(:notlink) do
|
7
20
|
# We do nothing if the value is absent
|
data/lib/puppet/type/k5login.rb
CHANGED
@@ -1,7 +1,10 @@
|
|
1
1
|
Puppet::Type.newtype(:macauthorization) do
|
2
2
|
|
3
3
|
@doc = "Manage the Mac OS X authorization database.
|
4
|
-
See the [Apple developer site](http://developer.apple.com/documentation/Security/Conceptual/Security_Overview/Security_Services/chapter_4_section_5.html) for more information.
|
4
|
+
See the [Apple developer site](http://developer.apple.com/documentation/Security/Conceptual/Security_Overview/Security_Services/chapter_4_section_5.html) for more information.
|
5
|
+
|
6
|
+
**Autorequires:** If Puppet is managing the `/etc/authorization` file, each
|
7
|
+
macauthorization resource will autorequire it."
|
5
8
|
|
6
9
|
ensurable
|
7
10
|
|
data/lib/puppet/type/mcx.rb
CHANGED
@@ -27,8 +27,11 @@ content property of the file type in Puppet.
|
|
27
27
|
|
28
28
|
The recommended method of using this type is to use Work Group Manager
|
29
29
|
to manage users and groups on the local computer, record the resulting
|
30
|
-
puppet manifest using the command
|
30
|
+
puppet manifest using the command `puppet resource mcx`, then deploy it
|
31
31
|
to other machines.
|
32
|
+
|
33
|
+
**Autorequires:** If Puppet is managing the user, group, or computer that these
|
34
|
+
MCX settings refer to, the MCX resource will autorequire that user, group, or computer.
|
32
35
|
"
|
33
36
|
feature :manages_content, \
|
34
37
|
"The provider can manage MCXSettings as a string.",
|
data/lib/puppet/type/mount.rb
CHANGED
@@ -21,6 +21,11 @@ module Puppet
|
|
21
21
|
fstab and mount it. Set to `present` to add to fstab but not change
|
22
22
|
mount/unmount status"
|
23
23
|
|
24
|
+
# IS -> SHOULD In Sync Action
|
25
|
+
# ghost -> present NO create
|
26
|
+
# absent -> present NO create
|
27
|
+
# (mounted -> present YES)
|
28
|
+
# (unmounted -> present YES)
|
24
29
|
newvalue(:defined) do
|
25
30
|
provider.create
|
26
31
|
return :mount_created
|
@@ -28,55 +33,66 @@ module Puppet
|
|
28
33
|
|
29
34
|
aliasvalue :present, :defined
|
30
35
|
|
36
|
+
# IS -> SHOULD In Sync Action
|
37
|
+
# ghost -> unmounted NO create, unmount
|
38
|
+
# absent -> unmounted NO create
|
39
|
+
# mounted -> unmounted NO unmount
|
31
40
|
newvalue(:unmounted) do
|
32
|
-
|
33
|
-
|
41
|
+
case self.retrieve
|
42
|
+
when :ghost # (not in fstab but mounted)
|
43
|
+
provider.create
|
44
|
+
@resource.flush
|
34
45
|
provider.unmount
|
35
46
|
return :mount_unmounted
|
36
|
-
|
47
|
+
when nil, :absent # (not in fstab and not mounted)
|
37
48
|
provider.create
|
38
49
|
return :mount_created
|
50
|
+
when :mounted # (in fstab and mounted)
|
51
|
+
provider.unmount
|
52
|
+
syncothers # I guess it's more likely that the mount was originally mounted with
|
53
|
+
# the wrong attributes so I sync AFTER the umount
|
54
|
+
return :mount_unmounted
|
55
|
+
else
|
56
|
+
raise Puppet::Error, "Unexpected change from #{current_value} to unmounted}"
|
39
57
|
end
|
40
58
|
end
|
41
59
|
|
60
|
+
# IS -> SHOULD In Sync Action
|
61
|
+
# ghost -> absent NO unmount
|
62
|
+
# mounted -> absent NO provider.destroy AND unmount
|
63
|
+
# unmounted -> absent NO provider.destroy
|
42
64
|
newvalue(:absent, :event => :mount_deleted) do
|
65
|
+
current_value = self.retrieve
|
43
66
|
provider.unmount if provider.mounted?
|
44
|
-
|
45
|
-
provider.destroy
|
67
|
+
provider.destroy unless current_value == :ghost
|
46
68
|
end
|
47
69
|
|
70
|
+
# IS -> SHOULD In Sync Action
|
71
|
+
# ghost -> mounted NO provider.create
|
72
|
+
# absent -> mounted NO provider.create AND mount
|
73
|
+
# unmounted -> mounted NO mount
|
48
74
|
newvalue(:mounted, :event => :mount_mounted) do
|
49
75
|
# Create the mount point if it does not already exist.
|
50
76
|
current_value = self.retrieve
|
51
|
-
|
77
|
+
currently_mounted = provider.mounted?
|
78
|
+
provider.create if [nil, :absent, :ghost].include?(current_value)
|
52
79
|
|
53
80
|
syncothers
|
54
81
|
|
55
82
|
# The fs can be already mounted if it was absent but mounted
|
56
|
-
provider.
|
83
|
+
provider.property_hash[:needs_mount] = true unless currently_mounted
|
57
84
|
end
|
58
85
|
|
86
|
+
# insync: mounted -> present
|
87
|
+
# unmounted -> present
|
59
88
|
def insync?(is)
|
60
|
-
if should == :defined and is
|
89
|
+
if should == :defined and [:mounted,:unmounted].include?(is)
|
61
90
|
true
|
62
91
|
else
|
63
92
|
super
|
64
93
|
end
|
65
94
|
end
|
66
95
|
|
67
|
-
def retrieve
|
68
|
-
# We need to special case :mounted; if we're absent, we still
|
69
|
-
# want
|
70
|
-
curval = super()
|
71
|
-
if curval == :absent
|
72
|
-
return :absent
|
73
|
-
elsif provider.mounted?
|
74
|
-
return :mounted
|
75
|
-
else
|
76
|
-
return :unmounted
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
96
|
def syncothers
|
81
97
|
# We have to flush any changes to disk.
|
82
98
|
currentvalues = @resource.retrieve_resource
|