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.

Files changed (220) hide show
  1. data/CHANGELOG +188 -0
  2. data/conf/osx/createpackage.sh +1 -0
  3. data/conf/redhat/puppet.spec +12 -9
  4. data/conf/suse/puppet.spec +4 -1
  5. data/install.rb +9 -22
  6. data/lib/puppet.rb +1 -31
  7. data/lib/puppet/agent.rb +3 -5
  8. data/lib/puppet/agent/locker.rb +15 -1
  9. data/lib/puppet/application.rb +7 -4
  10. data/lib/puppet/application/agent.rb +4 -25
  11. data/lib/puppet/application/apply.rb +3 -3
  12. data/lib/puppet/application/device.rb +2 -16
  13. data/lib/puppet/application/doc.rb +2 -2
  14. data/lib/puppet/application/face_base.rb +22 -5
  15. data/lib/puppet/application/filebucket.rb +2 -0
  16. data/lib/puppet/application/inspect.rb +2 -1
  17. data/lib/puppet/application/kick.rb +25 -9
  18. data/lib/puppet/application/queue.rb +0 -23
  19. data/lib/puppet/configurer.rb +1 -0
  20. data/lib/puppet/configurer/downloader.rb +7 -3
  21. data/lib/puppet/defaults.rb +34 -29
  22. data/lib/puppet/face/ca.rb +1 -1
  23. data/lib/puppet/face/catalog.rb +1 -0
  24. data/lib/puppet/face/file/store.rb +1 -1
  25. data/lib/puppet/face/module/list.rb +23 -3
  26. data/lib/puppet/face/module/search.rb +21 -32
  27. data/lib/puppet/face/module/uninstall.rb +56 -15
  28. data/lib/puppet/file_bucket/dipper.rb +2 -2
  29. data/lib/puppet/file_serving/base.rb +6 -5
  30. data/lib/puppet/file_serving/configuration/parser.rb +1 -1
  31. data/lib/puppet/file_serving/content.rb +1 -1
  32. data/lib/puppet/forge.rb +153 -0
  33. data/lib/puppet/{module_tool → forge}/cache.rb +1 -2
  34. data/lib/puppet/{module_tool → forge}/repository.rb +46 -4
  35. data/lib/puppet/indirector/exec.rb +1 -1
  36. data/lib/puppet/indirector/file_bucket_file/file.rb +3 -3
  37. data/lib/puppet/interface/action.rb +6 -2
  38. data/lib/puppet/module.rb +70 -10
  39. data/lib/puppet/module_tool.rb +2 -38
  40. data/lib/puppet/module_tool/applications.rb +15 -11
  41. data/lib/puppet/module_tool/applications/application.rb +2 -5
  42. data/lib/puppet/module_tool/applications/cleaner.rb +1 -1
  43. data/lib/puppet/module_tool/applications/installer.rb +10 -45
  44. data/lib/puppet/module_tool/applications/searcher.rb +2 -26
  45. data/lib/puppet/module_tool/applications/uninstaller.rb +39 -13
  46. data/lib/puppet/module_tool/applications/unpacker.rb +1 -1
  47. data/lib/puppet/module_tool/dependency.rb +1 -1
  48. data/lib/puppet/network/authconfig.rb +1 -1
  49. data/lib/puppet/network/handler/fileserver.rb +1 -1
  50. data/lib/puppet/network/http/handler.rb +4 -1
  51. data/lib/puppet/network/http/webrick.rb +4 -2
  52. data/lib/puppet/node/environment.rb +32 -6
  53. data/lib/puppet/parameter/path.rb +0 -4
  54. data/lib/puppet/parser/ast/relationship.rb +3 -16
  55. data/lib/puppet/parser/collector.rb +5 -3
  56. data/lib/puppet/parser/compiler.rb +2 -1
  57. data/lib/puppet/parser/functions/file.rb +1 -1
  58. data/lib/puppet/parser/functions/generate.rb +8 -2
  59. data/lib/puppet/parser/grammar.ra +16 -15
  60. data/lib/puppet/parser/parser.rb +959 -881
  61. data/lib/puppet/parser/relationship.rb +32 -15
  62. data/lib/puppet/parser/resource.rb +0 -1
  63. data/lib/puppet/parser/type_loader.rb +1 -2
  64. data/lib/puppet/provider/augeas/augeas.rb +17 -29
  65. data/lib/puppet/provider/exec/windows.rb +25 -3
  66. data/lib/puppet/provider/file/posix.rb +1 -1
  67. data/lib/puppet/provider/file/windows.rb +1 -1
  68. data/lib/puppet/provider/group/windows_adsi.rb +1 -1
  69. data/lib/puppet/provider/package/aix.rb +1 -1
  70. data/lib/puppet/provider/package/appdmg.rb +1 -1
  71. data/lib/puppet/provider/package/dpkg.rb +1 -1
  72. data/lib/puppet/provider/package/gem.rb +21 -23
  73. data/lib/puppet/provider/package/macports.rb +1 -1
  74. data/lib/puppet/provider/package/msi.rb +7 -1
  75. data/lib/puppet/provider/package/openbsd.rb +13 -16
  76. data/lib/puppet/provider/package/pacman.rb +1 -1
  77. data/lib/puppet/provider/package/pip.rb +3 -0
  78. data/lib/puppet/provider/package/pkg.rb +1 -1
  79. data/lib/puppet/provider/package/pkgdmg.rb +1 -1
  80. data/lib/puppet/provider/package/pkgutil.rb +1 -1
  81. data/lib/puppet/provider/package/portage.rb +2 -2
  82. data/lib/puppet/provider/package/rpm.rb +1 -1
  83. data/lib/puppet/provider/package/sun.rb +1 -1
  84. data/lib/puppet/provider/package/zypper.rb +35 -3
  85. data/lib/puppet/provider/scheduled_task/win32_taskscheduler.rb +6 -2
  86. data/lib/puppet/provider/selmodule/semodule.rb +2 -2
  87. data/lib/puppet/provider/service/base.rb +1 -1
  88. data/lib/puppet/provider/service/launchd.rb +4 -0
  89. data/lib/puppet/provider/service/src.rb +2 -2
  90. data/lib/puppet/provider/service/upstart.rb +1 -1
  91. data/lib/puppet/provider/service/windows.rb +5 -4
  92. data/lib/puppet/provider/user/aix.rb +3 -3
  93. data/lib/puppet/provider/user/pw.rb +6 -0
  94. data/lib/puppet/provider/user/windows_adsi.rb +1 -1
  95. data/lib/puppet/resource/catalog.rb +6 -6
  96. data/lib/puppet/resource/type.rb +2 -0
  97. data/lib/puppet/ssl/certificate_request.rb +0 -70
  98. data/lib/puppet/transaction.rb +1 -1
  99. data/lib/puppet/transaction/report.rb +3 -2
  100. data/lib/puppet/type.rb +1 -1
  101. data/lib/puppet/type/cron.rb +5 -2
  102. data/lib/puppet/type/exec.rb +8 -0
  103. data/lib/puppet/type/file.rb +27 -18
  104. data/lib/puppet/type/file/checksum.rb +2 -2
  105. data/lib/puppet/type/file/content.rb +14 -9
  106. data/lib/puppet/type/file/ensure.rb +5 -4
  107. data/lib/puppet/type/file/group.rb +10 -2
  108. data/lib/puppet/type/file/mode.rb +46 -18
  109. data/lib/puppet/type/file/owner.rb +10 -2
  110. data/lib/puppet/type/file/source.rb +27 -40
  111. data/lib/puppet/type/file/target.rb +6 -6
  112. data/lib/puppet/type/group.rb +13 -9
  113. data/lib/puppet/type/k5login.rb +1 -1
  114. data/lib/puppet/type/package.rb +24 -8
  115. data/lib/puppet/type/scheduled_task.rb +77 -131
  116. data/lib/puppet/type/service.rb +22 -8
  117. data/lib/puppet/type/user.rb +29 -9
  118. data/lib/puppet/util.rb +24 -33
  119. data/lib/puppet/util/colors.rb +98 -0
  120. data/lib/puppet/util/diff.rb +3 -1
  121. data/lib/puppet/util/log.rb +5 -1
  122. data/lib/puppet/util/log/destinations.rb +37 -44
  123. data/lib/puppet/util/monkey_patches.rb +32 -0
  124. data/lib/puppet/util/pidlock.rb +70 -21
  125. data/lib/puppet/util/rdoc/parser.rb +4 -2
  126. data/lib/puppet/util/selinux.rb +1 -1
  127. data/lib/puppet/util/suidmanager.rb +2 -12
  128. data/lib/puppet/util/windows.rb +2 -0
  129. data/lib/puppet/util/windows/process.rb +33 -0
  130. data/lib/puppet/util/windows/security.rb +6 -4
  131. data/lib/puppet/util/windows/user.rb +44 -0
  132. data/lib/semver.rb +55 -4
  133. data/spec/fixtures/unit/provider/package/openbsd/pkginfo.detail +19 -0
  134. data/spec/fixtures/unit/provider/package/openbsd/pkginfo.list +10 -0
  135. data/spec/fixtures/unit/provider/package/openbsd/pkginfo.query +1 -0
  136. data/spec/fixtures/unit/provider/package/zypper/zypper-list-updates-SLES11sp1.out +369 -0
  137. data/spec/integration/defaults_spec.rb +10 -0
  138. data/spec/integration/indirector/direct_file_server_spec.rb +1 -1
  139. data/spec/integration/module_tool_spec.rb +10 -12
  140. data/spec/integration/parser/compiler_spec.rb +147 -0
  141. data/spec/integration/type/file_spec.rb +1 -1
  142. data/spec/integration/util/windows/user_spec.rb +59 -0
  143. data/spec/lib/puppet/face/basetest.rb +5 -0
  144. data/spec/lib/puppet_spec/modules.rb +26 -0
  145. data/spec/spec_helper.rb +25 -0
  146. data/spec/unit/agent/locker_spec.rb +12 -0
  147. data/spec/unit/agent_backward_compatibility_spec.rb +152 -0
  148. data/spec/unit/agent_spec.rb +28 -8
  149. data/spec/unit/application/agent_spec.rb +4 -36
  150. data/spec/unit/application/device_spec.rb +55 -10
  151. data/spec/unit/application/face_base_spec.rb +32 -10
  152. data/spec/unit/application/filebucket_spec.rb +5 -0
  153. data/spec/unit/application/kick_spec.rb +6 -0
  154. data/spec/unit/application_spec.rb +8 -1
  155. data/spec/unit/configurer/downloader_spec.rb +4 -5
  156. data/spec/unit/face/ca_spec.rb +15 -4
  157. data/spec/unit/file_bucket/dipper_spec.rb +1 -1
  158. data/spec/unit/file_serving/base_spec.rb +60 -42
  159. data/spec/unit/file_serving/configuration/parser_spec.rb +5 -3
  160. data/spec/unit/file_serving/content_spec.rb +26 -27
  161. data/spec/unit/file_serving/metadata_spec.rb +22 -21
  162. data/spec/unit/forge/repository_spec.rb +86 -0
  163. data/spec/unit/forge_spec.rb +114 -0
  164. data/spec/unit/indirector/exec_spec.rb +8 -6
  165. data/spec/unit/indirector/facts/inventory_active_record_spec.rb +0 -1
  166. data/spec/unit/indirector/file_bucket_file/file_spec.rb +1 -1
  167. data/spec/unit/indirector/node/exec_spec.rb +1 -1
  168. data/spec/unit/indirector/resource/active_record_spec.rb +0 -4
  169. data/spec/unit/interface/action_builder_spec.rb +7 -5
  170. data/spec/unit/module_spec.rb +228 -9
  171. data/spec/unit/module_tool/application_spec.rb +3 -3
  172. data/spec/unit/module_tool/uninstaller_spec.rb +107 -27
  173. data/spec/unit/module_tool_spec.rb +0 -33
  174. data/spec/unit/network/authconfig_spec.rb +22 -21
  175. data/spec/unit/network/http/webrick_spec.rb +13 -9
  176. data/spec/unit/node/environment_spec.rb +159 -66
  177. data/spec/unit/parser/collector_spec.rb +16 -8
  178. data/spec/unit/parser/functions/generate_spec.rb +60 -18
  179. data/spec/unit/parser/resource_spec.rb +44 -0
  180. data/spec/unit/provider/augeas/augeas_spec.rb +160 -179
  181. data/spec/unit/provider/confine/feature_spec.rb +3 -5
  182. data/spec/unit/provider/package/dpkg_spec.rb +4 -2
  183. data/spec/unit/provider/package/gem_spec.rb +59 -43
  184. data/spec/unit/provider/package/openbsd_spec.rb +114 -0
  185. data/spec/unit/provider/package/pacman_spec.rb +1 -1
  186. data/spec/unit/provider/package/pip_spec.rb +10 -4
  187. data/spec/unit/provider/package/zypper_spec.rb +56 -14
  188. data/spec/unit/provider/selmodule_spec.rb +3 -3
  189. data/spec/unit/provider/service/launchd_spec.rb +22 -21
  190. data/spec/unit/provider/service/{upstart.rb → upstart_spec.rb} +7 -3
  191. data/spec/unit/provider/user/pw_spec.rb +19 -0
  192. data/spec/unit/resource/catalog_spec.rb +3 -3
  193. data/spec/unit/semver_spec.rb +117 -24
  194. data/spec/unit/transaction/report_spec.rb +11 -1
  195. data/spec/unit/type/cron_spec.rb +200 -213
  196. data/spec/unit/type/exec_spec.rb +7 -0
  197. data/spec/unit/type/file/content_spec.rb +2 -2
  198. data/spec/unit/type/file_spec.rb +12 -9
  199. data/spec/unit/type/package_spec.rb +25 -0
  200. data/spec/unit/type/schedule_spec.rb +31 -31
  201. data/spec/unit/util/diff_spec.rb +30 -0
  202. data/spec/unit/util/execution_stub_spec.rb +1 -2
  203. data/spec/unit/util/log/destinations_spec.rb +51 -0
  204. data/spec/unit/util/log_spec.rb +17 -1
  205. data/spec/unit/util/monkey_patches_spec.rb +119 -0
  206. data/spec/unit/util/rdoc/parser_spec.rb +25 -1
  207. data/spec/unit/util/selinux_spec.rb +2 -2
  208. data/spec/unit/util/suidmanager_spec.rb +6 -51
  209. data/spec/unit/util_spec.rb +82 -24
  210. data/test/lib/puppettest/certificates.rb +16 -0
  211. data/test/lib/puppettest/servertest.rb +4 -0
  212. data/test/util/pidlock.rb +125 -0
  213. metadata +23 -14
  214. data/ext/puppetstoredconfigclean.rb +0 -103
  215. data/lib/puppet/agent/disabler.rb +0 -27
  216. data/lib/puppet/util/anonymous_filelock.rb +0 -36
  217. data/spec/unit/agent/disabler_spec.rb +0 -60
  218. data/spec/unit/module_tool/repository_spec.rb +0 -52
  219. data/spec/unit/util/anonymous_filelock_spec.rb +0 -78
  220. data/spec/unit/util/pidlock_spec.rb +0 -208
@@ -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 name =~ /#{tmp}/i
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 { Etc.getpwuid(Process.uid).name || "root" }
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
@@ -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
@@ -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 local files, including setting ownership and
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
- If you find that you are often copying files in from a central
27
- location, rather than using native resources, please contact
28
- Puppet Labs and we can hopefully work with you to develop a
29
- native resource to support what you are doing.
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 "The path to the file to manage. Must be fully qualified."
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 or not to replace a file that is
195
- sourced but exists. This is useful for using file sources
196
- purely for initialization."
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
- is only used in recursive copies; by default, the first valid source is the
255
- only one used as a recursive source, but if this parameter is set to `all`,
256
- then all valid sources will have all of their contents copied to the local host,
257
- and for sources that have the same file, the source earlier in the list will
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 checksumming a file.
8
+ desc "The checksum type to use when determining whether to replace a file's contents.
9
9
 
10
- The default checksum parameter, if checksums are enabled, is md5."
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 "Specify the contents of a file as a string. Newlines, tabs, and
19
- spaces can be specified using standard escaped syntax in
20
- double-quoted strings (e.g., \\n for a newline).
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
- With very small files, you can construct strings directly...
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 = \"search $search
29
+ $str = "search $search
26
30
  domain $domain
27
31
  nameserver $nameserver1
28
32
  nameserver $nameserver2
29
- \"
33
+ "
30
34
 
31
- file { \"/etc/resolv.conf\":
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 (and directory if `recurse => true`).
13
+ `absent` will delete the file (or directory, if `recurse => true`).
14
14
 
15
- Anything other than those values will create a symlink. In the interest
16
- of readability and clarity, you should use `ensure => link` and
17
- explicitly specify a target; however, if a `target` attribute isn't
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 "Which group should own the file. Argument can be either group
7
- name or group ID."
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 "Mode the file should be. Currently relatively limited:
10
- you must specify the exact mode the file should be.
11
-
12
- Note that when you set the mode of a directory, Puppet always
13
- sets the search/traverse (1) bit anywhere the read (4) bit is set.
14
- This is almost always what you want: read allows you to list the
15
- entries in a directory, and search/traverse allows you to access
16
- (read/write/execute) those entries.) Because of this feature, you
17
- can recursively make a directory and all of the files in it
18
- world-readable by setting e.g.:
19
-
20
- file { '/some/dir':
21
- mode => 644,
22
- recurse => true,
23
- }
24
-
25
- In this case all of the files underneath `/some/dir` will have
26
- mode 644, and all of the directories will have mode 755."
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 "To whom the file should belong. Argument can be user name or
6
- user ID."
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
- Copy a file over the current file. Uses `checksum` to
17
- determine when a file should be copied. Valid values are either
18
- fully qualified paths to files, or URIs. Currently supported URI
19
- types are *puppet* and *file*.
20
-
21
- This is one of the primary mechanisms for getting content into
22
- applications that Puppet does not directly support and is very
23
- useful for those configuration files that don't change much across
24
- sytems. For instance:
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
- You can also leave out the server name, in which case `puppet agent`
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
- Currently, only the `puppet` scheme is supported for source
38
- URL's. Puppet will connect to the file server running on
39
- `server` to retrieve the contents of the file. If the
40
- `server` part is empty, the behavior of the command-line
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
- See the [fileserver configuration documentation](http://docs.puppetlabs.com/guides/file_serving.html)
47
- for information on how to configure and use file services within Puppet.
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
- If you specify multiple file sources for a file, then the first
50
- source that exists will be used. This allows you to specify
51
- what amount to search paths for files:
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 { "/path/to/my/file":
42
+ file { "/etc/nfs.conf":
54
43
  source => [
55
- "/modules/nfs/files/file.$host",
56
- "/modules/nfs/files/file.$operatingsystem",
57
- "/modules/nfs/files/file"
44
+ "puppet:///modules/nfs/conf.$host",
45
+ "puppet:///modules/nfs/conf.$operatingsystem",
46
+ "puppet:///modules/nfs/conf"
58
47
  ]
59
48
  }
60
49
 
61
- This will use the first found file as the source.
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
- You can make relative links:
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
- 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."
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
@@ -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 not
38
- specified, a number will be picked, which can result in ID
39
- differences across systems and thus is not recommended. The
40
- GID is picked according to local system standards.
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, the property will return the group's security
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. This option does not work on
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 seperated by an =" unless value.include?("=")
127
+ raise ArgumentError, "Attributes value pairs must be separated by an =" unless value.include?("=")
124
128
  end
125
129
  end
126
130