puppet 7.7.0-universal-darwin → 7.8.0-universal-darwin
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.
- checksums.yaml +4 -4
- data/CONTRIBUTING.md +2 -2
- data/Gemfile +2 -1
- data/Gemfile.lock +9 -9
- data/ext/osx/puppet.plist +2 -0
- data/lib/puppet/defaults.rb +3 -1
- data/lib/puppet/pops/types/p_sem_ver_type.rb +8 -2
- data/lib/puppet/pops/types/p_sensitive_type.rb +10 -0
- data/lib/puppet/provider/package/apt.rb +3 -3
- data/lib/puppet/provider/package/nim.rb +11 -6
- data/lib/puppet/provider/package/yum.rb +3 -3
- data/lib/puppet/provider/package/zypper.rb +3 -3
- data/lib/puppet/provider/service/freebsd.rb +1 -1
- data/lib/puppet/provider/service/systemd.rb +6 -1
- data/lib/puppet/provider/user/directoryservice.rb +24 -11
- data/lib/puppet/transaction/additional_resource_generator.rb +1 -1
- data/lib/puppet/type/service.rb +8 -9
- data/lib/puppet/type/user.rb +38 -20
- data/lib/puppet/version.rb +1 -1
- data/locales/puppet.pot +36 -40
- data/man/man5/puppet.conf.5 +5 -2
- data/man/man8/puppet-agent.8 +1 -1
- data/man/man8/puppet-apply.8 +1 -1
- data/man/man8/puppet-catalog.8 +1 -1
- data/man/man8/puppet-config.8 +1 -1
- data/man/man8/puppet-describe.8 +1 -1
- data/man/man8/puppet-device.8 +1 -1
- data/man/man8/puppet-doc.8 +1 -1
- data/man/man8/puppet-epp.8 +1 -1
- data/man/man8/puppet-facts.8 +1 -1
- data/man/man8/puppet-filebucket.8 +1 -1
- data/man/man8/puppet-generate.8 +1 -1
- data/man/man8/puppet-help.8 +1 -1
- data/man/man8/puppet-lookup.8 +1 -1
- data/man/man8/puppet-module.8 +1 -1
- data/man/man8/puppet-node.8 +1 -1
- data/man/man8/puppet-parser.8 +1 -1
- data/man/man8/puppet-plugin.8 +1 -1
- data/man/man8/puppet-report.8 +1 -1
- data/man/man8/puppet-resource.8 +1 -1
- data/man/man8/puppet-script.8 +1 -1
- data/man/man8/puppet-ssl.8 +1 -1
- data/man/man8/puppet.8 +2 -2
- data/spec/integration/application/resource_spec.rb +30 -0
- data/spec/unit/functions4_spec.rb +17 -8
- data/spec/unit/pops/types/p_sem_ver_type_spec.rb +18 -0
- data/spec/unit/pops/types/p_sensitive_type_spec.rb +18 -0
- data/spec/unit/provider/package/nim_spec.rb +42 -0
- data/spec/unit/provider/service/freebsd_spec.rb +1 -1
- data/spec/unit/provider/service/systemd_spec.rb +12 -0
- data/spec/unit/provider/user/directoryservice_spec.rb +67 -35
- data/spec/unit/type/service_spec.rb +49 -34
- data/spec/unit/type/user_spec.rb +45 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 29a06654af276aed16d178a14059409632b80b9b838ff6e1b8b07329c3402ef4
|
4
|
+
data.tar.gz: 4e48dfbe2df587ab5ed149e220d5e9974389222f38066d4874e17f4d2d3bfefa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 17ab709d1af6ecbd3bf297bbff6a14e815b1858b6a1290e450731ee80909adf57383a4ebff50543060497282578a0adfd9fed149f494af6341418fe1703d7a48
|
7
|
+
data.tar.gz: 7a673548e296c7755c382cf2b9bbcad56981e21db5a7a7130f325eb029fc140f465e7d30881a4339ac3c9bdb76a424bf761ec1e26504a16027a4f057afb7f29c
|
data/CONTRIBUTING.md
CHANGED
@@ -114,7 +114,7 @@ respectively.
|
|
114
114
|
|
115
115
|
## Submitting Changes
|
116
116
|
|
117
|
-
* Sign the [Contributor License Agreement](https://cla.
|
117
|
+
* Sign the [Contributor License Agreement](https://cla-assistant.io/puppetlabs/).
|
118
118
|
* Push your changes to a topic branch in your fork of the repository.
|
119
119
|
* Submit a pull request to the repository in the puppetlabs organization.
|
120
120
|
* Update the related Jira ticket to mark that you have submitted code and are ready
|
@@ -158,4 +158,4 @@ ensure the issue has been resolved.
|
|
158
158
|
* [General GitHub documentation](https://help.github.com/)
|
159
159
|
* [GitHub pull request documentation](https://help.github.com/articles/creating-a-pull-request/)
|
160
160
|
* [puppet-dev mailing list](https://groups.google.com/forum/#!forum/puppet-dev)
|
161
|
-
* [Puppet community slack](https://slack.puppet.com)
|
161
|
+
* [Puppet community slack](https://slack.puppet.com)
|
data/Gemfile
CHANGED
@@ -37,12 +37,13 @@ end
|
|
37
37
|
group(:test) do
|
38
38
|
gem "ffi", require: false
|
39
39
|
gem "json-schema", "~> 2.0", require: false
|
40
|
-
gem "rake", *location_for(ENV['RAKE_LOCATION'] || '~>
|
40
|
+
gem "rake", *location_for(ENV['RAKE_LOCATION'] || '~> 13.0')
|
41
41
|
gem "rspec", "~> 3.1", require: false
|
42
42
|
gem "rspec-expectations", ["~> 3.9", "!= 3.9.3"]
|
43
43
|
gem "rspec-its", "~> 1.1", require: false
|
44
44
|
gem 'vcr', '~> 5.0', require: false
|
45
45
|
gem 'webmock', '~> 3.0', require: false
|
46
|
+
gem 'webrick', '~> 1.7', require: false if RUBY_VERSION.to_f >= 3.0
|
46
47
|
gem 'yard', require: false
|
47
48
|
|
48
49
|
gem 'rubocop', '~> 0.49', require: false, platforms: [:ruby]
|
data/Gemfile.lock
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
GIT
|
2
2
|
remote: git://github.com/puppetlabs/packaging
|
3
|
-
revision:
|
3
|
+
revision: 56b3c7db09d6cafe878ff4a9dfc048b5a5bea89c
|
4
4
|
branch: 1.0.x
|
5
5
|
specs:
|
6
|
-
packaging (0.99.
|
6
|
+
packaging (0.99.77.2.g56b3c7d)
|
7
7
|
artifactory (~> 2)
|
8
8
|
csv (= 3.1.5)
|
9
9
|
rake (>= 12.3)
|
@@ -12,7 +12,7 @@ GIT
|
|
12
12
|
PATH
|
13
13
|
remote: .
|
14
14
|
specs:
|
15
|
-
puppet (7.
|
15
|
+
puppet (7.8.0)
|
16
16
|
CFPropertyList (~> 2.2)
|
17
17
|
concurrent-ruby (~> 1.0)
|
18
18
|
deep_merge (~> 1.0)
|
@@ -33,14 +33,14 @@ GEM
|
|
33
33
|
artifactory (2.8.2)
|
34
34
|
ast (2.4.2)
|
35
35
|
coderay (1.1.3)
|
36
|
-
concurrent-ruby (1.1.
|
36
|
+
concurrent-ruby (1.1.9)
|
37
37
|
crack (0.4.5)
|
38
38
|
rexml
|
39
39
|
csv (3.1.5)
|
40
40
|
deep_merge (1.2.1)
|
41
41
|
diff-lcs (1.4.4)
|
42
42
|
docopt (0.6.1)
|
43
|
-
facter (4.
|
43
|
+
facter (4.2.1)
|
44
44
|
hocon (~> 1.3)
|
45
45
|
thor (>= 1.0.1, < 2.0)
|
46
46
|
fast_gettext (1.1.2)
|
@@ -78,14 +78,14 @@ GEM
|
|
78
78
|
coderay (~> 1.1)
|
79
79
|
method_source (~> 1.0)
|
80
80
|
public_suffix (4.0.6)
|
81
|
-
puppet-resource_api (1.8.
|
81
|
+
puppet-resource_api (1.8.14)
|
82
82
|
hocon (>= 1.0)
|
83
83
|
puppetserver-ca (2.1.0)
|
84
84
|
facter (>= 2.0.1, < 5)
|
85
85
|
racc (1.4.9)
|
86
86
|
rainbow (2.2.2)
|
87
87
|
rake
|
88
|
-
rake (
|
88
|
+
rake (13.0.3)
|
89
89
|
rdiscount (2.2.0.2)
|
90
90
|
rdoc (6.3.1)
|
91
91
|
release-metrics (1.1.0)
|
@@ -124,7 +124,7 @@ GEM
|
|
124
124
|
ruby-prof (1.4.3)
|
125
125
|
ruby-progressbar (1.11.0)
|
126
126
|
scanf (1.0.0)
|
127
|
-
semantic_puppet (1.0.
|
127
|
+
semantic_puppet (1.0.4)
|
128
128
|
text (1.3.1)
|
129
129
|
thor (1.1.0)
|
130
130
|
unicode-display_width (1.7.0)
|
@@ -154,7 +154,7 @@ DEPENDENCIES
|
|
154
154
|
puppet-resource_api (~> 1.5)
|
155
155
|
puppetserver-ca (~> 2.0)
|
156
156
|
racc (= 1.4.9)
|
157
|
-
rake (~>
|
157
|
+
rake (~> 13.0)
|
158
158
|
rdoc (~> 6.0)
|
159
159
|
ronn (~> 0.7.3)
|
160
160
|
rspec (~> 3.1)
|
data/ext/osx/puppet.plist
CHANGED
data/lib/puppet/defaults.rb
CHANGED
@@ -1426,7 +1426,9 @@ EOT
|
|
1426
1426
|
See the report reference for information on the built-in report
|
1427
1427
|
handlers; custom report handlers can also be loaded from modules.
|
1428
1428
|
(Report handlers are loaded from the lib directory, at
|
1429
|
-
`puppet/reports/NAME.rb`.)
|
1429
|
+
`puppet/reports/NAME.rb`.)
|
1430
|
+
|
1431
|
+
To turn off reports entirely, set this to `none`",
|
1430
1432
|
},
|
1431
1433
|
:reportdir => {
|
1432
1434
|
:default => "$vardir/reports",
|
@@ -95,16 +95,22 @@ class PSemVerType < PScalarType
|
|
95
95
|
end
|
96
96
|
|
97
97
|
def from_args(major, minor, patch, prerelease = nil, build = nil)
|
98
|
-
SemanticPuppet::Version.new(major, minor, patch, prerelease, build)
|
98
|
+
SemanticPuppet::Version.new(major, minor, patch, to_array(prerelease), to_array(build))
|
99
99
|
end
|
100
100
|
|
101
101
|
def from_hash(hash)
|
102
|
-
SemanticPuppet::Version.new(hash['major'], hash['minor'], hash['patch'], hash['prerelease'], hash['build'])
|
102
|
+
SemanticPuppet::Version.new(hash['major'], hash['minor'], hash['patch'], to_array(hash['prerelease']), to_array(hash['build']))
|
103
103
|
end
|
104
104
|
|
105
105
|
def on_error(str)
|
106
106
|
_("The string '%{str}' cannot be converted to a SemVer") % { str: str }
|
107
107
|
end
|
108
|
+
|
109
|
+
private
|
110
|
+
|
111
|
+
def to_array(component)
|
112
|
+
component ? [component] : nil
|
113
|
+
end
|
108
114
|
end
|
109
115
|
end
|
110
116
|
|
@@ -24,6 +24,16 @@ class PSensitiveType < PTypeWithContainedType
|
|
24
24
|
def inspect
|
25
25
|
"#<#{self}>"
|
26
26
|
end
|
27
|
+
|
28
|
+
def hash
|
29
|
+
@value.hash
|
30
|
+
end
|
31
|
+
|
32
|
+
def ==(other)
|
33
|
+
other.is_a?(Sensitive) &&
|
34
|
+
other.hash == hash
|
35
|
+
end
|
36
|
+
alias eql? ==
|
27
37
|
end
|
28
38
|
|
29
39
|
def self.register_ptype(loader, ir)
|
@@ -91,20 +91,20 @@ Puppet::Type.type(:package).provide :apt, :parent => :dpkg, :source => :dpkg do
|
|
91
91
|
end
|
92
92
|
|
93
93
|
def best_version(should_range)
|
94
|
-
|
94
|
+
versions = []
|
95
95
|
|
96
96
|
output = aptcache :madison, @resource[:name]
|
97
97
|
output.each_line do |line|
|
98
98
|
is = line.split('|')[1].strip
|
99
99
|
begin
|
100
100
|
is_version = DebianVersion.parse(is)
|
101
|
-
|
101
|
+
versions << is_version if should_range.include?(is_version)
|
102
102
|
rescue DebianVersion::ValidationFailure
|
103
103
|
Puppet.debug("Cannot parse #{is} as a debian version")
|
104
104
|
end
|
105
105
|
end
|
106
106
|
|
107
|
-
return
|
107
|
+
return versions.sort.last if versions.any?
|
108
108
|
|
109
109
|
Puppet.debug("No available version for package #{@resource[:name]} is included in range #{should_range}")
|
110
110
|
should_range
|
@@ -154,20 +154,25 @@ Puppet::Type.type(:package).provide :nim, :parent => :aix, :source => :aix do
|
|
154
154
|
# I spent a lot of time trying to figure out a solution that didn't
|
155
155
|
# require parsing the `nimclient -o showres` output and was unable to
|
156
156
|
# do so.
|
157
|
-
self::HEADER_LINE_REGEX = /^([^\s]+)\s+[^@]+@@(I|R):(\1)\s+[^\s]+$/
|
158
|
-
self::PACKAGE_LINE_REGEX = /^.*@@(I|R):(.*)$/
|
159
|
-
self::RPM_PACKAGE_REGEX = /^(.*)-(.*-\d
|
157
|
+
self::HEADER_LINE_REGEX = /^([^\s]+)\s+[^@]+@@(I|R|S):(\1)\s+[^\s]+$/
|
158
|
+
self::PACKAGE_LINE_REGEX = /^.*@@(I|R|S):(.*)$/
|
159
|
+
self::RPM_PACKAGE_REGEX = /^(.*)-(.*-\d+\w*) \2$/
|
160
160
|
self::INSTALLP_PACKAGE_REGEX = /^(.*) (.*)$/
|
161
161
|
|
162
162
|
# Here is some sample output that shows what the above regexes will be up
|
163
163
|
# against:
|
164
|
-
# FOR AN INSTALLP PACKAGE:
|
164
|
+
# FOR AN INSTALLP(bff) PACKAGE:
|
165
165
|
#
|
166
166
|
# mypackage.foo ALL @@I:mypackage.foo _all_filesets
|
167
|
-
# @ 1.2.3.1 MyPackage Runtime Environment @@I:mypackage.foo 1.2.3.1
|
168
167
|
# + 1.2.3.4 MyPackage Runtime Environment @@I:mypackage.foo 1.2.3.4
|
169
168
|
# + 1.2.3.8 MyPackage Runtime Environment @@I:mypackage.foo 1.2.3.8
|
170
169
|
#
|
170
|
+
# FOR AN INSTALLP(bff) PACKAGE with security update:
|
171
|
+
#
|
172
|
+
# bos.net ALL @@S:bos.net _all_filesets
|
173
|
+
# + 7.2.0.1 TCP/IP ntp Applications @@S:bos.net.tcp.ntp 7.2.0.1
|
174
|
+
# + 7.2.0.2 TCP/IP ntp Applications @@S:bos.net.tcp.ntp 7.2.0.2
|
175
|
+
#
|
171
176
|
# FOR AN RPM PACKAGE:
|
172
177
|
#
|
173
178
|
# mypackage.foo ALL @@R:mypackage.foo _all_filesets
|
@@ -243,7 +248,7 @@ Puppet::Type.type(:package).provide :nim, :parent => :aix, :source => :aix do
|
|
243
248
|
package_string = match.captures[1]
|
244
249
|
|
245
250
|
case package_type_flag
|
246
|
-
when "I"
|
251
|
+
when "I","S"
|
247
252
|
parse_installp_package_string(package_string)
|
248
253
|
when "R"
|
249
254
|
parse_rpm_package_string(package_string)
|
@@ -203,17 +203,17 @@ defaultfor :osfamily => :redhat, :operatingsystemmajrelease => (4..7).to_a
|
|
203
203
|
Puppet.debug("Cannot parse #{should} as a RPM version range")
|
204
204
|
return should
|
205
205
|
end
|
206
|
-
|
206
|
+
versions = []
|
207
207
|
available_versions(@resource[:name]).each do |version|
|
208
208
|
begin
|
209
209
|
rpm_version = RPM_VERSION.parse(version)
|
210
|
-
|
210
|
+
versions << rpm_version if should_range.include?(rpm_version)
|
211
211
|
rescue RPM_VERSION::ValidationFailure
|
212
212
|
Puppet.debug("Cannot parse #{version} as a RPM version")
|
213
213
|
end
|
214
214
|
end
|
215
215
|
|
216
|
-
version =
|
216
|
+
version = versions.sort.last if versions.any?
|
217
217
|
|
218
218
|
if version
|
219
219
|
version = version.to_s.sub(/^\d+:/, '')
|
@@ -63,7 +63,7 @@ Puppet::Type.type(:package).provide :zypper, :parent => :rpm, :source => :rpm do
|
|
63
63
|
return should
|
64
64
|
end
|
65
65
|
|
66
|
-
|
66
|
+
versions = []
|
67
67
|
|
68
68
|
output = zypper('search', '--match-exact', '--type', 'package', '--uninstalled-only', '-s', @resource[:name])
|
69
69
|
output.lines.each do |line|
|
@@ -72,13 +72,13 @@ Puppet::Type.type(:package).provide :zypper, :parent => :rpm, :source => :rpm do
|
|
72
72
|
begin
|
73
73
|
rpm_version = Puppet::Util::Package::Version::Rpm.parse(pkg_ver[3])
|
74
74
|
|
75
|
-
|
75
|
+
versions << rpm_version if should_range.include?(rpm_version)
|
76
76
|
rescue Puppet::Util::Package::Version::Rpm::ValidationFailure
|
77
77
|
Puppet.debug("Cannot parse #{pkg_ver[3]} as a RPM version")
|
78
78
|
end
|
79
79
|
end
|
80
80
|
|
81
|
-
return
|
81
|
+
return versions.sort.last if versions.any?
|
82
82
|
|
83
83
|
Puppet.debug("No available version for package #{@resource[:name]} is included in range #{should_range}")
|
84
84
|
should
|
@@ -74,7 +74,7 @@ Puppet::Type.type(:service).provide :freebsd, :parent => :init do
|
|
74
74
|
if Puppet::FileSystem.exist?(filename)
|
75
75
|
s = File.read(filename)
|
76
76
|
if s.gsub!(/^(#{rcvar}(_enable)?)=\"?(YES|NO)\"?/, "\\1=\"#{yesno}\"")
|
77
|
-
|
77
|
+
Puppet::FileSystem.replace_file(filename) { |f| f << s }
|
78
78
|
self.debug("Replaced in #{filename}")
|
79
79
|
success = true
|
80
80
|
end
|
@@ -164,10 +164,15 @@ Puppet::Type.type(:service).provide :systemd, :parent => :base do
|
|
164
164
|
end
|
165
165
|
|
166
166
|
def mask
|
167
|
-
|
167
|
+
disable if exist?
|
168
168
|
systemctl_change_enable(:mask)
|
169
169
|
end
|
170
170
|
|
171
|
+
def exist?
|
172
|
+
result = execute([command(:systemctl), 'cat', '--', @resource[:name]], :failonfail => false)
|
173
|
+
result.exitstatus == 0
|
174
|
+
end
|
175
|
+
|
171
176
|
def unmask
|
172
177
|
systemctl_change_enable(:unmask)
|
173
178
|
end
|
@@ -435,7 +435,7 @@ Puppet::Type.type(:user).provide :directoryservice do
|
|
435
435
|
['home', 'uid', 'gid', 'comment', 'shell'].each do |setter_method|
|
436
436
|
define_method("#{setter_method}=") do |value|
|
437
437
|
if @property_hash[setter_method.intern]
|
438
|
-
if
|
438
|
+
if %w(home uid).include?(setter_method)
|
439
439
|
raise Puppet::Error, "OS X version #{self.class.get_os_version} does not allow changing #{setter_method} using puppet"
|
440
440
|
end
|
441
441
|
begin
|
@@ -536,6 +536,14 @@ Puppet::Type.type(:user).provide :directoryservice do
|
|
536
536
|
if (shadow_hash_data.class == Hash) && (shadow_hash_data.has_key?('SALTED-SHA512'))
|
537
537
|
shadow_hash_data.delete('SALTED-SHA512')
|
538
538
|
end
|
539
|
+
|
540
|
+
# Starting with macOS 11 Big Sur, the AuthenticationAuthority field
|
541
|
+
# could be missing entirely and without it the managed user cannot log in
|
542
|
+
if needs_sha512_pbkdf2_authentication_authority_to_be_added?(users_plist)
|
543
|
+
Puppet.debug("Adding 'SALTED-SHA512-PBKDF2' AuthenticationAuthority key for ShadowHash to user '#{@resource.name}'")
|
544
|
+
merge_attribute_with_dscl('Users', @resource.name, 'AuthenticationAuthority', ERB::Util.html_escape(SHA512_PBKDF2_AUTHENTICATION_AUTHORITY))
|
545
|
+
end
|
546
|
+
|
539
547
|
set_salted_pbkdf2(users_plist, shadow_hash_data, 'entropy', value)
|
540
548
|
end
|
541
549
|
end
|
@@ -562,6 +570,17 @@ Puppet::Type.type(:user).provide :directoryservice do
|
|
562
570
|
end
|
563
571
|
end
|
564
572
|
|
573
|
+
# This method will check if authentication_authority key of a user's plist
|
574
|
+
# needs SALTED_SHA512_PBKDF2 to be added. This is a valid case for macOS 11 (Big Sur)
|
575
|
+
# where users created with `dscl` started to have this field missing
|
576
|
+
def needs_sha512_pbkdf2_authentication_authority_to_be_added?(users_plist)
|
577
|
+
authority = users_plist['authentication_authority']
|
578
|
+
return false if Puppet::Util::Package.versioncmp(self.class.get_os_version, '11.0.0') < 0 && authority && authority.include?(SHA512_PBKDF2_AUTHENTICATION_AUTHORITY)
|
579
|
+
|
580
|
+
Puppet.debug("User '#{@resource.name}' is missing the 'SALTED-SHA512-PBKDF2' AuthenticationAuthority key for ShadowHash")
|
581
|
+
true
|
582
|
+
end
|
583
|
+
|
565
584
|
# This method will embed the binary plist data comprising the user's
|
566
585
|
# password hash (and Salt/Iterations value if the OS is 10.8 or greater)
|
567
586
|
# into the ShadowHashData key of the user's plist.
|
@@ -572,11 +591,7 @@ Puppet::Type.type(:user).provide :directoryservice do
|
|
572
591
|
else
|
573
592
|
users_plist['ShadowHashData'] = [binary_plist]
|
574
593
|
end
|
575
|
-
|
576
|
-
write_users_plist_to_disk(users_plist)
|
577
|
-
else
|
578
|
-
write_and_import_shadow_hash_data(users_plist['ShadowHashData'].first)
|
579
|
-
end
|
594
|
+
write_and_import_shadow_hash_data(users_plist['ShadowHashData'].first)
|
580
595
|
end
|
581
596
|
|
582
597
|
# This method writes the ShadowHashData plist in a temporary file,
|
@@ -652,9 +667,7 @@ Puppet::Type.type(:user).provide :directoryservice do
|
|
652
667
|
set_shadow_hash_data(users_plist, binary_plist)
|
653
668
|
end
|
654
669
|
|
655
|
-
|
656
|
-
|
657
|
-
|
658
|
-
Puppet::Util::Plist.write_plist_file(users_plist, "#{users_plist_dir}/#{@resource.name}.plist", :binary)
|
659
|
-
end
|
670
|
+
private
|
671
|
+
|
672
|
+
SHA512_PBKDF2_AUTHENTICATION_AUTHORITY = ';ShadowHash;HASHLIST:<SALTED-SHA512-PBKDF2,SRP-RFC5054-4096-SHA512-PBKDF2>'
|
660
673
|
end
|
@@ -137,7 +137,7 @@ class Puppet::Transaction::AdditionalResourceGenerator
|
|
137
137
|
else
|
138
138
|
@catalog.add_resource_after(parent_resource, res)
|
139
139
|
end
|
140
|
-
@catalog.add_edge(@catalog.container_of(parent_resource), res)
|
140
|
+
@catalog.add_edge(@catalog.container_of(parent_resource), res) if @catalog.container_of(parent_resource)
|
141
141
|
if @relationship_graph && priority
|
142
142
|
# If we have a relationship_graph we should add the resource
|
143
143
|
# to it (this is an eval_generate). If we don't, then the
|
data/lib/puppet/type/service.rb
CHANGED
@@ -38,6 +38,12 @@ module Puppet
|
|
38
38
|
feature :enableable, "The provider can enable and disable the service.",
|
39
39
|
:methods => [:disable, :enable, :enabled?]
|
40
40
|
|
41
|
+
feature :delayed_startable, "The provider can set service to delayed start",
|
42
|
+
:methods => [:delayed_start]
|
43
|
+
|
44
|
+
feature :manual_startable, "The provider can set service to manual start",
|
45
|
+
:methods => [:manual_start]
|
46
|
+
|
41
47
|
feature :controllable, "The provider uses a control variable."
|
42
48
|
|
43
49
|
feature :flaggable, "The provider can pass flags to the service."
|
@@ -67,7 +73,7 @@ module Puppet
|
|
67
73
|
provider.disable
|
68
74
|
end
|
69
75
|
|
70
|
-
newvalue(:manual, :event => :service_manual_start) do
|
76
|
+
newvalue(:manual, :event => :service_manual_start, :required_features => :manual_startable) do
|
71
77
|
provider.manual_start
|
72
78
|
end
|
73
79
|
|
@@ -81,8 +87,7 @@ module Puppet
|
|
81
87
|
provider.enabled?
|
82
88
|
end
|
83
89
|
|
84
|
-
|
85
|
-
newvalue(:delayed, :event => :service_delayed_start) do
|
90
|
+
newvalue(:delayed, :event => :service_delayed_start, :required_features => :delayed_startable) do
|
86
91
|
provider.delayed_start
|
87
92
|
end
|
88
93
|
|
@@ -90,12 +95,6 @@ module Puppet
|
|
90
95
|
return provider.enabled_insync?(current) if provider.respond_to?(:enabled_insync?)
|
91
96
|
super(current)
|
92
97
|
end
|
93
|
-
|
94
|
-
validate do |value|
|
95
|
-
if (value == :manual || value == :delayed) && !Puppet::Util::Platform.windows?
|
96
|
-
raise Puppet::Error.new(_("Setting enable to %{value} is only supported on Microsoft Windows.") % { value: value.to_s} )
|
97
|
-
end
|
98
|
-
end
|
99
98
|
end
|
100
99
|
|
101
100
|
# Handle whether the service should actually be running right now.
|
data/lib/puppet/type/user.rb
CHANGED
@@ -67,6 +67,7 @@ module Puppet
|
|
67
67
|
newproperty(:ensure, :parent => Puppet::Property::Ensure) do
|
68
68
|
newvalue(:present, :event => :user_created) do
|
69
69
|
provider.create
|
70
|
+
@resource.generate
|
70
71
|
end
|
71
72
|
|
72
73
|
newvalue(:absent, :event => :user_removed) do
|
@@ -695,6 +696,7 @@ module Puppet
|
|
695
696
|
|
696
697
|
def generate
|
697
698
|
if !self[:purge_ssh_keys].empty?
|
699
|
+
return [] if self[:ensure] == :present && !provider.exists?
|
698
700
|
if Puppet::Type.type(:ssh_authorized_key).nil?
|
699
701
|
warning _("Ssh_authorized_key type is not available. Cannot purge SSH keys.")
|
700
702
|
else
|
@@ -743,25 +745,6 @@ module Puppet
|
|
743
745
|
end
|
744
746
|
raise ArgumentError, _("purge_ssh_keys must be true, false, or an array of file names, not %{value}") % { value: value.inspect }
|
745
747
|
end
|
746
|
-
|
747
|
-
munge do |value|
|
748
|
-
# Resolve string, boolean and symbol forms of true and false to a
|
749
|
-
# single representation.
|
750
|
-
test_sym = value.to_s.intern
|
751
|
-
value = test_sym if [:true, :false].include? test_sym
|
752
|
-
|
753
|
-
return [] if value == :false
|
754
|
-
home = resource[:home] || Dir.home(resource[:name])
|
755
|
-
|
756
|
-
return [ "#{home}/.ssh/authorized_keys" ] if value == :true
|
757
|
-
# value is an array - munge each value
|
758
|
-
[ value ].flatten.map do |entry|
|
759
|
-
# make sure frozen value is duplicated by using a gsub, second mutating gsub! is then ok
|
760
|
-
entry = entry.gsub(/^~\//, "#{home}/")
|
761
|
-
entry.gsub!(/^%h\//, "#{home}/")
|
762
|
-
entry
|
763
|
-
end
|
764
|
-
end
|
765
748
|
end
|
766
749
|
|
767
750
|
newproperty(:loginclass, :required_features => :manages_loginclass) do
|
@@ -783,7 +766,7 @@ module Puppet
|
|
783
766
|
# @see generate
|
784
767
|
# @api private
|
785
768
|
def find_unmanaged_keys
|
786
|
-
|
769
|
+
munged_unmanaged_keys.
|
787
770
|
select { |f| File.readable?(f) }.
|
788
771
|
map { |f| unknown_keys_in_file(f) }.
|
789
772
|
flatten.each do |res|
|
@@ -795,6 +778,41 @@ module Puppet
|
|
795
778
|
end
|
796
779
|
end
|
797
780
|
|
781
|
+
def munged_unmanaged_keys
|
782
|
+
value = self[:purge_ssh_keys]
|
783
|
+
|
784
|
+
# Resolve string, boolean and symbol forms of true and false to a
|
785
|
+
# single representation.
|
786
|
+
test_sym = value.to_s.intern
|
787
|
+
value = test_sym if [:true, :false].include? test_sym
|
788
|
+
|
789
|
+
return [] if value == :false
|
790
|
+
|
791
|
+
home = self[:home]
|
792
|
+
begin
|
793
|
+
home ||= provider.home
|
794
|
+
rescue
|
795
|
+
Puppet.debug("User '#{self[:name]}' does not exist")
|
796
|
+
end
|
797
|
+
|
798
|
+
if home.to_s.empty? || !Dir.exist?(home.to_s)
|
799
|
+
if value == :true || [ value ].flatten.any? { |v| v.start_with?('~/', '%h/') }
|
800
|
+
Puppet.debug("User '#{self[:name]}' has no home directory set to purge ssh keys from.")
|
801
|
+
return []
|
802
|
+
end
|
803
|
+
end
|
804
|
+
|
805
|
+
return [ "#{home}/.ssh/authorized_keys" ] if value == :true
|
806
|
+
|
807
|
+
# value is an array - munge each value
|
808
|
+
[ value ].flatten.map do |entry|
|
809
|
+
# make sure frozen value is duplicated by using a gsub, second mutating gsub! is then ok
|
810
|
+
entry = entry.gsub(/^~\//, "#{home}/")
|
811
|
+
entry.gsub!(/^%h\//, "#{home}/")
|
812
|
+
entry
|
813
|
+
end
|
814
|
+
end
|
815
|
+
|
798
816
|
# Parse an ssh authorized keys file superficially, extract the comments
|
799
817
|
# on the keys. These are considered names of possible ssh_authorized_keys
|
800
818
|
# resources. Keys that are managed by the present catalog are ignored.
|