puppet 2.7.6 → 2.7.8

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 (206) hide show
  1. data/CHANGELOG +168 -0
  2. data/conf/auth.conf +5 -4
  3. data/conf/redhat/puppet.spec +16 -1
  4. data/conf/solaris/pkginfo +2 -2
  5. data/conf/suse/puppet.spec +9 -3
  6. data/ext/upload_facts.rb +120 -0
  7. data/install.rb +11 -16
  8. data/lib/puppet.rb +1 -1
  9. data/lib/puppet/application/agent.rb +0 -3
  10. data/lib/puppet/application/apply.rb +0 -3
  11. data/lib/puppet/application/queue.rb +21 -1
  12. data/lib/puppet/defaults.rb +6 -4
  13. data/lib/puppet/face/file/store.rb +1 -1
  14. data/lib/puppet/feature/base.rb +2 -1
  15. data/lib/puppet/file_bucket/dipper.rb +3 -2
  16. data/lib/puppet/file_serving/content.rb +1 -1
  17. data/lib/puppet/file_serving/metadata.rb +5 -2
  18. data/lib/puppet/indirector/facts/inventory_service.rb +20 -0
  19. data/lib/puppet/indirector/file_bucket_file/file.rb +3 -2
  20. data/lib/puppet/indirector/report/processor.rb +1 -1
  21. data/lib/puppet/network/handler/filebucket.rb +2 -0
  22. data/lib/puppet/network/handler/fileserver.rb +1 -1
  23. data/lib/puppet/network/handler/master.rb +1 -0
  24. data/lib/puppet/network/handler/report.rb +2 -0
  25. data/lib/puppet/network/handler/runner.rb +1 -0
  26. data/lib/puppet/network/handler/status.rb +2 -0
  27. data/lib/puppet/network/http/mongrel/rest.rb +8 -1
  28. data/lib/puppet/network/http_server.rb +3 -0
  29. data/lib/puppet/network/http_server/mongrel.rb +129 -0
  30. data/lib/puppet/network/rest_authconfig.rb +12 -4
  31. data/lib/puppet/parameter.rb +18 -0
  32. data/lib/puppet/parser/compiler.rb +1 -1
  33. data/lib/puppet/parser/grammar.ra +1 -1
  34. data/lib/puppet/parser/parser.rb +360 -350
  35. data/lib/puppet/property.rb +3 -3
  36. data/lib/puppet/provider/augeas/augeas.rb +1 -1
  37. data/lib/puppet/provider/exec/windows.rb +6 -7
  38. data/lib/puppet/provider/file/windows.rb +9 -2
  39. data/lib/puppet/provider/group/aix.rb +8 -8
  40. data/lib/puppet/provider/group/groupadd.rb +1 -3
  41. data/lib/puppet/provider/group/ldap.rb +8 -10
  42. data/lib/puppet/provider/group/windows_adsi.rb +8 -2
  43. data/lib/puppet/provider/package/aix.rb +1 -1
  44. data/lib/puppet/provider/package/macports.rb +3 -3
  45. data/lib/puppet/provider/package/msi.rb +12 -5
  46. data/lib/puppet/provider/package/nim.rb +1 -1
  47. data/lib/puppet/provider/package/pkgdmg.rb +3 -3
  48. data/lib/puppet/provider/package/ports.rb +1 -1
  49. data/lib/puppet/provider/scheduled_task/win32_taskscheduler.rb +560 -0
  50. data/lib/puppet/provider/service/base.rb +2 -2
  51. data/lib/puppet/provider/service/bsd.rb +4 -3
  52. data/lib/puppet/provider/service/daemontools.rb +25 -25
  53. data/lib/puppet/provider/service/debian.rb +6 -4
  54. data/lib/puppet/provider/service/freebsd.rb +1 -1
  55. data/lib/puppet/provider/service/gentoo.rb +4 -3
  56. data/lib/puppet/provider/service/init.rb +3 -8
  57. data/lib/puppet/provider/service/launchd.rb +129 -96
  58. data/lib/puppet/provider/service/redhat.rb +2 -3
  59. data/lib/puppet/provider/service/runit.rb +20 -20
  60. data/lib/puppet/provider/service/smf.rb +8 -7
  61. data/lib/puppet/provider/service/src.rb +5 -6
  62. data/lib/puppet/provider/service/systemd.rb +1 -1
  63. data/lib/puppet/provider/service/upstart.rb +3 -5
  64. data/lib/puppet/provider/service/windows.rb +7 -7
  65. data/lib/puppet/provider/sshkey/parsed.rb +2 -3
  66. data/lib/puppet/provider/user/aix.rb +21 -21
  67. data/lib/puppet/provider/user/hpux.rb +3 -1
  68. data/lib/puppet/provider/user/ldap.rb +7 -7
  69. data/lib/puppet/provider/user/user_role_add.rb +10 -6
  70. data/lib/puppet/provider/user/useradd.rb +3 -1
  71. data/lib/puppet/provider/user/windows_adsi.rb +4 -3
  72. data/lib/puppet/rb_tree_map.rb +388 -0
  73. data/lib/puppet/reference/configuration.rb +7 -7
  74. data/lib/puppet/reference/indirection.rb +5 -6
  75. data/lib/puppet/reference/metaparameter.rb +3 -1
  76. data/lib/puppet/reference/network.rb +8 -8
  77. data/lib/puppet/reference/providers.rb +17 -21
  78. data/lib/puppet/reference/type.rb +12 -9
  79. data/lib/puppet/resource.rb +2 -5
  80. data/lib/puppet/resource/catalog.rb +1 -1
  81. data/lib/puppet/ssl/certificate_request.rb +70 -0
  82. data/lib/puppet/ssl/host.rb +6 -0
  83. data/lib/puppet/transaction.rb +158 -55
  84. data/lib/puppet/transaction/event_manager.rb +1 -1
  85. data/lib/puppet/type.rb +60 -30
  86. data/lib/puppet/type/augeas.rb +83 -49
  87. data/lib/puppet/type/computer.rb +1 -1
  88. data/lib/puppet/type/cron.rb +11 -11
  89. data/lib/puppet/type/exec.rb +28 -21
  90. data/lib/puppet/type/file.rb +17 -7
  91. data/lib/puppet/type/file/content.rb +2 -2
  92. data/lib/puppet/type/file/ensure.rb +15 -12
  93. data/lib/puppet/type/file/mode.rb +30 -5
  94. data/lib/puppet/type/file/source.rb +11 -10
  95. data/lib/puppet/type/file/target.rb +2 -2
  96. data/lib/puppet/type/filebucket.rb +1 -1
  97. data/lib/puppet/type/group.rb +4 -5
  98. data/lib/puppet/type/host.rb +1 -1
  99. data/lib/puppet/type/interface.rb +13 -10
  100. data/lib/puppet/type/k5login.rb +6 -6
  101. data/lib/puppet/type/macauthorization.rb +37 -36
  102. data/lib/puppet/type/maillist.rb +2 -2
  103. data/lib/puppet/type/mcx.rb +6 -6
  104. data/lib/puppet/type/mount.rb +3 -2
  105. data/lib/puppet/type/notify.rb +1 -1
  106. data/lib/puppet/type/package.rb +24 -23
  107. data/lib/puppet/type/router.rb +4 -1
  108. data/lib/puppet/type/schedule.rb +52 -44
  109. data/lib/puppet/type/scheduled_task.rb +222 -0
  110. data/lib/puppet/type/selmodule.rb +10 -6
  111. data/lib/puppet/type/service.rb +11 -11
  112. data/lib/puppet/type/ssh_authorized_key.rb +2 -5
  113. data/lib/puppet/type/sshkey.rb +1 -1
  114. data/lib/puppet/type/stage.rb +1 -1
  115. data/lib/puppet/type/tidy.rb +10 -8
  116. data/lib/puppet/type/user.rb +61 -53
  117. data/lib/puppet/type/vlan.rb +4 -4
  118. data/lib/puppet/type/whit.rb +6 -2
  119. data/lib/puppet/type/yumrepo.rb +33 -31
  120. data/lib/puppet/type/zfs.rb +34 -32
  121. data/lib/puppet/type/zone.rb +21 -19
  122. data/lib/puppet/type/zpool.rb +3 -3
  123. data/lib/puppet/util.rb +24 -6
  124. data/lib/puppet/util/adsi.rb +12 -7
  125. data/lib/puppet/util/checksums.rb +1 -1
  126. data/lib/puppet/util/diff.rb +1 -1
  127. data/lib/puppet/util/nagios_maker.rb +2 -2
  128. data/lib/puppet/util/reference.rb +16 -17
  129. data/lib/puppet/util/settings/file_setting.rb +14 -2
  130. data/lib/puppet/util/windows/security.rb +96 -32
  131. data/spec/integration/file_serving/terminus_helper_spec.rb +1 -1
  132. data/spec/integration/indirector/direct_file_server_spec.rb +9 -15
  133. data/spec/integration/indirector/file_content/file_server_spec.rb +1 -1
  134. data/spec/integration/indirector/file_metadata/file_server_spec.rb +1 -1
  135. data/spec/integration/provider/package_spec.rb +4 -0
  136. data/spec/integration/provider/service/init_spec.rb +8 -2
  137. data/spec/integration/reference/providers_spec.rb +1 -1
  138. data/spec/integration/ssl/certificate_request_spec.rb +1 -2
  139. data/spec/integration/ssl/certificate_revocation_list_spec.rb +1 -2
  140. data/spec/integration/ssl/host_spec.rb +1 -2
  141. data/spec/integration/transaction_spec.rb +25 -17
  142. data/spec/integration/type/exec_spec.rb +77 -0
  143. data/spec/integration/type/file_spec.rb +322 -2
  144. data/spec/integration/util/windows/security_spec.rb +393 -230
  145. data/spec/integration/util_spec.rb +16 -0
  146. data/spec/lib/puppet_spec/files.rb +3 -7
  147. data/spec/unit/application/apply_spec.rb +0 -9
  148. data/spec/unit/application/inspect_spec.rb +1 -0
  149. data/spec/unit/configurer/downloader_spec.rb +3 -3
  150. data/spec/unit/face/certificate_spec.rb +6 -2
  151. data/spec/unit/file_bucket/dipper_spec.rb +67 -10
  152. data/spec/unit/file_bucket/file_spec.rb +22 -28
  153. data/spec/unit/file_serving/content_spec.rb +1 -1
  154. data/spec/unit/file_serving/metadata_spec.rb +30 -3
  155. data/spec/unit/indirector/facts/inventory_service_spec.rb +22 -0
  156. data/spec/unit/indirector/file_bucket_file/file_spec.rb +21 -24
  157. data/spec/unit/indirector/node/store_configs_spec.rb +1 -0
  158. data/spec/unit/indirector/resource/ral_spec.rb +1 -1
  159. data/spec/unit/indirector/resource_type/parser_spec.rb +2 -2
  160. data/spec/unit/indirector/rest_spec.rb +1 -1
  161. data/spec/unit/network/handler/ca_spec.rb +1 -1
  162. data/spec/unit/network/http/mongrel/rest_spec.rb +54 -25
  163. data/spec/unit/parameter_spec.rb +36 -0
  164. data/spec/unit/parser/parser_spec.rb +4 -0
  165. data/spec/unit/property_spec.rb +2 -2
  166. data/spec/unit/provider/exec/windows_spec.rb +2 -8
  167. data/spec/unit/provider/file/posix_spec.rb +6 -0
  168. data/spec/unit/provider/file/windows_spec.rb +18 -0
  169. data/spec/unit/provider/group/windows_adsi_spec.rb +22 -6
  170. data/spec/unit/provider/mount/parsed_spec.rb +1 -1
  171. data/spec/unit/provider/package/msi_spec.rb +2 -2
  172. data/spec/unit/provider/scheduled_task/win32_taskscheduler_spec.rb +1571 -0
  173. data/spec/unit/provider/service/launchd_spec.rb +143 -130
  174. data/spec/unit/provider/ssh_authorized_key/parsed_spec.rb +5 -0
  175. data/spec/unit/provider/user/user_role_add_spec.rb +39 -9
  176. data/spec/unit/provider/user/useradd_spec.rb +1 -1
  177. data/spec/unit/provider/user/windows_adsi_spec.rb +8 -1
  178. data/spec/unit/rb_tree_map_spec.rb +572 -0
  179. data/spec/unit/resource/catalog_spec.rb +1 -1
  180. data/spec/unit/simple_graph_spec.rb +9 -9
  181. data/spec/unit/ssl/host_spec.rb +60 -12
  182. data/spec/unit/transaction/report_spec.rb +3 -3
  183. data/spec/unit/transaction_spec.rb +394 -11
  184. data/spec/unit/type/exec_spec.rb +35 -15
  185. data/spec/unit/type/file/content_spec.rb +11 -10
  186. data/spec/unit/type/file/mode_spec.rb +73 -19
  187. data/spec/unit/type/file/source_spec.rb +1 -1
  188. data/spec/unit/type/file_spec.rb +15 -0
  189. data/spec/unit/type/group_spec.rb +1 -1
  190. data/spec/unit/type/mount_spec.rb +5 -5
  191. data/spec/unit/type/resources_spec.rb +3 -3
  192. data/spec/unit/type/scheduled_task_spec.rb +102 -0
  193. data/spec/unit/type/ssh_authorized_key_spec.rb +2 -3
  194. data/spec/unit/type/user_spec.rb +2 -1
  195. data/spec/unit/type_spec.rb +48 -4
  196. data/spec/unit/util/adsi_spec.rb +18 -7
  197. data/spec/unit/util/checksums_spec.rb +20 -2
  198. data/spec/unit/util/execution_stub_spec.rb +10 -5
  199. data/spec/unit/util/logging_spec.rb +6 -6
  200. data/spec/unit/util/rdoc/parser_spec.rb +1 -1
  201. data/spec/unit/util/reference_spec.rb +29 -0
  202. data/spec/unit/util/settings/file_setting_spec.rb +8 -2
  203. data/spec/unit/util_spec.rb +115 -0
  204. data/test/other/transactions.rb +5 -11
  205. data/test/ral/type/exec.rb +1 -1
  206. metadata +24 -11
@@ -77,7 +77,7 @@ class Puppet::Transaction::EventManager
77
77
 
78
78
  @event_queues[target] ||= {}
79
79
  @event_queues[target][callback] ||= []
80
- @event_queues[target][callback] += events
80
+ @event_queues[target][callback].concat(events)
81
81
  end
82
82
 
83
83
  def queued_events(resource)
@@ -635,6 +635,10 @@ class Type
635
635
  ###############################
636
636
  # Code related to evaluating the resources.
637
637
 
638
+ def ancestors
639
+ []
640
+ end
641
+
638
642
  # Flush the provider, if it supports it. This is called by the
639
643
  # transaction.
640
644
  def flush
@@ -1116,13 +1120,22 @@ class Type
1116
1120
  (e.g., each class and definition containing the resource), it can
1117
1121
  be useful to add your own tags to a given resource.
1118
1122
 
1119
- Tags are currently useful for things like applying a subset of a
1120
- host's configuration:
1123
+ Multiple tags can be specified as an array:
1124
+
1125
+ file {'/etc/hosts':
1126
+ ensure => file,
1127
+ source => 'puppet:///modules/site/hosts',
1128
+ mode => 0644,
1129
+ tag => ['bootstrap', 'minimumrun', 'mediumrun'],
1130
+ }
1131
+
1132
+ Tags are useful for things like applying a subset of a host's configuration
1133
+ with [the `tags` setting](/references/latest/configuration.html#tags):
1121
1134
 
1122
- puppet agent --test --tags mytag
1135
+ puppet agent --test --tags bootstrap
1123
1136
 
1124
- This way, when you're testing a configuration you can run just the
1125
- portion you're testing."
1137
+ This way, you can easily isolate the portion of the configuration you're
1138
+ trying to test."
1126
1139
 
1127
1140
  munge do |tags|
1128
1141
  tags = [tags] unless tags.is_a? Array
@@ -1370,33 +1383,25 @@ class Type
1370
1383
 
1371
1384
  # Find the default provider.
1372
1385
  def self.defaultprovider
1373
- unless @defaultprovider
1374
- suitable = suitableprovider
1386
+ return @defaultprovider if @defaultprovider
1375
1387
 
1376
- # Find which providers are a default for this system.
1377
- defaults = suitable.find_all { |provider| provider.default? }
1388
+ suitable = suitableprovider
1378
1389
 
1379
- # If we don't have any default we use suitable providers
1380
- defaults = suitable if defaults.empty?
1381
- max = defaults.collect { |provider| provider.specificity }.max
1382
- defaults = defaults.find_all { |provider| provider.specificity == max }
1390
+ # Find which providers are a default for this system.
1391
+ defaults = suitable.find_all { |provider| provider.default? }
1383
1392
 
1384
- retval = nil
1385
- if defaults.length > 1
1386
- Puppet.warning(
1387
- "Found multiple default providers for #{self.name}: #{defaults.collect { |i| i.name.to_s }.join(", ")}; using #{defaults[0].name}"
1388
- )
1389
- retval = defaults.shift
1390
- elsif defaults.length == 1
1391
- retval = defaults.shift
1392
- else
1393
- raise Puppet::DevError, "Could not find a default provider for #{self.name}"
1394
- end
1393
+ # If we don't have any default we use suitable providers
1394
+ defaults = suitable if defaults.empty?
1395
+ max = defaults.collect { |provider| provider.specificity }.max
1396
+ defaults = defaults.find_all { |provider| provider.specificity == max }
1395
1397
 
1396
- @defaultprovider = retval
1398
+ if defaults.length > 1
1399
+ Puppet.warning(
1400
+ "Found multiple default providers for #{self.name}: #{defaults.collect { |i| i.name.to_s }.join(", ")}; using #{defaults[0].name}"
1401
+ )
1397
1402
  end
1398
1403
 
1399
- @defaultprovider
1404
+ @defaultprovider = defaults.shift unless defaults.empty?
1400
1405
  end
1401
1406
 
1402
1407
  def self.provider_hash_by_type(type)
@@ -1477,9 +1482,15 @@ class Type
1477
1482
  return if @paramhash.has_key? :provider
1478
1483
 
1479
1484
  newparam(:provider) do
1480
- desc "The specific backend for #{self.name.to_s} to use. You will
1481
- seldom need to specify this --- Puppet will usually discover the
1482
- appropriate provider for your platform."
1485
+ # We're using a hacky way to get the name of our type, since there doesn't
1486
+ # seem to be a correct way to introspect this at the time this code is run.
1487
+ # We expect that the class in which this code is executed will be something
1488
+ # like Puppet::Type::Ssh_authorized_key::ParameterProvider.
1489
+ desc <<-EOT
1490
+ The specific backend to use for this `#{self.to_s.split('::')[2].downcase}`
1491
+ resource. You will seldom need to specify this --- Puppet will usually
1492
+ discover the appropriate provider for your platform.
1493
+ EOT
1483
1494
 
1484
1495
  # This is so we can refer back to the type to get a list of
1485
1496
  # providers for documentation.
@@ -1497,7 +1508,8 @@ class Type
1497
1508
  end
1498
1509
 
1499
1510
  defaultto {
1500
- @resource.class.defaultprovider.name
1511
+ prov = @resource.class.defaultprovider
1512
+ prov.name if prov
1501
1513
  }
1502
1514
 
1503
1515
  validate do |provider_class|
@@ -1541,6 +1553,24 @@ class Type
1541
1553
  }.reject { |p| p.name == :fake } # For testing
1542
1554
  end
1543
1555
 
1556
+ def suitable?
1557
+ # If we don't use providers, then we consider it suitable.
1558
+ return true unless self.class.paramclass(:provider)
1559
+
1560
+ # We have a provider and it is suitable.
1561
+ return true if provider && provider.class.suitable?
1562
+
1563
+ # We're using the default provider and there is one.
1564
+ if !provider and self.class.defaultprovider
1565
+ self.provider = self.class.defaultprovider.name
1566
+ return true
1567
+ end
1568
+
1569
+ # We specified an unsuitable provider, or there isn't any suitable
1570
+ # provider.
1571
+ false
1572
+ end
1573
+
1544
1574
  def provider=(name)
1545
1575
  if name.is_a?(Puppet::Provider)
1546
1576
  @provider = name
@@ -21,13 +21,13 @@ Puppet::Type.newtype(:augeas) do
21
21
  feature :execute_changes, "Actually make the changes"
22
22
 
23
23
  @doc = <<-EOT
24
- Apply the changes (single or array of changes) to the filesystem
25
- via the augeas tool.
24
+ Apply a change or an array of changes to the filesystem
25
+ using the augeas tool.
26
26
 
27
27
  Requires:
28
28
 
29
- - augeas to be installed (http://www.augeas.net)
30
- - ruby-augeas bindings
29
+ - [Augeas](http://www.augeas.net)
30
+ - The ruby-augeas bindings
31
31
 
32
32
  Sample usage with a string:
33
33
 
@@ -40,23 +40,25 @@ Puppet::Type.newtype(:augeas) do
40
40
  Sample usage with an array and custom lenses:
41
41
 
42
42
  augeas{"jboss_conf":
43
- context => "/files",
44
- changes => [
45
- "set etc/jbossas/jbossas.conf/JBOSS_IP $ipaddress",
46
- "set etc/jbossas/jbossas.conf/JAVA_HOME /usr",
47
- ],
43
+ context => "/files",
44
+ changes => [
45
+ "set etc/jbossas/jbossas.conf/JBOSS_IP $ipaddress",
46
+ "set etc/jbossas/jbossas.conf/JAVA_HOME /usr",
47
+ ],
48
48
  load_path => "$/usr/share/jbossas/lenses",
49
49
  }
50
50
 
51
51
  EOT
52
52
 
53
53
  newparam (:name) do
54
- desc "The name of this task. Used for uniqueness"
54
+ desc "The name of this task. Used for uniqueness."
55
55
  isnamevar
56
56
  end
57
57
 
58
58
  newparam (:context) do
59
- desc "Optional context path. This value is prepended to the paths of all changes if the path is relative. If INCL is set, defaults to '/files' + INCL, otherwise the empty string"
59
+ desc "Optional context path. This value is prepended to the paths of all
60
+ changes if the path is relative. If the `incl` parameter is set,
61
+ defaults to `/files + incl`; otherwise, defaults to the empty string."
60
62
  defaultto ""
61
63
  munge do |value|
62
64
  if value.empty? and resource[:incl]
@@ -71,91 +73,123 @@ Puppet::Type.newtype(:augeas) do
71
73
  desc "Optional augeas command and comparisons to control the execution of this type.
72
74
  Supported onlyif syntax:
73
75
 
74
- get [AUGEAS_PATH] [COMPARATOR] [STRING]
75
- match [MATCH_PATH] size [COMPARATOR] [INT]
76
- match [MATCH_PATH] include [STRING]
77
- match [MATCH_PATH] not_include [STRING]
78
- match [MATCH_PATH] == [AN_ARRAY]
79
- match [MATCH_PATH] != [AN_ARRAY]
76
+ * `get <AUGEAS_PATH> <COMPARATOR> <STRING>`
77
+ * `match <MATCH_PATH> size <COMPARATOR> <INT>`
78
+ * `match <MATCH_PATH> include <STRING>`
79
+ * `match <MATCH_PATH> not_include <STRING>`
80
+ * `match <MATCH_PATH> == <AN_ARRAY>`
81
+ * `match <MATCH_PATH> != <AN_ARRAY>`
80
82
 
81
83
  where:
82
84
 
83
- AUGEAS_PATH is a valid path scoped by the context
84
- MATCH_PATH is a valid match synatx scoped by the context
85
- COMPARATOR is in the set [> >= != == <= <]
86
- STRING is a string
87
- INT is a number
88
- AN_ARRAY is in the form ['a string', 'another']"
85
+ * `AUGEAS_PATH` is a valid path scoped by the context
86
+ * `MATCH_PATH` is a valid match synatx scoped by the context
87
+ * `COMPARATOR` is one of `>, >=, !=, ==, <=,` or `<`
88
+ * `STRING` is a string
89
+ * `INT` is a number
90
+ * `AN_ARRAY` is in the form `['a string', 'another']`"
89
91
  defaultto ""
90
92
  end
91
93
 
92
94
 
93
95
  newparam(:changes) do
94
96
  desc "The changes which should be applied to the filesystem. This
95
- can be either a string which contains a command or an array of commands.
96
- Commands supported are:
97
-
98
- set [PATH] [VALUE] Sets the value VALUE at loction PATH
99
- setm [PATH] [SUB] [VALUE] Sets multiple nodes matching SUB relative to PATH, to VALUE
100
- rm [PATH] Removes the node at location PATH
101
- remove [PATH] Synonym for rm
102
- clear [PATH] Sets the node at PATH to NULL, creating it if needed
103
- ins [LABEL] [WHERE] [PATH] Inserts an empty node LABEL either [WHERE={before|after}] PATH.
104
- insert [LABEL] [WHERE] [PATH] Synonym for ins
105
- mv [PATH] [PATH] Moves a node at PATH to the new location PATH
106
- move [PATH] [PATH] Synonym for mv
107
- defvar [NAME] [PATH] Sets Augeas variable $NAME to PATH
108
- defnode [NAME] [PATH] [VALUE] Sets Augeas variable $NAME to PATH, creating it with VALUE if needed
109
-
110
- If the parameter 'context' is set that value is prepended to a relative PATH"
97
+ can be a command or an array of commands. The following commands are supported:
98
+
99
+ `set <PATH> <VALUE>`
100
+ : Sets the value `VALUE` at loction `PATH`
101
+
102
+
103
+ `setm <PATH> <SUB> <VALUE>`
104
+ : Sets multiple nodes (matching `SUB` relative to `PATH`) to `VALUE`
105
+
106
+
107
+ `rm <PATH>`
108
+ : Removes the node at location `PATH`
109
+
110
+
111
+ `remove <PATH>`
112
+ : Synonym for `rm`
113
+
114
+
115
+ `clear <PATH>`
116
+ : Sets the node at `PATH` to `NULL`, creating it if needed
117
+
118
+
119
+ `ins <LABEL> (before|after) <PATH>`
120
+ : Inserts an empty node `LABEL` either before or after `PATH`.
121
+
122
+
123
+ `insert <LABEL> <WHERE> <PATH>`
124
+ : Synonym for `ins`
125
+
126
+
127
+ `mv <PATH> <OTHER PATH>`
128
+ : Moves a node at `PATH` to the new location `OTHER PATH`
129
+
130
+
131
+ `move <PATH> <OTHER PATH>`
132
+ : Synonym for `mv`
133
+
134
+
135
+ `defvar <NAME> <PATH>`
136
+ : Sets Augeas variable `$NAME` to `PATH`
137
+
138
+
139
+ `defnode <NAME> <PATH> <VALUE>`
140
+ : Sets Augeas variable `$NAME` to `PATH`, creating it with `VALUE` if needed
141
+
142
+ If the `context` parameter is set, that value is prepended to any relative `PATH`s."
111
143
  end
112
144
 
113
145
 
114
146
  newparam(:root) do
115
- desc "A file system path; all files loaded by Augeas are loaded underneath ROOT"
147
+ desc "A file system path; all files loaded by Augeas are loaded underneath `root`."
116
148
  defaultto "/"
117
149
  end
118
150
 
119
151
  newparam(:load_path) do
120
- desc "Optional colon separated list of directories; these directories are searched for schema definitions"
152
+ desc "Optional colon-separated list of directories; these directories are searched for schema definitions."
121
153
  defaultto ""
122
154
  end
123
155
 
124
156
  newparam(:force) do
125
157
  desc "Optional command to force the augeas type to execute even if it thinks changes
126
- will not be made. This does not overide the only setting. If onlyif is set, then the
127
- foce setting will not override that result"
158
+ will not be made. This does not overide the `onlyif` parameter."
128
159
 
129
160
  defaultto false
130
161
  end
131
162
 
132
163
  newparam(:type_check) do
133
- desc "Set to true if augeas should perform typechecking. Optional, defaults to false"
164
+ desc "Whether augeas should perform typechecking. Defaults to false."
134
165
  newvalues(:true, :false)
135
166
 
136
167
  defaultto :false
137
168
  end
138
169
 
139
170
  newparam(:lens) do
140
- desc "Use a specific lens, e.g. `Hosts.lns`. When this parameter is set, you must also set the incl parameter to indicate which file to load. Only that file will be loaded, which greatly speeds up execution of the type"
171
+ desc "Use a specific lens, e.g. `Hosts.lns`. When this parameter is set, you
172
+ must also set the `incl` parameter to indicate which file to load."
141
173
  end
142
174
 
143
175
  newparam(:incl) do
144
- desc "Load only a specific file, e.g. `/etc/hosts`. When this parameter is set, you must also set the lens parameter to indicate which lens to use."
176
+ desc "Load only a specific file, e.g. `/etc/hosts`. This can greatly speed
177
+ up the execution the resource. When this parameter is set, you must also
178
+ set the `lens` parameter to indicate which lens to use."
145
179
  end
146
180
 
147
181
  validate do
148
182
  has_lens = !self[:lens].nil?
149
183
  has_incl = !self[:incl].nil?
150
- self.fail "You must specify both the lens and incl parameters, or neither" if has_lens != has_incl
184
+ self.fail "You must specify both the lens and incl parameters, or neither." if has_lens != has_incl
151
185
  end
152
186
 
153
- # This is the acutal meat of the code. It forces
187
+ # This is the actual meat of the code. It forces
154
188
  # augeas to be run and fails or not based on the augeas return
155
189
  # code.
156
190
  newproperty(:returns) do |property|
157
191
  include Puppet::Util
158
- desc "The expected return code from the augeas command. Should not be set"
192
+ desc "The expected return code from the augeas command. Should not be set."
159
193
 
160
194
  defaultto 0
161
195
 
@@ -15,7 +15,7 @@ Puppet::Type.newtype(:computer) do
15
15
 
16
16
  This type primarily exists to create localhost Computer objects that MCX
17
17
  policy can then be attached to.
18
-
18
+
19
19
  **Autorequires:** If Puppet is managing the plist file representing a
20
20
  Computer object (located at `/var/db/dslocal/nodes/Default/computers/{name}.plist`),
21
21
  the Computer resource will autorequire it."
@@ -20,17 +20,17 @@ Puppet::Type.newtype(:cron) do
20
20
 
21
21
  cron { logrotate:
22
22
  command => "/usr/sbin/logrotate",
23
- user => root,
24
- hour => 2,
25
- minute => 0
23
+ user => root,
24
+ hour => 2,
25
+ minute => 0
26
26
  }
27
27
 
28
28
  Note that all periodic attributes can be specified as an array of values:
29
29
 
30
30
  cron { logrotate:
31
31
  command => "/usr/sbin/logrotate",
32
- user => root,
33
- hour => [2, 4]
32
+ user => root,
33
+ hour => [2, 4]
34
34
  }
35
35
 
36
36
  ...or using ranges or the step syntax `*/2` (although there's no guarantee
@@ -38,9 +38,9 @@ Puppet::Type.newtype(:cron) do
38
38
 
39
39
  cron { logrotate:
40
40
  command => "/usr/sbin/logrotate",
41
- user => root,
42
- hour => ['2-4'],
43
- minute => '*/10'
41
+ user => root,
42
+ hour => ['2-4'],
43
+ minute => '*/10'
44
44
  }
45
45
  EOT
46
46
  ensurable
@@ -338,9 +338,9 @@ Puppet::Type.newtype(:cron) do
338
338
  is used for human reference only and is generated automatically
339
339
  for cron jobs found on the system. This generally won't
340
340
  matter, as Puppet will do its best to match existing cron jobs
341
- against specified jobs (and Puppet adds a comment to cron jobs it adds), but it is at least possible that converting from
342
- unmanaged jobs to managed jobs might require manual
343
- intervention."
341
+ against specified jobs (and Puppet adds a comment to cron jobs it adds),
342
+ but it is at least possible that converting from unmanaged jobs to
343
+ managed jobs might require manual intervention."
344
344
 
345
345
  isnamevar
346
346
  end
@@ -24,7 +24,10 @@ module Puppet
24
24
  us at Puppet Labs what you are doing, and hopefully we can work with
25
25
  you to get a native resource type for the work you are doing.
26
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."
27
+ **Autorequires:** If Puppet is managing an exec's cwd or the executable
28
+ file used in an exec's command, the exec resource will autorequire those
29
+ files. If Puppet is managing the user that an exec should run as, the
30
+ exec resource will autorequire that user."
28
31
 
29
32
  # Create a new check mechanism. It's basically just a parameter that
30
33
  # provides one extra 'check' method.
@@ -271,25 +274,27 @@ module Puppet
271
274
 
272
275
 
273
276
  newcheck(:refreshonly) do
274
- desc "The command should only be run as a
277
+ desc <<-EOT
278
+ The command should only be run as a
275
279
  refresh mechanism for when a dependent object is changed. It only
276
280
  makes sense to use this option when this command depends on some
277
281
  other object; it is useful for triggering an action:
278
282
 
279
283
  # Pull down the main aliases file
280
- file { \"/etc/aliases\":
281
- source => \"puppet://server/module/aliases\"
284
+ file { "/etc/aliases":
285
+ source => "puppet://server/module/aliases"
282
286
  }
283
287
 
284
288
  # Rebuild the database, but only when the file changes
285
289
  exec { newaliases:
286
- path => [\"/usr/bin\", \"/usr/sbin\"],
287
- subscribe => File[\"/etc/aliases\"],
290
+ path => ["/usr/bin", "/usr/sbin"],
291
+ subscribe => File["/etc/aliases"],
288
292
  refreshonly => true
289
293
  }
290
294
 
291
295
  Note that only `subscribe` and `notify` can trigger actions, not `require`,
292
- so it only makes sense to use `refreshonly` with `subscribe` or `notify`."
296
+ so it only makes sense to use `refreshonly` with `subscribe` or `notify`.
297
+ EOT
293
298
 
294
299
  newvalues(:true, :false)
295
300
 
@@ -312,9 +317,9 @@ module Puppet
312
317
  if the specified file does not exist.
313
318
 
314
319
  exec { "tar -xf /Volumes/nfs02/important.tar":
315
- cwd => "/var/tmp",
320
+ cwd => "/var/tmp",
316
321
  creates => "/var/tmp/myfile",
317
- path => ["/usr/bin", "/usr/sbin"]
322
+ path => ["/usr/bin", "/usr/sbin"]
318
323
  }
319
324
 
320
325
  In this example, if `/var/tmp/myfile` is ever deleted, the exec
@@ -331,12 +336,13 @@ module Puppet
331
336
  end
332
337
 
333
338
  newcheck(:unless) do
334
- desc "If this parameter is set, then this `exec` will run unless
339
+ desc <<-EOT
340
+ If this parameter is set, then this `exec` will run unless
335
341
  the command returns 0. For example:
336
342
 
337
- exec { \"/bin/echo root >> /usr/lib/cron/cron.allow\":
338
- path => \"/usr/bin:/usr/sbin:/bin\",
339
- unless => \"grep root /usr/lib/cron/cron.allow 2>/dev/null\"
343
+ exec { "/bin/echo root >> /usr/lib/cron/cron.allow":
344
+ path => "/usr/bin:/usr/sbin:/bin",
345
+ unless => "grep root /usr/lib/cron/cron.allow 2>/dev/null"
340
346
  }
341
347
 
342
348
  This would add `root` to the cron.allow file (on Solaris) unless
@@ -344,7 +350,7 @@ module Puppet
344
350
 
345
351
  Note that this command follows the same rules as the main command,
346
352
  which is to say that it must be fully qualified if the path is not set.
347
- "
353
+ EOT
348
354
 
349
355
  validate do |cmds|
350
356
  cmds = [cmds] unless cmds.is_a? Array
@@ -368,12 +374,13 @@ module Puppet
368
374
  end
369
375
 
370
376
  newcheck(:onlyif) do
371
- desc "If this parameter is set, then this `exec` will only run if
377
+ desc <<-EOT
378
+ If this parameter is set, then this `exec` will only run if
372
379
  the command returns 0. For example:
373
380
 
374
- exec { \"logrotate\":
375
- path => \"/usr/bin:/usr/sbin:/bin\",
376
- onlyif => \"test `du /var/log/messages | cut -f1` -gt 100000\"
381
+ exec { "logrotate":
382
+ path => "/usr/bin:/usr/sbin:/bin",
383
+ onlyif => "test `du /var/log/messages | cut -f1` -gt 100000"
377
384
  }
378
385
 
379
386
  This would run `logrotate` only if that test returned true.
@@ -383,10 +390,10 @@ module Puppet
383
390
 
384
391
  Also note that onlyif can take an array as its value, e.g.:
385
392
 
386
- onlyif => [\"test -f /tmp/file1\", \"test -f /tmp/file2\"]
393
+ onlyif => ["test -f /tmp/file1", "test -f /tmp/file2"]
387
394
 
388
- This will only run the exec if /all/ conditions in the array return true.
389
- "
395
+ This will only run the exec if _all_ conditions in the array return true.
396
+ EOT
390
397
 
391
398
  validate do |cmds|
392
399
  cmds = [cmds] unless cmds.is_a? Array