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.
- data/CHANGELOG +168 -0
- data/conf/auth.conf +5 -4
- data/conf/redhat/puppet.spec +16 -1
- data/conf/solaris/pkginfo +2 -2
- data/conf/suse/puppet.spec +9 -3
- data/ext/upload_facts.rb +120 -0
- data/install.rb +11 -16
- data/lib/puppet.rb +1 -1
- data/lib/puppet/application/agent.rb +0 -3
- data/lib/puppet/application/apply.rb +0 -3
- data/lib/puppet/application/queue.rb +21 -1
- data/lib/puppet/defaults.rb +6 -4
- data/lib/puppet/face/file/store.rb +1 -1
- data/lib/puppet/feature/base.rb +2 -1
- data/lib/puppet/file_bucket/dipper.rb +3 -2
- data/lib/puppet/file_serving/content.rb +1 -1
- data/lib/puppet/file_serving/metadata.rb +5 -2
- data/lib/puppet/indirector/facts/inventory_service.rb +20 -0
- data/lib/puppet/indirector/file_bucket_file/file.rb +3 -2
- data/lib/puppet/indirector/report/processor.rb +1 -1
- data/lib/puppet/network/handler/filebucket.rb +2 -0
- data/lib/puppet/network/handler/fileserver.rb +1 -1
- data/lib/puppet/network/handler/master.rb +1 -0
- data/lib/puppet/network/handler/report.rb +2 -0
- data/lib/puppet/network/handler/runner.rb +1 -0
- data/lib/puppet/network/handler/status.rb +2 -0
- data/lib/puppet/network/http/mongrel/rest.rb +8 -1
- data/lib/puppet/network/http_server.rb +3 -0
- data/lib/puppet/network/http_server/mongrel.rb +129 -0
- data/lib/puppet/network/rest_authconfig.rb +12 -4
- data/lib/puppet/parameter.rb +18 -0
- data/lib/puppet/parser/compiler.rb +1 -1
- data/lib/puppet/parser/grammar.ra +1 -1
- data/lib/puppet/parser/parser.rb +360 -350
- data/lib/puppet/property.rb +3 -3
- data/lib/puppet/provider/augeas/augeas.rb +1 -1
- data/lib/puppet/provider/exec/windows.rb +6 -7
- data/lib/puppet/provider/file/windows.rb +9 -2
- data/lib/puppet/provider/group/aix.rb +8 -8
- data/lib/puppet/provider/group/groupadd.rb +1 -3
- data/lib/puppet/provider/group/ldap.rb +8 -10
- data/lib/puppet/provider/group/windows_adsi.rb +8 -2
- data/lib/puppet/provider/package/aix.rb +1 -1
- data/lib/puppet/provider/package/macports.rb +3 -3
- data/lib/puppet/provider/package/msi.rb +12 -5
- data/lib/puppet/provider/package/nim.rb +1 -1
- data/lib/puppet/provider/package/pkgdmg.rb +3 -3
- data/lib/puppet/provider/package/ports.rb +1 -1
- data/lib/puppet/provider/scheduled_task/win32_taskscheduler.rb +560 -0
- data/lib/puppet/provider/service/base.rb +2 -2
- data/lib/puppet/provider/service/bsd.rb +4 -3
- data/lib/puppet/provider/service/daemontools.rb +25 -25
- data/lib/puppet/provider/service/debian.rb +6 -4
- data/lib/puppet/provider/service/freebsd.rb +1 -1
- data/lib/puppet/provider/service/gentoo.rb +4 -3
- data/lib/puppet/provider/service/init.rb +3 -8
- data/lib/puppet/provider/service/launchd.rb +129 -96
- data/lib/puppet/provider/service/redhat.rb +2 -3
- data/lib/puppet/provider/service/runit.rb +20 -20
- data/lib/puppet/provider/service/smf.rb +8 -7
- data/lib/puppet/provider/service/src.rb +5 -6
- data/lib/puppet/provider/service/systemd.rb +1 -1
- data/lib/puppet/provider/service/upstart.rb +3 -5
- data/lib/puppet/provider/service/windows.rb +7 -7
- data/lib/puppet/provider/sshkey/parsed.rb +2 -3
- data/lib/puppet/provider/user/aix.rb +21 -21
- data/lib/puppet/provider/user/hpux.rb +3 -1
- data/lib/puppet/provider/user/ldap.rb +7 -7
- data/lib/puppet/provider/user/user_role_add.rb +10 -6
- data/lib/puppet/provider/user/useradd.rb +3 -1
- data/lib/puppet/provider/user/windows_adsi.rb +4 -3
- data/lib/puppet/rb_tree_map.rb +388 -0
- data/lib/puppet/reference/configuration.rb +7 -7
- data/lib/puppet/reference/indirection.rb +5 -6
- data/lib/puppet/reference/metaparameter.rb +3 -1
- data/lib/puppet/reference/network.rb +8 -8
- data/lib/puppet/reference/providers.rb +17 -21
- data/lib/puppet/reference/type.rb +12 -9
- data/lib/puppet/resource.rb +2 -5
- data/lib/puppet/resource/catalog.rb +1 -1
- data/lib/puppet/ssl/certificate_request.rb +70 -0
- data/lib/puppet/ssl/host.rb +6 -0
- data/lib/puppet/transaction.rb +158 -55
- data/lib/puppet/transaction/event_manager.rb +1 -1
- data/lib/puppet/type.rb +60 -30
- data/lib/puppet/type/augeas.rb +83 -49
- data/lib/puppet/type/computer.rb +1 -1
- data/lib/puppet/type/cron.rb +11 -11
- data/lib/puppet/type/exec.rb +28 -21
- data/lib/puppet/type/file.rb +17 -7
- data/lib/puppet/type/file/content.rb +2 -2
- data/lib/puppet/type/file/ensure.rb +15 -12
- data/lib/puppet/type/file/mode.rb +30 -5
- data/lib/puppet/type/file/source.rb +11 -10
- data/lib/puppet/type/file/target.rb +2 -2
- data/lib/puppet/type/filebucket.rb +1 -1
- data/lib/puppet/type/group.rb +4 -5
- data/lib/puppet/type/host.rb +1 -1
- data/lib/puppet/type/interface.rb +13 -10
- data/lib/puppet/type/k5login.rb +6 -6
- data/lib/puppet/type/macauthorization.rb +37 -36
- data/lib/puppet/type/maillist.rb +2 -2
- data/lib/puppet/type/mcx.rb +6 -6
- data/lib/puppet/type/mount.rb +3 -2
- data/lib/puppet/type/notify.rb +1 -1
- data/lib/puppet/type/package.rb +24 -23
- data/lib/puppet/type/router.rb +4 -1
- data/lib/puppet/type/schedule.rb +52 -44
- data/lib/puppet/type/scheduled_task.rb +222 -0
- data/lib/puppet/type/selmodule.rb +10 -6
- data/lib/puppet/type/service.rb +11 -11
- data/lib/puppet/type/ssh_authorized_key.rb +2 -5
- data/lib/puppet/type/sshkey.rb +1 -1
- data/lib/puppet/type/stage.rb +1 -1
- data/lib/puppet/type/tidy.rb +10 -8
- data/lib/puppet/type/user.rb +61 -53
- data/lib/puppet/type/vlan.rb +4 -4
- data/lib/puppet/type/whit.rb +6 -2
- data/lib/puppet/type/yumrepo.rb +33 -31
- data/lib/puppet/type/zfs.rb +34 -32
- data/lib/puppet/type/zone.rb +21 -19
- data/lib/puppet/type/zpool.rb +3 -3
- data/lib/puppet/util.rb +24 -6
- data/lib/puppet/util/adsi.rb +12 -7
- data/lib/puppet/util/checksums.rb +1 -1
- data/lib/puppet/util/diff.rb +1 -1
- data/lib/puppet/util/nagios_maker.rb +2 -2
- data/lib/puppet/util/reference.rb +16 -17
- data/lib/puppet/util/settings/file_setting.rb +14 -2
- data/lib/puppet/util/windows/security.rb +96 -32
- data/spec/integration/file_serving/terminus_helper_spec.rb +1 -1
- data/spec/integration/indirector/direct_file_server_spec.rb +9 -15
- data/spec/integration/indirector/file_content/file_server_spec.rb +1 -1
- data/spec/integration/indirector/file_metadata/file_server_spec.rb +1 -1
- data/spec/integration/provider/package_spec.rb +4 -0
- data/spec/integration/provider/service/init_spec.rb +8 -2
- data/spec/integration/reference/providers_spec.rb +1 -1
- data/spec/integration/ssl/certificate_request_spec.rb +1 -2
- data/spec/integration/ssl/certificate_revocation_list_spec.rb +1 -2
- data/spec/integration/ssl/host_spec.rb +1 -2
- data/spec/integration/transaction_spec.rb +25 -17
- data/spec/integration/type/exec_spec.rb +77 -0
- data/spec/integration/type/file_spec.rb +322 -2
- data/spec/integration/util/windows/security_spec.rb +393 -230
- data/spec/integration/util_spec.rb +16 -0
- data/spec/lib/puppet_spec/files.rb +3 -7
- data/spec/unit/application/apply_spec.rb +0 -9
- data/spec/unit/application/inspect_spec.rb +1 -0
- data/spec/unit/configurer/downloader_spec.rb +3 -3
- data/spec/unit/face/certificate_spec.rb +6 -2
- data/spec/unit/file_bucket/dipper_spec.rb +67 -10
- data/spec/unit/file_bucket/file_spec.rb +22 -28
- data/spec/unit/file_serving/content_spec.rb +1 -1
- data/spec/unit/file_serving/metadata_spec.rb +30 -3
- data/spec/unit/indirector/facts/inventory_service_spec.rb +22 -0
- data/spec/unit/indirector/file_bucket_file/file_spec.rb +21 -24
- data/spec/unit/indirector/node/store_configs_spec.rb +1 -0
- data/spec/unit/indirector/resource/ral_spec.rb +1 -1
- data/spec/unit/indirector/resource_type/parser_spec.rb +2 -2
- data/spec/unit/indirector/rest_spec.rb +1 -1
- data/spec/unit/network/handler/ca_spec.rb +1 -1
- data/spec/unit/network/http/mongrel/rest_spec.rb +54 -25
- data/spec/unit/parameter_spec.rb +36 -0
- data/spec/unit/parser/parser_spec.rb +4 -0
- data/spec/unit/property_spec.rb +2 -2
- data/spec/unit/provider/exec/windows_spec.rb +2 -8
- data/spec/unit/provider/file/posix_spec.rb +6 -0
- data/spec/unit/provider/file/windows_spec.rb +18 -0
- data/spec/unit/provider/group/windows_adsi_spec.rb +22 -6
- data/spec/unit/provider/mount/parsed_spec.rb +1 -1
- data/spec/unit/provider/package/msi_spec.rb +2 -2
- data/spec/unit/provider/scheduled_task/win32_taskscheduler_spec.rb +1571 -0
- data/spec/unit/provider/service/launchd_spec.rb +143 -130
- data/spec/unit/provider/ssh_authorized_key/parsed_spec.rb +5 -0
- data/spec/unit/provider/user/user_role_add_spec.rb +39 -9
- data/spec/unit/provider/user/useradd_spec.rb +1 -1
- data/spec/unit/provider/user/windows_adsi_spec.rb +8 -1
- data/spec/unit/rb_tree_map_spec.rb +572 -0
- data/spec/unit/resource/catalog_spec.rb +1 -1
- data/spec/unit/simple_graph_spec.rb +9 -9
- data/spec/unit/ssl/host_spec.rb +60 -12
- data/spec/unit/transaction/report_spec.rb +3 -3
- data/spec/unit/transaction_spec.rb +394 -11
- data/spec/unit/type/exec_spec.rb +35 -15
- data/spec/unit/type/file/content_spec.rb +11 -10
- data/spec/unit/type/file/mode_spec.rb +73 -19
- data/spec/unit/type/file/source_spec.rb +1 -1
- data/spec/unit/type/file_spec.rb +15 -0
- data/spec/unit/type/group_spec.rb +1 -1
- data/spec/unit/type/mount_spec.rb +5 -5
- data/spec/unit/type/resources_spec.rb +3 -3
- data/spec/unit/type/scheduled_task_spec.rb +102 -0
- data/spec/unit/type/ssh_authorized_key_spec.rb +2 -3
- data/spec/unit/type/user_spec.rb +2 -1
- data/spec/unit/type_spec.rb +48 -4
- data/spec/unit/util/adsi_spec.rb +18 -7
- data/spec/unit/util/checksums_spec.rb +20 -2
- data/spec/unit/util/execution_stub_spec.rb +10 -5
- data/spec/unit/util/logging_spec.rb +6 -6
- data/spec/unit/util/rdoc/parser_spec.rb +1 -1
- data/spec/unit/util/reference_spec.rb +29 -0
- data/spec/unit/util/settings/file_setting_spec.rb +8 -2
- data/spec/unit/util_spec.rb +115 -0
- data/test/other/transactions.rb +5 -11
- data/test/ral/type/exec.rb +1 -1
- metadata +24 -11
data/lib/puppet/type.rb
CHANGED
@@ -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
|
-
|
1120
|
-
|
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
|
1135
|
+
puppet agent --test --tags bootstrap
|
1123
1136
|
|
1124
|
-
This way,
|
1125
|
-
|
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
|
-
|
1374
|
-
suitable = suitableprovider
|
1386
|
+
return @defaultprovider if @defaultprovider
|
1375
1387
|
|
1376
|
-
|
1377
|
-
defaults = suitable.find_all { |provider| provider.default? }
|
1388
|
+
suitable = suitableprovider
|
1378
1389
|
|
1379
|
-
|
1380
|
-
|
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
|
-
|
1385
|
-
|
1386
|
-
|
1387
|
-
|
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
|
-
|
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
|
-
|
1481
|
-
|
1482
|
-
|
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
|
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
|
data/lib/puppet/type/augeas.rb
CHANGED
@@ -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
|
25
|
-
|
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
|
-
-
|
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
|
44
|
-
changes
|
45
|
-
|
46
|
-
|
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
|
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
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
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
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
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
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
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
|
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
|
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
|
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 "
|
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
|
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`.
|
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
|
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
|
|
data/lib/puppet/type/computer.rb
CHANGED
@@ -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."
|
data/lib/puppet/type/cron.rb
CHANGED
@@ -20,17 +20,17 @@ Puppet::Type.newtype(:cron) do
|
|
20
20
|
|
21
21
|
cron { logrotate:
|
22
22
|
command => "/usr/sbin/logrotate",
|
23
|
-
user
|
24
|
-
hour
|
25
|
-
minute
|
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
|
33
|
-
hour
|
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
|
42
|
-
hour
|
43
|
-
minute
|
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),
|
342
|
-
|
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
|
data/lib/puppet/type/exec.rb
CHANGED
@@ -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
|
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
|
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 {
|
281
|
-
source =>
|
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
|
287
|
-
subscribe
|
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
|
320
|
+
cwd => "/var/tmp",
|
316
321
|
creates => "/var/tmp/myfile",
|
317
|
-
path
|
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
|
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 {
|
338
|
-
path
|
339
|
-
unless =>
|
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
|
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 {
|
375
|
-
path
|
376
|
-
onlyif =>
|
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 => [
|
393
|
+
onlyif => ["test -f /tmp/file1", "test -f /tmp/file2"]
|
387
394
|
|
388
|
-
This will only run the exec if
|
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
|