puppet 2.7.11 → 2.7.12
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of puppet might be problematic. Click here for more details.
- data/CHANGELOG +188 -0
- data/conf/osx/createpackage.sh +1 -0
- data/conf/redhat/puppet.spec +12 -9
- data/conf/suse/puppet.spec +4 -1
- data/install.rb +9 -22
- data/lib/puppet.rb +1 -31
- data/lib/puppet/agent.rb +3 -5
- data/lib/puppet/agent/locker.rb +15 -1
- data/lib/puppet/application.rb +7 -4
- data/lib/puppet/application/agent.rb +4 -25
- data/lib/puppet/application/apply.rb +3 -3
- data/lib/puppet/application/device.rb +2 -16
- data/lib/puppet/application/doc.rb +2 -2
- data/lib/puppet/application/face_base.rb +22 -5
- data/lib/puppet/application/filebucket.rb +2 -0
- data/lib/puppet/application/inspect.rb +2 -1
- data/lib/puppet/application/kick.rb +25 -9
- data/lib/puppet/application/queue.rb +0 -23
- data/lib/puppet/configurer.rb +1 -0
- data/lib/puppet/configurer/downloader.rb +7 -3
- data/lib/puppet/defaults.rb +34 -29
- data/lib/puppet/face/ca.rb +1 -1
- data/lib/puppet/face/catalog.rb +1 -0
- data/lib/puppet/face/file/store.rb +1 -1
- data/lib/puppet/face/module/list.rb +23 -3
- data/lib/puppet/face/module/search.rb +21 -32
- data/lib/puppet/face/module/uninstall.rb +56 -15
- data/lib/puppet/file_bucket/dipper.rb +2 -2
- data/lib/puppet/file_serving/base.rb +6 -5
- data/lib/puppet/file_serving/configuration/parser.rb +1 -1
- data/lib/puppet/file_serving/content.rb +1 -1
- data/lib/puppet/forge.rb +153 -0
- data/lib/puppet/{module_tool → forge}/cache.rb +1 -2
- data/lib/puppet/{module_tool → forge}/repository.rb +46 -4
- data/lib/puppet/indirector/exec.rb +1 -1
- data/lib/puppet/indirector/file_bucket_file/file.rb +3 -3
- data/lib/puppet/interface/action.rb +6 -2
- data/lib/puppet/module.rb +70 -10
- data/lib/puppet/module_tool.rb +2 -38
- data/lib/puppet/module_tool/applications.rb +15 -11
- data/lib/puppet/module_tool/applications/application.rb +2 -5
- data/lib/puppet/module_tool/applications/cleaner.rb +1 -1
- data/lib/puppet/module_tool/applications/installer.rb +10 -45
- data/lib/puppet/module_tool/applications/searcher.rb +2 -26
- data/lib/puppet/module_tool/applications/uninstaller.rb +39 -13
- data/lib/puppet/module_tool/applications/unpacker.rb +1 -1
- data/lib/puppet/module_tool/dependency.rb +1 -1
- data/lib/puppet/network/authconfig.rb +1 -1
- data/lib/puppet/network/handler/fileserver.rb +1 -1
- data/lib/puppet/network/http/handler.rb +4 -1
- data/lib/puppet/network/http/webrick.rb +4 -2
- data/lib/puppet/node/environment.rb +32 -6
- data/lib/puppet/parameter/path.rb +0 -4
- data/lib/puppet/parser/ast/relationship.rb +3 -16
- data/lib/puppet/parser/collector.rb +5 -3
- data/lib/puppet/parser/compiler.rb +2 -1
- data/lib/puppet/parser/functions/file.rb +1 -1
- data/lib/puppet/parser/functions/generate.rb +8 -2
- data/lib/puppet/parser/grammar.ra +16 -15
- data/lib/puppet/parser/parser.rb +959 -881
- data/lib/puppet/parser/relationship.rb +32 -15
- data/lib/puppet/parser/resource.rb +0 -1
- data/lib/puppet/parser/type_loader.rb +1 -2
- data/lib/puppet/provider/augeas/augeas.rb +17 -29
- data/lib/puppet/provider/exec/windows.rb +25 -3
- data/lib/puppet/provider/file/posix.rb +1 -1
- data/lib/puppet/provider/file/windows.rb +1 -1
- data/lib/puppet/provider/group/windows_adsi.rb +1 -1
- data/lib/puppet/provider/package/aix.rb +1 -1
- data/lib/puppet/provider/package/appdmg.rb +1 -1
- data/lib/puppet/provider/package/dpkg.rb +1 -1
- data/lib/puppet/provider/package/gem.rb +21 -23
- data/lib/puppet/provider/package/macports.rb +1 -1
- data/lib/puppet/provider/package/msi.rb +7 -1
- data/lib/puppet/provider/package/openbsd.rb +13 -16
- data/lib/puppet/provider/package/pacman.rb +1 -1
- data/lib/puppet/provider/package/pip.rb +3 -0
- data/lib/puppet/provider/package/pkg.rb +1 -1
- data/lib/puppet/provider/package/pkgdmg.rb +1 -1
- data/lib/puppet/provider/package/pkgutil.rb +1 -1
- data/lib/puppet/provider/package/portage.rb +2 -2
- data/lib/puppet/provider/package/rpm.rb +1 -1
- data/lib/puppet/provider/package/sun.rb +1 -1
- data/lib/puppet/provider/package/zypper.rb +35 -3
- data/lib/puppet/provider/scheduled_task/win32_taskscheduler.rb +6 -2
- data/lib/puppet/provider/selmodule/semodule.rb +2 -2
- data/lib/puppet/provider/service/base.rb +1 -1
- data/lib/puppet/provider/service/launchd.rb +4 -0
- data/lib/puppet/provider/service/src.rb +2 -2
- data/lib/puppet/provider/service/upstart.rb +1 -1
- data/lib/puppet/provider/service/windows.rb +5 -4
- data/lib/puppet/provider/user/aix.rb +3 -3
- data/lib/puppet/provider/user/pw.rb +6 -0
- data/lib/puppet/provider/user/windows_adsi.rb +1 -1
- data/lib/puppet/resource/catalog.rb +6 -6
- data/lib/puppet/resource/type.rb +2 -0
- data/lib/puppet/ssl/certificate_request.rb +0 -70
- data/lib/puppet/transaction.rb +1 -1
- data/lib/puppet/transaction/report.rb +3 -2
- data/lib/puppet/type.rb +1 -1
- data/lib/puppet/type/cron.rb +5 -2
- data/lib/puppet/type/exec.rb +8 -0
- data/lib/puppet/type/file.rb +27 -18
- data/lib/puppet/type/file/checksum.rb +2 -2
- data/lib/puppet/type/file/content.rb +14 -9
- data/lib/puppet/type/file/ensure.rb +5 -4
- data/lib/puppet/type/file/group.rb +10 -2
- data/lib/puppet/type/file/mode.rb +46 -18
- data/lib/puppet/type/file/owner.rb +10 -2
- data/lib/puppet/type/file/source.rb +27 -40
- data/lib/puppet/type/file/target.rb +6 -6
- data/lib/puppet/type/group.rb +13 -9
- data/lib/puppet/type/k5login.rb +1 -1
- data/lib/puppet/type/package.rb +24 -8
- data/lib/puppet/type/scheduled_task.rb +77 -131
- data/lib/puppet/type/service.rb +22 -8
- data/lib/puppet/type/user.rb +29 -9
- data/lib/puppet/util.rb +24 -33
- data/lib/puppet/util/colors.rb +98 -0
- data/lib/puppet/util/diff.rb +3 -1
- data/lib/puppet/util/log.rb +5 -1
- data/lib/puppet/util/log/destinations.rb +37 -44
- data/lib/puppet/util/monkey_patches.rb +32 -0
- data/lib/puppet/util/pidlock.rb +70 -21
- data/lib/puppet/util/rdoc/parser.rb +4 -2
- data/lib/puppet/util/selinux.rb +1 -1
- data/lib/puppet/util/suidmanager.rb +2 -12
- data/lib/puppet/util/windows.rb +2 -0
- data/lib/puppet/util/windows/process.rb +33 -0
- data/lib/puppet/util/windows/security.rb +6 -4
- data/lib/puppet/util/windows/user.rb +44 -0
- data/lib/semver.rb +55 -4
- data/spec/fixtures/unit/provider/package/openbsd/pkginfo.detail +19 -0
- data/spec/fixtures/unit/provider/package/openbsd/pkginfo.list +10 -0
- data/spec/fixtures/unit/provider/package/openbsd/pkginfo.query +1 -0
- data/spec/fixtures/unit/provider/package/zypper/zypper-list-updates-SLES11sp1.out +369 -0
- data/spec/integration/defaults_spec.rb +10 -0
- data/spec/integration/indirector/direct_file_server_spec.rb +1 -1
- data/spec/integration/module_tool_spec.rb +10 -12
- data/spec/integration/parser/compiler_spec.rb +147 -0
- data/spec/integration/type/file_spec.rb +1 -1
- data/spec/integration/util/windows/user_spec.rb +59 -0
- data/spec/lib/puppet/face/basetest.rb +5 -0
- data/spec/lib/puppet_spec/modules.rb +26 -0
- data/spec/spec_helper.rb +25 -0
- data/spec/unit/agent/locker_spec.rb +12 -0
- data/spec/unit/agent_backward_compatibility_spec.rb +152 -0
- data/spec/unit/agent_spec.rb +28 -8
- data/spec/unit/application/agent_spec.rb +4 -36
- data/spec/unit/application/device_spec.rb +55 -10
- data/spec/unit/application/face_base_spec.rb +32 -10
- data/spec/unit/application/filebucket_spec.rb +5 -0
- data/spec/unit/application/kick_spec.rb +6 -0
- data/spec/unit/application_spec.rb +8 -1
- data/spec/unit/configurer/downloader_spec.rb +4 -5
- data/spec/unit/face/ca_spec.rb +15 -4
- data/spec/unit/file_bucket/dipper_spec.rb +1 -1
- data/spec/unit/file_serving/base_spec.rb +60 -42
- data/spec/unit/file_serving/configuration/parser_spec.rb +5 -3
- data/spec/unit/file_serving/content_spec.rb +26 -27
- data/spec/unit/file_serving/metadata_spec.rb +22 -21
- data/spec/unit/forge/repository_spec.rb +86 -0
- data/spec/unit/forge_spec.rb +114 -0
- data/spec/unit/indirector/exec_spec.rb +8 -6
- data/spec/unit/indirector/facts/inventory_active_record_spec.rb +0 -1
- data/spec/unit/indirector/file_bucket_file/file_spec.rb +1 -1
- data/spec/unit/indirector/node/exec_spec.rb +1 -1
- data/spec/unit/indirector/resource/active_record_spec.rb +0 -4
- data/spec/unit/interface/action_builder_spec.rb +7 -5
- data/spec/unit/module_spec.rb +228 -9
- data/spec/unit/module_tool/application_spec.rb +3 -3
- data/spec/unit/module_tool/uninstaller_spec.rb +107 -27
- data/spec/unit/module_tool_spec.rb +0 -33
- data/spec/unit/network/authconfig_spec.rb +22 -21
- data/spec/unit/network/http/webrick_spec.rb +13 -9
- data/spec/unit/node/environment_spec.rb +159 -66
- data/spec/unit/parser/collector_spec.rb +16 -8
- data/spec/unit/parser/functions/generate_spec.rb +60 -18
- data/spec/unit/parser/resource_spec.rb +44 -0
- data/spec/unit/provider/augeas/augeas_spec.rb +160 -179
- data/spec/unit/provider/confine/feature_spec.rb +3 -5
- data/spec/unit/provider/package/dpkg_spec.rb +4 -2
- data/spec/unit/provider/package/gem_spec.rb +59 -43
- data/spec/unit/provider/package/openbsd_spec.rb +114 -0
- data/spec/unit/provider/package/pacman_spec.rb +1 -1
- data/spec/unit/provider/package/pip_spec.rb +10 -4
- data/spec/unit/provider/package/zypper_spec.rb +56 -14
- data/spec/unit/provider/selmodule_spec.rb +3 -3
- data/spec/unit/provider/service/launchd_spec.rb +22 -21
- data/spec/unit/provider/service/{upstart.rb → upstart_spec.rb} +7 -3
- data/spec/unit/provider/user/pw_spec.rb +19 -0
- data/spec/unit/resource/catalog_spec.rb +3 -3
- data/spec/unit/semver_spec.rb +117 -24
- data/spec/unit/transaction/report_spec.rb +11 -1
- data/spec/unit/type/cron_spec.rb +200 -213
- data/spec/unit/type/exec_spec.rb +7 -0
- data/spec/unit/type/file/content_spec.rb +2 -2
- data/spec/unit/type/file_spec.rb +12 -9
- data/spec/unit/type/package_spec.rb +25 -0
- data/spec/unit/type/schedule_spec.rb +31 -31
- data/spec/unit/util/diff_spec.rb +30 -0
- data/spec/unit/util/execution_stub_spec.rb +1 -2
- data/spec/unit/util/log/destinations_spec.rb +51 -0
- data/spec/unit/util/log_spec.rb +17 -1
- data/spec/unit/util/monkey_patches_spec.rb +119 -0
- data/spec/unit/util/rdoc/parser_spec.rb +25 -1
- data/spec/unit/util/selinux_spec.rb +2 -2
- data/spec/unit/util/suidmanager_spec.rb +6 -51
- data/spec/unit/util_spec.rb +82 -24
- data/test/lib/puppettest/certificates.rb +16 -0
- data/test/lib/puppettest/servertest.rb +4 -0
- data/test/util/pidlock.rb +125 -0
- metadata +23 -14
- data/ext/puppetstoredconfigclean.rb +0 -103
- data/lib/puppet/agent/disabler.rb +0 -27
- data/lib/puppet/util/anonymous_filelock.rb +0 -36
- data/spec/unit/agent/disabler_spec.rb +0 -60
- data/spec/unit/module_tool/repository_spec.rb +0 -52
- data/spec/unit/util/anonymous_filelock_spec.rb +0 -78
- data/spec/unit/util/pidlock_spec.rb +0 -208
@@ -17,7 +17,7 @@ Puppet::Type.type(:package).provide :pkg, :parent => Puppet::Provider::Package d
|
|
17
17
|
hash = {}
|
18
18
|
|
19
19
|
# now turn each returned line into a package object
|
20
|
-
process.
|
20
|
+
process.each_line { |line|
|
21
21
|
if hash = parse_line(line)
|
22
22
|
packages << new(hash)
|
23
23
|
end
|
@@ -65,7 +65,7 @@ Puppet::Type.type(:package).provide :pkgdmg, :parent => Puppet::Provider::Packag
|
|
65
65
|
if %r{\A[A-Za-z][A-Za-z0-9+\-\.]*://} =~ cached_source
|
66
66
|
cached_source = "/tmp/#{name}"
|
67
67
|
begin
|
68
|
-
curl "-o", cached_source, "-C", "-", "-k", "-s", "--url", source
|
68
|
+
curl "-o", cached_source, "-C", "-", "-k", "-L", "-s", "--url", source
|
69
69
|
Puppet.debug "Success: curl transfered [#{name}]"
|
70
70
|
rescue Puppet::ExecutionFailure
|
71
71
|
Puppet.debug "curl did not transfer [#{name}]. Falling back to slower open-uri transfer methods."
|
@@ -20,7 +20,7 @@ Puppet::Type.type(:package).provide :pkgutil, :parent => :sun, :source => :sun d
|
|
20
20
|
correct_wgetopts = false
|
21
21
|
[ "/opt/csw/etc/pkgutil.conf", "/etc/opt/csw/pkgutil.conf" ].each do |confpath|
|
22
22
|
File.open(confpath) do |conf|
|
23
|
-
conf.
|
23
|
+
conf.each_line {|line| correct_wgetopts = true if line =~ /^\s*wgetopts\s*=.*(-nv|-q|--no-verbose|--quiet)/ }
|
24
24
|
end
|
25
25
|
end
|
26
26
|
if ! correct_wgetopts
|
@@ -28,7 +28,7 @@ Puppet::Type.type(:package).provide :portage, :parent => Puppet::Provider::Packa
|
|
28
28
|
end
|
29
29
|
|
30
30
|
packages = []
|
31
|
-
search_output.
|
31
|
+
search_output.each_line do |search_result|
|
32
32
|
match = result_format.match(search_result)
|
33
33
|
|
34
34
|
if match
|
@@ -89,7 +89,7 @@ Puppet::Type.type(:package).provide :portage, :parent => Puppet::Provider::Packa
|
|
89
89
|
end
|
90
90
|
|
91
91
|
packages = []
|
92
|
-
search_output.
|
92
|
+
search_output.each_line do |search_result|
|
93
93
|
match = result_format.match(search_result)
|
94
94
|
|
95
95
|
if match
|
@@ -37,7 +37,7 @@ Puppet::Type.type(:package).provide :rpm, :source => :rpm, :parent => Puppet::Pr
|
|
37
37
|
begin
|
38
38
|
execpipe("#{command(:rpm)} -qa #{sig} --nodigest --qf '#{NEVRAFORMAT}\n'") { |process|
|
39
39
|
# now turn each returned line into a package object
|
40
|
-
process.
|
40
|
+
process.each_line { |line|
|
41
41
|
hash = nevra_to_hash(line)
|
42
42
|
packages << new(hash)
|
43
43
|
}
|
@@ -39,7 +39,7 @@ Puppet::Type.type(:package).provide :sun, :parent => Puppet::Provider::Package d
|
|
39
39
|
execpipe(cmd) { |process|
|
40
40
|
# we're using the long listing, so each line is a separate
|
41
41
|
# piece of information
|
42
|
-
process.
|
42
|
+
process.each_line { |line|
|
43
43
|
case line
|
44
44
|
when /^$/
|
45
45
|
hash[:provider] = :sun
|
@@ -4,10 +4,16 @@ Puppet::Type.type(:package).provide :zypper, :parent => :rpm do
|
|
4
4
|
has_feature :versionable
|
5
5
|
|
6
6
|
commands :zypper => "/usr/bin/zypper"
|
7
|
-
commands :rpm => "rpm"
|
8
7
|
|
9
8
|
confine :operatingsystem => [:suse, :sles, :sled, :opensuse]
|
10
9
|
|
10
|
+
#on zypper versions <1.0, the version option returns 1
|
11
|
+
#some versions of zypper output on stderr
|
12
|
+
def zypper_version
|
13
|
+
cmd = [self.class.command(:zypper),"--version"]
|
14
|
+
execute(cmd, { :failonfail => false, :combine => true})
|
15
|
+
end
|
16
|
+
|
11
17
|
# Install a package using 'zypper'.
|
12
18
|
def install
|
13
19
|
should = @resource.should(:ensure)
|
@@ -22,7 +28,33 @@ Puppet::Type.type(:package).provide :zypper, :parent => :rpm do
|
|
22
28
|
# Add the package version
|
23
29
|
wanted = "#{wanted}-#{should}"
|
24
30
|
end
|
25
|
-
|
31
|
+
|
32
|
+
#This has been tested with following zypper versions
|
33
|
+
#SLE 10.2: 0.6.104
|
34
|
+
#SLE 11.0: 1.0.8
|
35
|
+
#OpenSuse 10.2: 0.6.13
|
36
|
+
#OpenSuse 11.2: 1.2.8
|
37
|
+
#Assume that this will work on newer zypper versions
|
38
|
+
|
39
|
+
#extract version numbers and convert to integers
|
40
|
+
major, minor, patch = zypper_version.scan(/\d+/).map{ |x| x.to_i }
|
41
|
+
self.debug "Detected zypper version #{major}.#{minor}.#{patch}"
|
42
|
+
|
43
|
+
#zypper version < 1.0 does not support --quiet flag
|
44
|
+
quiet = "--quiet"
|
45
|
+
if major < 1
|
46
|
+
quiet = "--terse"
|
47
|
+
end
|
48
|
+
|
49
|
+
license = "--auto-agree-with-licenses"
|
50
|
+
noconfirm = "--no-confirm"
|
51
|
+
|
52
|
+
#zypper 0.6.13 (OpenSuSE 10.2) does not support auto agree with licenses
|
53
|
+
if major < 1 and minor <= 6 and patch <= 13
|
54
|
+
zypper quiet, :install, noconfirm, wanted
|
55
|
+
else
|
56
|
+
zypper quiet, :install, license, noconfirm, wanted
|
57
|
+
end
|
26
58
|
|
27
59
|
unless self.query
|
28
60
|
raise Puppet::ExecutionFailure.new(
|
@@ -36,7 +68,7 @@ Puppet::Type.type(:package).provide :zypper, :parent => :rpm do
|
|
36
68
|
#zypper can only get a list of *all* available packages?
|
37
69
|
output = zypper "list-updates"
|
38
70
|
|
39
|
-
if output =~ /#{Regexp.escape @resource[:name]}\s
|
71
|
+
if output =~ /#{Regexp.escape @resource[:name]}\s*\|.*?\|\s*([^\s\|]+)/
|
40
72
|
return $1
|
41
73
|
else
|
42
74
|
# zypper didn't find updates, pretend the current
|
@@ -6,8 +6,12 @@ if Puppet.features.microsoft_windows?
|
|
6
6
|
end
|
7
7
|
|
8
8
|
Puppet::Type.type(:scheduled_task).provide(:win32_taskscheduler) do
|
9
|
-
desc
|
10
|
-
|
9
|
+
desc %q{This provider uses the win32-taskscheduler gem to manage scheduled
|
10
|
+
tasks on Windows.
|
11
|
+
|
12
|
+
Puppet requires version 0.2.1 or later of the win32-taskscheduler gem;
|
13
|
+
previous versions can cause "Could not evaluate: The operation completed
|
14
|
+
successfully" errors.}
|
11
15
|
|
12
16
|
defaultfor :operatingsystem => :windows
|
13
17
|
confine :operatingsystem => :windows
|
@@ -21,7 +21,7 @@ Puppet::Type.type(:selmodule).provide(:semodule) do
|
|
21
21
|
def exists?
|
22
22
|
self.debug "Checking for module #{@resource[:name]}"
|
23
23
|
execpipe("#{command(:semodule)} --list") do |out|
|
24
|
-
out.
|
24
|
+
out.each_line do |line|
|
25
25
|
if line =~ /#{@resource[:name]}\b/
|
26
26
|
return :true
|
27
27
|
end
|
@@ -118,7 +118,7 @@ Puppet::Type.type(:selmodule).provide(:semodule) do
|
|
118
118
|
begin
|
119
119
|
execpipe("#{command(:semodule)} --list") do |output|
|
120
120
|
lines = output.readlines
|
121
|
-
lines.
|
121
|
+
lines.each_line do |line|
|
122
122
|
line.chomp!
|
123
123
|
bits = line.split
|
124
124
|
if bits[0] == @resource[:name]
|
@@ -24,7 +24,7 @@ Puppet::Type.type(:service).provide :base do
|
|
24
24
|
regex = Regexp.new(@resource[:pattern])
|
25
25
|
self.debug "Executing '#{ps}'"
|
26
26
|
IO.popen(ps) { |table|
|
27
|
-
table.
|
27
|
+
table.each_line { |line|
|
28
28
|
if regex.match(line)
|
29
29
|
ary = line.sub(/^\s+/, '').split(/\s+/)
|
30
30
|
return ary[1]
|
@@ -35,6 +35,8 @@ Puppet::Type.type(:service).provide :launchd, :parent => :base do
|
|
35
35
|
Note that this allows you to do something `launchctl` can't do, which is to
|
36
36
|
be in a state of "stopped/enabled" or "running/disabled".
|
37
37
|
|
38
|
+
Note that this provider does not support overriding 'restart' or 'status'.
|
39
|
+
|
38
40
|
EOT
|
39
41
|
|
40
42
|
include Puppet::Util::Warnings
|
@@ -192,6 +194,7 @@ Puppet::Type.type(:service).provide :launchd, :parent => :base do
|
|
192
194
|
# conditionally enable at load, then disable by modifying the plist file
|
193
195
|
# directly.
|
194
196
|
def start
|
197
|
+
return ucommand(:start) if resource[:start]
|
195
198
|
job_path, job_plist = plist_from_label(resource[:name])
|
196
199
|
did_enable_job = false
|
197
200
|
cmds = []
|
@@ -212,6 +215,7 @@ Puppet::Type.type(:service).provide :launchd, :parent => :base do
|
|
212
215
|
|
213
216
|
|
214
217
|
def stop
|
218
|
+
return ucommand(:stop) if resource[:stop]
|
215
219
|
job_path, job_plist = plist_from_label(resource[:name])
|
216
220
|
did_disable_job = false
|
217
221
|
cmds = []
|
@@ -30,7 +30,7 @@ Puppet::Type.type(:service).provide :src, :parent => :base do
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def restart
|
33
|
-
execute([command(:lssrc), "-Ss", @resource[:name]]).
|
33
|
+
execute([command(:lssrc), "-Ss", @resource[:name]]).each_line do |line|
|
34
34
|
args = line.split(":")
|
35
35
|
|
36
36
|
next unless args[0] == @resource[:name]
|
@@ -62,7 +62,7 @@ Puppet::Type.type(:service).provide :src, :parent => :base do
|
|
62
62
|
end
|
63
63
|
|
64
64
|
def status
|
65
|
-
execute([command(:lssrc), "-s", @resource[:name]]).
|
65
|
+
execute([command(:lssrc), "-s", @resource[:name]]).each_line do |line|
|
66
66
|
args = line.split
|
67
67
|
|
68
68
|
# This is the header line
|
@@ -20,7 +20,7 @@ Puppet::Type.type(:service).provide :upstart, :parent => :init do
|
|
20
20
|
def self.instances
|
21
21
|
instances = []
|
22
22
|
execpipe("#{command(:initctl)} list") { |process|
|
23
|
-
process.
|
23
|
+
process.each_line { |line|
|
24
24
|
# needs special handling of services such as network-interface:
|
25
25
|
# initctl list:
|
26
26
|
# network-interface (lo) start/running
|
@@ -5,11 +5,12 @@ require 'win32/service' if Puppet.features.microsoft_windows?
|
|
5
5
|
Puppet::Type.type(:service).provide :windows do
|
6
6
|
|
7
7
|
desc <<-EOT
|
8
|
-
Support for Windows Service Control Manager (SCM).
|
8
|
+
Support for Windows Service Control Manager (SCM). This provider can
|
9
|
+
start, stop, enable, and disable services, and the SCM provides working
|
10
|
+
status methods for all services.
|
9
11
|
|
10
|
-
|
11
|
-
|
12
|
-
Control of service groups (dependencies) is not yet supported.
|
12
|
+
Control of service groups (dependencies) is not yet supported, nor is running
|
13
|
+
services as a specific user.
|
13
14
|
EOT
|
14
15
|
|
15
16
|
defaultfor :operatingsystem => :windows
|
@@ -148,7 +148,7 @@ Puppet::Type.type(:user).provide :aix, :parent => Puppet::Provider::AixObject do
|
|
148
148
|
# Get the groupname from its id
|
149
149
|
def self.groupname_by_id(gid)
|
150
150
|
groupname=nil
|
151
|
-
execute(lsgroupscmd("ALL")).
|
151
|
+
execute(lsgroupscmd("ALL")).each_line { |entry|
|
152
152
|
attrs = self.parse_attr_list(entry, nil)
|
153
153
|
if attrs and attrs.include? :id and gid == attrs[:id].to_i
|
154
154
|
groupname = entry.split(" ")[0]
|
@@ -229,9 +229,9 @@ Puppet::Type.type(:user).provide :aix, :parent => Puppet::Provider::AixObject do
|
|
229
229
|
user = @resource[:name]
|
230
230
|
f = File.open("/etc/security/passwd", 'r')
|
231
231
|
# Skip to the user
|
232
|
-
f.
|
232
|
+
f.each_line { |l| break if l =~ /^#{user}:\s*$/ }
|
233
233
|
if ! f.eof?
|
234
|
-
f.
|
234
|
+
f.each_line { |l|
|
235
235
|
# If there is a new user stanza, stop
|
236
236
|
break if l =~ /^\S*:\s*$/
|
237
237
|
# If the password= entry is found, return it
|
@@ -105,9 +105,9 @@ class Puppet::Resource::Catalog < Puppet::SimpleGraph
|
|
105
105
|
# isn't sufficient.
|
106
106
|
if existing = @resource_table[newref]
|
107
107
|
return if existing == resource
|
108
|
-
|
109
|
-
|
110
|
-
msg = "Cannot alias #{resource.ref} to #{key.inspect}#{
|
108
|
+
resource_declaration = " at #{resource.file}:#{resource.line}" if resource.file and resource.line
|
109
|
+
existing_declaration = " at #{existing.file}:#{existing.line}" if existing.file and existing.line
|
110
|
+
msg = "Cannot alias #{resource.ref} to #{key.inspect}#{resource_declaration}; resource #{newref.inspect} already declared#{existing_declaration}"
|
111
111
|
raise ArgumentError, msg
|
112
112
|
end
|
113
113
|
@resource_table[newref] = resource
|
@@ -569,17 +569,17 @@ class Puppet::Resource::Catalog < Puppet::SimpleGraph
|
|
569
569
|
|
570
570
|
private
|
571
571
|
|
572
|
-
# Verify that the given resource isn't
|
572
|
+
# Verify that the given resource isn't declared elsewhere.
|
573
573
|
def fail_on_duplicate_type_and_title(resource)
|
574
574
|
# Short-curcuit the common case,
|
575
575
|
return unless existing_resource = @resource_table[title_key_for_ref(resource.ref)]
|
576
576
|
|
577
577
|
# If we've gotten this far, it's a real conflict
|
578
|
-
msg = "Duplicate
|
578
|
+
msg = "Duplicate declaration: #{resource.ref} is already declared"
|
579
579
|
|
580
580
|
msg << " in file #{existing_resource.file} at line #{existing_resource.line}" if existing_resource.file and existing_resource.line
|
581
581
|
|
582
|
-
msg << "; cannot
|
582
|
+
msg << "; cannot redeclare" if resource.line or resource.file
|
583
583
|
|
584
584
|
raise DuplicateResourceError.new(msg)
|
585
585
|
end
|
data/lib/puppet/resource/type.rb
CHANGED
@@ -146,74 +146,4 @@ class Puppet::SSL::CertificateRequest < Puppet::SSL::Base
|
|
146
146
|
sort.
|
147
147
|
uniq
|
148
148
|
end
|
149
|
-
|
150
|
-
# Return the set of extensions requested on this CSR, in a form designed to
|
151
|
-
# be useful to Ruby: a hash. Which, not coincidentally, you can pass
|
152
|
-
# successfully to the OpenSSL constructor later, if you want.
|
153
|
-
def request_extensions
|
154
|
-
raise Puppet::Error, "CSR needs content to extract fields" unless @content
|
155
|
-
|
156
|
-
# Prefer the standard extReq, but accept the Microsoft specific version as
|
157
|
-
# a fallback, if the standard version isn't found.
|
158
|
-
ext = @content.attributes.find {|x| x.oid == "extReq" } or
|
159
|
-
@content.attributes.find {|x| x.oid == "msExtReq" }
|
160
|
-
return [] unless ext
|
161
|
-
|
162
|
-
# Assert the structure and extract the names into an array of arrays.
|
163
|
-
unless ext.value.is_a? OpenSSL::ASN1::Set
|
164
|
-
raise Puppet::Error, "In #{ext.oid}, expected Set but found #{ext.value.class}"
|
165
|
-
end
|
166
|
-
|
167
|
-
unless ext.value.value.is_a? Array
|
168
|
-
raise Puppet::Error, "In #{ext.oid}, expected Set[Array] but found #{ext.value.value.class}"
|
169
|
-
end
|
170
|
-
|
171
|
-
unless ext.value.value.length == 1
|
172
|
-
raise Puppet::Error, "In #{ext.oid}, expected Set[Array[...]], but found #{ext.value.value.length} items in the array"
|
173
|
-
end
|
174
|
-
|
175
|
-
san = ext.value.value.first
|
176
|
-
unless san.is_a? OpenSSL::ASN1::Sequence
|
177
|
-
raise Puppet::Error, "In #{ext.oid}, expected Set[Array[Sequence[...]]], but found #{san.class}"
|
178
|
-
end
|
179
|
-
san = san.value
|
180
|
-
|
181
|
-
# OK, now san should be the array of items, validate that...
|
182
|
-
index = -1
|
183
|
-
san.map do |name|
|
184
|
-
index += 1
|
185
|
-
|
186
|
-
unless name.is_a? OpenSSL::ASN1::Sequence
|
187
|
-
raise Puppet::Error, "In #{ext.oid}, expected request extension record #{index} to be a Sequence, but found #{name.class}"
|
188
|
-
end
|
189
|
-
name = name.value
|
190
|
-
|
191
|
-
# OK, turn that into an extension, to unpack the content. Lovely that
|
192
|
-
# we have to swap the order of arguments to the underlying method, or
|
193
|
-
# perhaps that the ASN.1 representation chose to pack them in a
|
194
|
-
# strange order where the optional component comes *earlier* than the
|
195
|
-
# fixed component in the sequence.
|
196
|
-
case name.length
|
197
|
-
when 2
|
198
|
-
ev = OpenSSL::X509::Extension.new(name[0].value, name[1].value)
|
199
|
-
{ "oid" => ev.oid, "value" => ev.value }
|
200
|
-
|
201
|
-
when 3
|
202
|
-
ev = OpenSSL::X509::Extension.new(name[0].value, name[2].value, name[1].value)
|
203
|
-
{ "oid" => ev.oid, "value" => ev.value, "critical" => ev.critical? }
|
204
|
-
|
205
|
-
else
|
206
|
-
raise Puppet::Error, "In #{ext.oid}, expected extension record #{index} to have two or three items, but found #{name.length}"
|
207
|
-
end
|
208
|
-
end.flatten
|
209
|
-
end
|
210
|
-
|
211
|
-
def subject_alt_names
|
212
|
-
@subject_alt_names ||= request_extensions.
|
213
|
-
select {|x| x["oid"] = "subjectAltName" }.
|
214
|
-
map {|x| x["value"].split(/\s*,\s*/) }.
|
215
|
-
flatten.
|
216
|
-
sort.
|
217
|
-
uniq
|
218
|
-
end
|
219
149
|
end
|
data/lib/puppet/transaction.rb
CHANGED
@@ -235,7 +235,7 @@ class Puppet::Transaction
|
|
235
235
|
def initialize(catalog, report = nil)
|
236
236
|
@catalog = catalog
|
237
237
|
|
238
|
-
@report = report || Puppet::Transaction::Report.new("apply", catalog.version)
|
238
|
+
@report = report || Puppet::Transaction::Report.new("apply", catalog.version, Puppet[:environment])
|
239
239
|
|
240
240
|
@event_manager = Puppet::Transaction::EventManager.new(self)
|
241
241
|
|
@@ -10,7 +10,7 @@ class Puppet::Transaction::Report
|
|
10
10
|
|
11
11
|
indirects :report, :terminus_class => :processor
|
12
12
|
|
13
|
-
attr_accessor :configuration_version, :host
|
13
|
+
attr_accessor :configuration_version, :host, :environment
|
14
14
|
attr_reader :resource_statuses, :logs, :metrics, :time, :kind, :status
|
15
15
|
|
16
16
|
# This is necessary since Marshall doesn't know how to
|
@@ -68,7 +68,7 @@ class Puppet::Transaction::Report
|
|
68
68
|
@status = compute_status(resource_metrics, change_metric)
|
69
69
|
end
|
70
70
|
|
71
|
-
def initialize(kind, configuration_version=nil)
|
71
|
+
def initialize(kind, configuration_version=nil, environment=nil)
|
72
72
|
@metrics = {}
|
73
73
|
@logs = []
|
74
74
|
@resource_statuses = {}
|
@@ -79,6 +79,7 @@ class Puppet::Transaction::Report
|
|
79
79
|
@report_format = 2
|
80
80
|
@puppet_version = Puppet.version
|
81
81
|
@configuration_version = configuration_version
|
82
|
+
@environment = environment
|
82
83
|
@status = 'failed' # assume failed until the report is finalized
|
83
84
|
end
|
84
85
|
|
data/lib/puppet/type.rb
CHANGED
@@ -1258,7 +1258,7 @@ class Type
|
|
1258
1258
|
require => File[\"/usr/local/scripts\"]
|
1259
1259
|
}
|
1260
1260
|
|
1261
|
-
Multiple dependencies can be specified by providing a comma-
|
1261
|
+
Multiple dependencies can be specified by providing a comma-separated list
|
1262
1262
|
of resources, enclosed in square brackets:
|
1263
1263
|
|
1264
1264
|
require => [ File[\"/usr/local\"], File[\"/usr/local/scripts\"] ]
|