puppet 2.7.11 → 2.7.12
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 +188 -0
- data/conf/osx/createpackage.sh +1 -0
- data/conf/redhat/puppet.spec +12 -9
- data/conf/suse/puppet.spec +4 -1
- data/install.rb +9 -22
- data/lib/puppet.rb +1 -31
- data/lib/puppet/agent.rb +3 -5
- data/lib/puppet/agent/locker.rb +15 -1
- data/lib/puppet/application.rb +7 -4
- data/lib/puppet/application/agent.rb +4 -25
- data/lib/puppet/application/apply.rb +3 -3
- data/lib/puppet/application/device.rb +2 -16
- data/lib/puppet/application/doc.rb +2 -2
- data/lib/puppet/application/face_base.rb +22 -5
- data/lib/puppet/application/filebucket.rb +2 -0
- data/lib/puppet/application/inspect.rb +2 -1
- data/lib/puppet/application/kick.rb +25 -9
- data/lib/puppet/application/queue.rb +0 -23
- data/lib/puppet/configurer.rb +1 -0
- data/lib/puppet/configurer/downloader.rb +7 -3
- data/lib/puppet/defaults.rb +34 -29
- data/lib/puppet/face/ca.rb +1 -1
- data/lib/puppet/face/catalog.rb +1 -0
- data/lib/puppet/face/file/store.rb +1 -1
- data/lib/puppet/face/module/list.rb +23 -3
- data/lib/puppet/face/module/search.rb +21 -32
- data/lib/puppet/face/module/uninstall.rb +56 -15
- data/lib/puppet/file_bucket/dipper.rb +2 -2
- data/lib/puppet/file_serving/base.rb +6 -5
- data/lib/puppet/file_serving/configuration/parser.rb +1 -1
- data/lib/puppet/file_serving/content.rb +1 -1
- data/lib/puppet/forge.rb +153 -0
- data/lib/puppet/{module_tool → forge}/cache.rb +1 -2
- data/lib/puppet/{module_tool → forge}/repository.rb +46 -4
- data/lib/puppet/indirector/exec.rb +1 -1
- data/lib/puppet/indirector/file_bucket_file/file.rb +3 -3
- data/lib/puppet/interface/action.rb +6 -2
- data/lib/puppet/module.rb +70 -10
- data/lib/puppet/module_tool.rb +2 -38
- data/lib/puppet/module_tool/applications.rb +15 -11
- data/lib/puppet/module_tool/applications/application.rb +2 -5
- data/lib/puppet/module_tool/applications/cleaner.rb +1 -1
- data/lib/puppet/module_tool/applications/installer.rb +10 -45
- data/lib/puppet/module_tool/applications/searcher.rb +2 -26
- data/lib/puppet/module_tool/applications/uninstaller.rb +39 -13
- data/lib/puppet/module_tool/applications/unpacker.rb +1 -1
- data/lib/puppet/module_tool/dependency.rb +1 -1
- data/lib/puppet/network/authconfig.rb +1 -1
- data/lib/puppet/network/handler/fileserver.rb +1 -1
- data/lib/puppet/network/http/handler.rb +4 -1
- data/lib/puppet/network/http/webrick.rb +4 -2
- data/lib/puppet/node/environment.rb +32 -6
- data/lib/puppet/parameter/path.rb +0 -4
- data/lib/puppet/parser/ast/relationship.rb +3 -16
- data/lib/puppet/parser/collector.rb +5 -3
- data/lib/puppet/parser/compiler.rb +2 -1
- data/lib/puppet/parser/functions/file.rb +1 -1
- data/lib/puppet/parser/functions/generate.rb +8 -2
- data/lib/puppet/parser/grammar.ra +16 -15
- data/lib/puppet/parser/parser.rb +959 -881
- data/lib/puppet/parser/relationship.rb +32 -15
- data/lib/puppet/parser/resource.rb +0 -1
- data/lib/puppet/parser/type_loader.rb +1 -2
- data/lib/puppet/provider/augeas/augeas.rb +17 -29
- data/lib/puppet/provider/exec/windows.rb +25 -3
- data/lib/puppet/provider/file/posix.rb +1 -1
- data/lib/puppet/provider/file/windows.rb +1 -1
- data/lib/puppet/provider/group/windows_adsi.rb +1 -1
- data/lib/puppet/provider/package/aix.rb +1 -1
- data/lib/puppet/provider/package/appdmg.rb +1 -1
- data/lib/puppet/provider/package/dpkg.rb +1 -1
- data/lib/puppet/provider/package/gem.rb +21 -23
- data/lib/puppet/provider/package/macports.rb +1 -1
- data/lib/puppet/provider/package/msi.rb +7 -1
- data/lib/puppet/provider/package/openbsd.rb +13 -16
- data/lib/puppet/provider/package/pacman.rb +1 -1
- data/lib/puppet/provider/package/pip.rb +3 -0
- data/lib/puppet/provider/package/pkg.rb +1 -1
- data/lib/puppet/provider/package/pkgdmg.rb +1 -1
- data/lib/puppet/provider/package/pkgutil.rb +1 -1
- data/lib/puppet/provider/package/portage.rb +2 -2
- data/lib/puppet/provider/package/rpm.rb +1 -1
- data/lib/puppet/provider/package/sun.rb +1 -1
- data/lib/puppet/provider/package/zypper.rb +35 -3
- data/lib/puppet/provider/scheduled_task/win32_taskscheduler.rb +6 -2
- data/lib/puppet/provider/selmodule/semodule.rb +2 -2
- data/lib/puppet/provider/service/base.rb +1 -1
- data/lib/puppet/provider/service/launchd.rb +4 -0
- data/lib/puppet/provider/service/src.rb +2 -2
- data/lib/puppet/provider/service/upstart.rb +1 -1
- data/lib/puppet/provider/service/windows.rb +5 -4
- data/lib/puppet/provider/user/aix.rb +3 -3
- data/lib/puppet/provider/user/pw.rb +6 -0
- data/lib/puppet/provider/user/windows_adsi.rb +1 -1
- data/lib/puppet/resource/catalog.rb +6 -6
- data/lib/puppet/resource/type.rb +2 -0
- data/lib/puppet/ssl/certificate_request.rb +0 -70
- data/lib/puppet/transaction.rb +1 -1
- data/lib/puppet/transaction/report.rb +3 -2
- data/lib/puppet/type.rb +1 -1
- data/lib/puppet/type/cron.rb +5 -2
- data/lib/puppet/type/exec.rb +8 -0
- data/lib/puppet/type/file.rb +27 -18
- data/lib/puppet/type/file/checksum.rb +2 -2
- data/lib/puppet/type/file/content.rb +14 -9
- data/lib/puppet/type/file/ensure.rb +5 -4
- data/lib/puppet/type/file/group.rb +10 -2
- data/lib/puppet/type/file/mode.rb +46 -18
- data/lib/puppet/type/file/owner.rb +10 -2
- data/lib/puppet/type/file/source.rb +27 -40
- data/lib/puppet/type/file/target.rb +6 -6
- data/lib/puppet/type/group.rb +13 -9
- data/lib/puppet/type/k5login.rb +1 -1
- data/lib/puppet/type/package.rb +24 -8
- data/lib/puppet/type/scheduled_task.rb +77 -131
- data/lib/puppet/type/service.rb +22 -8
- data/lib/puppet/type/user.rb +29 -9
- data/lib/puppet/util.rb +24 -33
- data/lib/puppet/util/colors.rb +98 -0
- data/lib/puppet/util/diff.rb +3 -1
- data/lib/puppet/util/log.rb +5 -1
- data/lib/puppet/util/log/destinations.rb +37 -44
- data/lib/puppet/util/monkey_patches.rb +32 -0
- data/lib/puppet/util/pidlock.rb +70 -21
- data/lib/puppet/util/rdoc/parser.rb +4 -2
- data/lib/puppet/util/selinux.rb +1 -1
- data/lib/puppet/util/suidmanager.rb +2 -12
- data/lib/puppet/util/windows.rb +2 -0
- data/lib/puppet/util/windows/process.rb +33 -0
- data/lib/puppet/util/windows/security.rb +6 -4
- data/lib/puppet/util/windows/user.rb +44 -0
- data/lib/semver.rb +55 -4
- data/spec/fixtures/unit/provider/package/openbsd/pkginfo.detail +19 -0
- data/spec/fixtures/unit/provider/package/openbsd/pkginfo.list +10 -0
- data/spec/fixtures/unit/provider/package/openbsd/pkginfo.query +1 -0
- data/spec/fixtures/unit/provider/package/zypper/zypper-list-updates-SLES11sp1.out +369 -0
- data/spec/integration/defaults_spec.rb +10 -0
- data/spec/integration/indirector/direct_file_server_spec.rb +1 -1
- data/spec/integration/module_tool_spec.rb +10 -12
- data/spec/integration/parser/compiler_spec.rb +147 -0
- data/spec/integration/type/file_spec.rb +1 -1
- data/spec/integration/util/windows/user_spec.rb +59 -0
- data/spec/lib/puppet/face/basetest.rb +5 -0
- data/spec/lib/puppet_spec/modules.rb +26 -0
- data/spec/spec_helper.rb +25 -0
- data/spec/unit/agent/locker_spec.rb +12 -0
- data/spec/unit/agent_backward_compatibility_spec.rb +152 -0
- data/spec/unit/agent_spec.rb +28 -8
- data/spec/unit/application/agent_spec.rb +4 -36
- data/spec/unit/application/device_spec.rb +55 -10
- data/spec/unit/application/face_base_spec.rb +32 -10
- data/spec/unit/application/filebucket_spec.rb +5 -0
- data/spec/unit/application/kick_spec.rb +6 -0
- data/spec/unit/application_spec.rb +8 -1
- data/spec/unit/configurer/downloader_spec.rb +4 -5
- data/spec/unit/face/ca_spec.rb +15 -4
- data/spec/unit/file_bucket/dipper_spec.rb +1 -1
- data/spec/unit/file_serving/base_spec.rb +60 -42
- data/spec/unit/file_serving/configuration/parser_spec.rb +5 -3
- data/spec/unit/file_serving/content_spec.rb +26 -27
- data/spec/unit/file_serving/metadata_spec.rb +22 -21
- data/spec/unit/forge/repository_spec.rb +86 -0
- data/spec/unit/forge_spec.rb +114 -0
- data/spec/unit/indirector/exec_spec.rb +8 -6
- data/spec/unit/indirector/facts/inventory_active_record_spec.rb +0 -1
- data/spec/unit/indirector/file_bucket_file/file_spec.rb +1 -1
- data/spec/unit/indirector/node/exec_spec.rb +1 -1
- data/spec/unit/indirector/resource/active_record_spec.rb +0 -4
- data/spec/unit/interface/action_builder_spec.rb +7 -5
- data/spec/unit/module_spec.rb +228 -9
- data/spec/unit/module_tool/application_spec.rb +3 -3
- data/spec/unit/module_tool/uninstaller_spec.rb +107 -27
- data/spec/unit/module_tool_spec.rb +0 -33
- data/spec/unit/network/authconfig_spec.rb +22 -21
- data/spec/unit/network/http/webrick_spec.rb +13 -9
- data/spec/unit/node/environment_spec.rb +159 -66
- data/spec/unit/parser/collector_spec.rb +16 -8
- data/spec/unit/parser/functions/generate_spec.rb +60 -18
- data/spec/unit/parser/resource_spec.rb +44 -0
- data/spec/unit/provider/augeas/augeas_spec.rb +160 -179
- data/spec/unit/provider/confine/feature_spec.rb +3 -5
- data/spec/unit/provider/package/dpkg_spec.rb +4 -2
- data/spec/unit/provider/package/gem_spec.rb +59 -43
- data/spec/unit/provider/package/openbsd_spec.rb +114 -0
- data/spec/unit/provider/package/pacman_spec.rb +1 -1
- data/spec/unit/provider/package/pip_spec.rb +10 -4
- data/spec/unit/provider/package/zypper_spec.rb +56 -14
- data/spec/unit/provider/selmodule_spec.rb +3 -3
- data/spec/unit/provider/service/launchd_spec.rb +22 -21
- data/spec/unit/provider/service/{upstart.rb → upstart_spec.rb} +7 -3
- data/spec/unit/provider/user/pw_spec.rb +19 -0
- data/spec/unit/resource/catalog_spec.rb +3 -3
- data/spec/unit/semver_spec.rb +117 -24
- data/spec/unit/transaction/report_spec.rb +11 -1
- data/spec/unit/type/cron_spec.rb +200 -213
- data/spec/unit/type/exec_spec.rb +7 -0
- data/spec/unit/type/file/content_spec.rb +2 -2
- data/spec/unit/type/file_spec.rb +12 -9
- data/spec/unit/type/package_spec.rb +25 -0
- data/spec/unit/type/schedule_spec.rb +31 -31
- data/spec/unit/util/diff_spec.rb +30 -0
- data/spec/unit/util/execution_stub_spec.rb +1 -2
- data/spec/unit/util/log/destinations_spec.rb +51 -0
- data/spec/unit/util/log_spec.rb +17 -1
- data/spec/unit/util/monkey_patches_spec.rb +119 -0
- data/spec/unit/util/rdoc/parser_spec.rb +25 -1
- data/spec/unit/util/selinux_spec.rb +2 -2
- data/spec/unit/util/suidmanager_spec.rb +6 -51
- data/spec/unit/util_spec.rb +82 -24
- data/test/lib/puppettest/certificates.rb +16 -0
- data/test/lib/puppettest/servertest.rb +4 -0
- data/test/util/pidlock.rb +125 -0
- metadata +23 -14
- data/ext/puppetstoredconfigclean.rb +0 -103
- data/lib/puppet/agent/disabler.rb +0 -27
- data/lib/puppet/util/anonymous_filelock.rb +0 -36
- data/spec/unit/agent/disabler_spec.rb +0 -60
- data/spec/unit/module_tool/repository_spec.rb +0 -52
- data/spec/unit/util/anonymous_filelock_spec.rb +0 -78
- data/spec/unit/util/pidlock_spec.rb +0 -208
data/lib/puppet/type/cron.rb
CHANGED
@@ -87,7 +87,7 @@ Puppet::Type.newtype(:cron) do
|
|
87
87
|
# if we can lengthen it (e.g., mon => monday).
|
88
88
|
if tmp.length == 3
|
89
89
|
ary.each_with_index { |name, index|
|
90
|
-
if
|
90
|
+
if tmp.upcase == name[0..2].upcase
|
91
91
|
return index
|
92
92
|
end
|
93
93
|
}
|
@@ -352,7 +352,10 @@ Puppet::Type.newtype(:cron) do
|
|
352
352
|
|
353
353
|
The user defaults to whomever Puppet is running as."
|
354
354
|
|
355
|
-
defaultto {
|
355
|
+
defaultto {
|
356
|
+
struct = Etc.getpwuid(Process.uid)
|
357
|
+
struct.respond_to?(:name) && struct.name or 'root'
|
358
|
+
}
|
356
359
|
end
|
357
360
|
|
358
361
|
newproperty(:target) do
|
data/lib/puppet/type/exec.rb
CHANGED
@@ -369,6 +369,10 @@ module Puppet
|
|
369
369
|
return false
|
370
370
|
end
|
371
371
|
|
372
|
+
output.split(/\n/).each { |line|
|
373
|
+
self.debug(line)
|
374
|
+
}
|
375
|
+
|
372
376
|
status.exitstatus != 0
|
373
377
|
end
|
374
378
|
end
|
@@ -412,6 +416,10 @@ module Puppet
|
|
412
416
|
return false
|
413
417
|
end
|
414
418
|
|
419
|
+
output.split(/\n/).each { |line|
|
420
|
+
self.debug(line)
|
421
|
+
}
|
422
|
+
|
415
423
|
status.exitstatus == 0
|
416
424
|
end
|
417
425
|
end
|
data/lib/puppet/type/file.rb
CHANGED
@@ -17,16 +17,18 @@ Puppet::Type.newtype(:file) do
|
|
17
17
|
include Puppet::Util::Backups
|
18
18
|
include Puppet::Util::SymbolicFileMode
|
19
19
|
|
20
|
-
@doc = "Manages
|
21
|
-
permissions, creation of both files and directories, and
|
22
|
-
retrieving entire files from remote servers. As Puppet matures, it
|
23
|
-
expected that the `file` resource will be used less and less to
|
24
|
-
manage content, and instead native resources will be used to do so.
|
20
|
+
@doc = "Manages files, including their content, ownership, and permissions.
|
25
21
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
22
|
+
The `file` type can manage normal files, directories, and symlinks; the
|
23
|
+
type should be specified in the `ensure` attribute. Note that symlinks cannot
|
24
|
+
be managed on Windows systems.
|
25
|
+
|
26
|
+
File contents can be managed directly with the `content` attribute, or
|
27
|
+
downloaded from a remote source using the `source` attribute; the latter
|
28
|
+
can also be used to recursively serve directories (when the `recurse`
|
29
|
+
attribute is set to `true` or `local`). On Windows, note that file
|
30
|
+
contents are managed in binary mode; Puppet never automatically translates
|
31
|
+
line endings.
|
30
32
|
|
31
33
|
**Autorequires:** If Puppet is managing the user or group that owns a
|
32
34
|
file, the file resource will autorequire them. If Puppet is managing any
|
@@ -37,7 +39,12 @@ Puppet::Type.newtype(:file) do
|
|
37
39
|
end
|
38
40
|
|
39
41
|
newparam(:path) do
|
40
|
-
desc
|
42
|
+
desc <<-EOT
|
43
|
+
The path to the file to manage. Must be fully qualified.
|
44
|
+
|
45
|
+
On Windows, the path should include the drive letter and should use `/` as
|
46
|
+
the separator character (rather than `\\`).
|
47
|
+
EOT
|
41
48
|
isnamevar
|
42
49
|
|
43
50
|
validate do |value|
|
@@ -191,9 +198,11 @@ Puppet::Type.newtype(:file) do
|
|
191
198
|
end
|
192
199
|
|
193
200
|
newparam(:replace, :boolean => true) do
|
194
|
-
desc "Whether
|
195
|
-
|
196
|
-
|
201
|
+
desc "Whether to replace a file that already exists on the local system but
|
202
|
+
whose content doesn't match what the `source` or `content` attribute
|
203
|
+
specifies. Setting this to false allows file resources to initialize files
|
204
|
+
without overwriting future changes. Note that this only affects content;
|
205
|
+
Puppet will still manage ownership and permissions."
|
197
206
|
newvalues(:true, :false)
|
198
207
|
aliasvalue(:yes, :true)
|
199
208
|
aliasvalue(:no, :false)
|
@@ -251,11 +260,11 @@ Puppet::Type.newtype(:file) do
|
|
251
260
|
|
252
261
|
newparam(:sourceselect) do
|
253
262
|
desc "Whether to copy all valid sources, or just the first one. This parameter
|
254
|
-
|
255
|
-
only one used
|
256
|
-
|
257
|
-
|
258
|
-
be used."
|
263
|
+
only affects recursive directory copies; by default, the first valid
|
264
|
+
source is the only one used, but if this parameter is set to `all`, then
|
265
|
+
all valid sources will have all of their contents copied to the local
|
266
|
+
system. If a given file exists in more than one source, the version from
|
267
|
+
the earliest source in the list will be used."
|
259
268
|
|
260
269
|
defaultto :first
|
261
270
|
|
@@ -5,9 +5,9 @@ require 'puppet/util/checksums'
|
|
5
5
|
Puppet::Type.type(:file).newparam(:checksum) do
|
6
6
|
include Puppet::Util::Checksums
|
7
7
|
|
8
|
-
desc "The checksum type to use when
|
8
|
+
desc "The checksum type to use when determining whether to replace a file's contents.
|
9
9
|
|
10
|
-
The default checksum
|
10
|
+
The default checksum type is md5."
|
11
11
|
|
12
12
|
newvalues "md5", "md5lite", "mtime", "ctime", "none"
|
13
13
|
|
@@ -15,27 +15,32 @@ module Puppet
|
|
15
15
|
|
16
16
|
attr_reader :actual_content
|
17
17
|
|
18
|
-
desc
|
19
|
-
|
20
|
-
|
18
|
+
desc <<-EOT
|
19
|
+
The desired contents of a file, as a string. This attribute is mutually
|
20
|
+
exclusive with `source` and `target`.
|
21
21
|
|
22
|
-
|
22
|
+
Newlines and tabs can be specified in double-quoted strings using
|
23
|
+
standard escaped syntax --- \n for a newline, and \t for a tab.
|
24
|
+
|
25
|
+
With very small files, you can construct content strings directly in
|
26
|
+
the manifest...
|
23
27
|
|
24
28
|
define resolve(nameserver1, nameserver2, domain, search) {
|
25
|
-
$str =
|
29
|
+
$str = "search $search
|
26
30
|
domain $domain
|
27
31
|
nameserver $nameserver1
|
28
32
|
nameserver $nameserver2
|
29
|
-
|
33
|
+
"
|
30
34
|
|
31
|
-
file {
|
32
|
-
content => $str
|
35
|
+
file { "/etc/resolv.conf":
|
36
|
+
content => "$str",
|
33
37
|
}
|
34
38
|
}
|
35
39
|
|
36
40
|
...but for larger files, this attribute is more useful when combined with the
|
37
41
|
[template](http://docs.puppetlabs.com/references/latest/function.html#template)
|
38
|
-
function.
|
42
|
+
function.
|
43
|
+
EOT
|
39
44
|
|
40
45
|
# Store a checksum as the value, rather than the actual content.
|
41
46
|
# Simplifies everything.
|
@@ -10,11 +10,12 @@ module Puppet
|
|
10
10
|
Possible values are *absent*, *present*, *file*, and *directory*.
|
11
11
|
Specifying `present` will match any form of file existence, and
|
12
12
|
if the file is missing will create an empty file. Specifying
|
13
|
-
`absent` will delete the file (
|
13
|
+
`absent` will delete the file (or directory, if `recurse => true`).
|
14
14
|
|
15
|
-
Anything other than
|
16
|
-
|
17
|
-
|
15
|
+
Anything other than the above values will create a symlink; note that
|
16
|
+
symlinks cannot be managed on Windows. In the interest of readability
|
17
|
+
and clarity, symlinks should be created by setting `ensure => link` and
|
18
|
+
explicitly specifying a target; however, if a `target` attribute isn't
|
18
19
|
provided, the value of the `ensure` attribute will be used as the
|
19
20
|
symlink target. The following two declarations are equivalent:
|
20
21
|
|
@@ -3,8 +3,16 @@ require 'puppet/util/posix'
|
|
3
3
|
# Manage file group ownership.
|
4
4
|
module Puppet
|
5
5
|
Puppet::Type.type(:file).newproperty(:group) do
|
6
|
-
desc
|
7
|
-
|
6
|
+
desc <<-EOT
|
7
|
+
Which group should own the file. Argument can be either a group
|
8
|
+
name or a group ID.
|
9
|
+
|
10
|
+
On Windows, a user (such as "Administrator") can be set as a file's group
|
11
|
+
and a group (such as "Administrators") can be set as a file's owner;
|
12
|
+
however, a file's owner and group shouldn't be the same. (If the owner
|
13
|
+
is also the group, files with modes like `0640` will cause log churn, as
|
14
|
+
they will always appear out of sync.)
|
15
|
+
EOT
|
8
16
|
|
9
17
|
validate do |group|
|
10
18
|
raise(Puppet::Error, "Invalid group name '#{group.inspect}'") unless group and group != ""
|
@@ -6,24 +6,52 @@ module Puppet
|
|
6
6
|
require 'puppet/util/symbolic_file_mode'
|
7
7
|
include Puppet::Util::SymbolicFileMode
|
8
8
|
|
9
|
-
desc
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
9
|
+
desc <<-EOT
|
10
|
+
The desired permissions mode for the file, in symbolic or numeric
|
11
|
+
notation. Puppet uses traditional Unix permission schemes and translates
|
12
|
+
them to equivalent permissions for systems which represent permissions
|
13
|
+
differently, including Windows.
|
14
|
+
|
15
|
+
Numeric modes should use the standard four-digit octal notation of
|
16
|
+
`<setuid/setgid/sticky><owner><group><other>` (e.g. 0644). Each of the
|
17
|
+
"owner," "group," and "other" digits should be a sum of the
|
18
|
+
permissions for that class of users, where read = 4, write = 2, and
|
19
|
+
execute/search = 1. When setting numeric permissions for
|
20
|
+
directories, Puppet sets the search permission wherever the read
|
21
|
+
permission is set.
|
22
|
+
|
23
|
+
Symbolic modes should be represented as a string of comma-separated
|
24
|
+
permission clauses, in the form `<who><op><perm>`:
|
25
|
+
|
26
|
+
* "Who" should be u (user), g (group), o (other), and/or a (all)
|
27
|
+
* "Op" should be = (set exact permissions), + (add select permissions),
|
28
|
+
or - (remove select permissions)
|
29
|
+
* "Perm" should be one or more of:
|
30
|
+
* r (read)
|
31
|
+
* w (write)
|
32
|
+
* x (execute/search)
|
33
|
+
* t (sticky)
|
34
|
+
* s (setuid/setgid)
|
35
|
+
* X (execute/search if directory or if any one user can execute)
|
36
|
+
* u (user's current permissions)
|
37
|
+
* g (group's current permissions)
|
38
|
+
* o (other's current permissions)
|
39
|
+
|
40
|
+
Thus, mode `0664` could be represented symbolically as either `a=r,ug+w` or
|
41
|
+
`ug=rw,o=r`. See the manual page for GNU or BSD `chmod` for more details
|
42
|
+
on numeric and symbolic modes.
|
43
|
+
|
44
|
+
On Windows, permissions are translated as follows:
|
45
|
+
|
46
|
+
* Owner and group names are mapped to Windows SIDs
|
47
|
+
* The "other" class of users maps to the "Everyone" SID
|
48
|
+
* The read/write/execute permissions map to the `FILE_GENERIC_READ`,
|
49
|
+
`FILE_GENERIC_WRITE`, and `FILE_GENERIC_EXECUTE` access rights; a
|
50
|
+
file's owner always has the `FULL_CONTROL` right
|
51
|
+
* "Other" users can't have any permissions a file's group lacks,
|
52
|
+
and its group can't have any permissions its owner lacks; that is, 0644
|
53
|
+
is an acceptable mode, but 0464 is not.
|
54
|
+
EOT
|
27
55
|
|
28
56
|
validate do |value|
|
29
57
|
unless value.nil? or valid_symbolic_mode?(value)
|
@@ -2,8 +2,16 @@ module Puppet
|
|
2
2
|
Puppet::Type.type(:file).newproperty(:owner) do
|
3
3
|
include Puppet::Util::Warnings
|
4
4
|
|
5
|
-
desc
|
6
|
-
user
|
5
|
+
desc <<-EOT
|
6
|
+
The user to whom the file should belong. Argument can be a user name or a
|
7
|
+
user ID.
|
8
|
+
|
9
|
+
On Windows, a group (such as "Administrators") can be set as a file's owner
|
10
|
+
and a user (such as "Administrator") can be set as a file's group; however,
|
11
|
+
a file's owner and group shouldn't be the same. (If the owner is also
|
12
|
+
the group, files with modes like `0640` will cause log churn, as they
|
13
|
+
will always appear out of sync.)
|
14
|
+
EOT
|
7
15
|
|
8
16
|
def insync?(current)
|
9
17
|
# We don't want to validate/munge users until we actually start to
|
@@ -13,55 +13,42 @@ module Puppet
|
|
13
13
|
|
14
14
|
attr_accessor :source, :local
|
15
15
|
desc <<-EOT
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
class sendmail {
|
27
|
-
file { "/etc/mail/sendmail.cf":
|
28
|
-
source => "puppet://server/modules/module_name/sendmail.cf"
|
29
|
-
}
|
30
|
-
}
|
16
|
+
A source file, which will be copied into place on the local system.
|
17
|
+
Values can be URIs pointing to remote files, or fully qualified paths to
|
18
|
+
files available on the local system (including files on NFS shares or
|
19
|
+
Windows mapped drives). This attribute is mutually exclusive with
|
20
|
+
`content` and `target`.
|
21
|
+
|
22
|
+
The available URI schemes are *puppet* and *file*. *Puppet*
|
23
|
+
URIs will retrieve files from Puppet's built-in file server, and are
|
24
|
+
usually formatted as:
|
31
25
|
|
32
|
-
|
33
|
-
will fill in the name of its configuration server and `puppet apply`
|
34
|
-
will use the local filesystem. This makes it easy to use the same
|
35
|
-
configuration in both local and centralized forms.
|
26
|
+
`puppet:///modules/name_of_module/filename`
|
36
27
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
interpreter (`puppet apply`) and the client demon (`puppet agent`) differs
|
42
|
-
slightly: `apply` will look such a file up on the module path
|
43
|
-
on the local host, whereas `agent` will connect to the
|
44
|
-
puppet server that it received the manifest from.
|
28
|
+
This will fetch a file from a module on the puppet master (or from a
|
29
|
+
local module when using puppet apply). Given a `modulepath` of
|
30
|
+
`/etc/puppetlabs/puppet/modules`, the example above would resolve to
|
31
|
+
`/etc/puppetlabs/puppet/modules/name_of_module/files/filename`.
|
45
32
|
|
46
|
-
|
47
|
-
|
33
|
+
Unlike `content`, the `source` attribute can be used to recursively copy
|
34
|
+
directories if the `recurse` attribute is set to `true` or `remote`. If
|
35
|
+
a source directory contains symlinks, use the `links` attribute to
|
36
|
+
specify whether to recreate links or follow them.
|
48
37
|
|
49
|
-
|
50
|
-
source that exists
|
51
|
-
|
38
|
+
Multiple `source` values can be specified as an array, and Puppet will
|
39
|
+
use the first source that exists. This can be used to serve different
|
40
|
+
files to different system types:
|
52
41
|
|
53
|
-
file { "/
|
42
|
+
file { "/etc/nfs.conf":
|
54
43
|
source => [
|
55
|
-
"
|
56
|
-
"
|
57
|
-
"
|
44
|
+
"puppet:///modules/nfs/conf.$host",
|
45
|
+
"puppet:///modules/nfs/conf.$operatingsystem",
|
46
|
+
"puppet:///modules/nfs/conf"
|
58
47
|
]
|
59
48
|
}
|
60
49
|
|
61
|
-
|
62
|
-
|
63
|
-
You cannot currently copy links using this mechanism; set `links`
|
64
|
-
to `follow` if any remote sources are links.
|
50
|
+
Alternately, when serving directories recursively, multiple sources can
|
51
|
+
be combined by setting the `sourceselect` attribute to `all`.
|
65
52
|
EOT
|
66
53
|
|
67
54
|
validate do |sources|
|
@@ -1,9 +1,10 @@
|
|
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. This attribute is mutually exclusive with `source`
|
5
|
+
and `content`.
|
5
6
|
|
6
|
-
|
7
|
+
Symlink targets can be relative, as well as absolute:
|
7
8
|
|
8
9
|
# (Useful on Solaris)
|
9
10
|
file { \"/etc/inetd.conf\":
|
@@ -11,10 +12,9 @@ module Puppet
|
|
11
12
|
target => \"inet/inetd.conf\",
|
12
13
|
}
|
13
14
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
and links corresponding to each file."
|
15
|
+
Directories of symlinks can be served recursively by instead using the
|
16
|
+
`source` attribute, setting `ensure` to `directory`, and setting the
|
17
|
+
`links` attribute to `manage`."
|
18
18
|
|
19
19
|
newvalue(:notlink) do
|
20
20
|
# We do nothing if the value is absent
|
data/lib/puppet/type/group.rb
CHANGED
@@ -34,12 +34,13 @@ module Puppet
|
|
34
34
|
end
|
35
35
|
|
36
36
|
newproperty(:gid) do
|
37
|
-
desc "The group ID. Must be specified numerically. If
|
38
|
-
specified
|
39
|
-
|
40
|
-
|
37
|
+
desc "The group ID. Must be specified numerically. If no group ID is
|
38
|
+
specified when creating a new group, then one will be chosen
|
39
|
+
automatically according to local system standards. This will likely
|
40
|
+
result in the same group having different GIDs on different systems,
|
41
|
+
which is not recommended.
|
41
42
|
|
42
|
-
On Windows,
|
43
|
+
On Windows, this property is read-only and will return the group's security
|
43
44
|
identifier (SID)."
|
44
45
|
|
45
46
|
def retrieve
|
@@ -91,13 +92,16 @@ module Puppet
|
|
91
92
|
newparam(:name) do
|
92
93
|
desc "The group name. While naming limitations vary by operating system,
|
93
94
|
it is advisable to restrict names to the lowest common denominator,
|
94
|
-
which is a maximum of 8 characters beginning with a letter.
|
95
|
+
which is a maximum of 8 characters beginning with a letter.
|
96
|
+
|
97
|
+
Note that Puppet considers group names to be case-sensitive, regardless
|
98
|
+
of the platform's own rules; be sure to always use the same case when
|
99
|
+
referring to a given group."
|
95
100
|
isnamevar
|
96
101
|
end
|
97
102
|
|
98
103
|
newparam(:allowdupe, :boolean => true) do
|
99
|
-
desc "Whether to allow duplicate GIDs.
|
100
|
-
FreeBSD (contract to the `pw` man page)."
|
104
|
+
desc "Whether to allow duplicate GIDs. Defaults to `false`."
|
101
105
|
|
102
106
|
newvalues(:true, :false)
|
103
107
|
|
@@ -120,7 +124,7 @@ module Puppet
|
|
120
124
|
end
|
121
125
|
|
122
126
|
validate do |value|
|
123
|
-
raise ArgumentError, "Attributes value pairs must be
|
127
|
+
raise ArgumentError, "Attributes value pairs must be separated by an =" unless value.include?("=")
|
124
128
|
end
|
125
129
|
end
|
126
130
|
|