puppet 6.6.0-x86-mingw32 → 6.7.0-x86-mingw32
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/Gemfile.lock +8 -8
- data/ext/solaris/smf/puppet.xml +2 -0
- data/ext/yaml_nodes.rb +7 -7
- data/lib/hiera_puppet.rb +2 -1
- data/lib/puppet/application/apply.rb +2 -3
- data/lib/puppet/application/doc.rb +2 -1
- data/lib/puppet/application/face_base.rb +22 -15
- data/lib/puppet/application/script.rb +4 -6
- data/lib/puppet/configurer.rb +10 -5
- data/lib/puppet/confine_collection.rb +2 -1
- data/lib/puppet/daemon.rb +3 -2
- data/lib/puppet/defaults.rb +8 -0
- data/lib/puppet/environments.rb +9 -7
- data/lib/puppet/etc.rb +1 -1
- data/lib/puppet/external/pson/pure/parser.rb +2 -1
- data/lib/puppet/face/epp.rb +4 -2
- data/lib/puppet/face/help.rb +3 -2
- data/lib/puppet/face/module/changes.rb +2 -1
- data/lib/puppet/file_bucket/dipper.rb +2 -1
- data/lib/puppet/file_serving/configuration.rb +2 -1
- data/lib/puppet/file_serving/fileset.rb +1 -1
- data/lib/puppet/file_serving/http_metadata.rb +4 -2
- data/lib/puppet/file_serving/metadata.rb +2 -1
- data/lib/puppet/file_serving/mount/file.rb +2 -1
- data/lib/puppet/file_serving/mount/locales.rb +2 -1
- data/lib/puppet/file_serving/mount/modules.rb +4 -2
- data/lib/puppet/file_serving/mount/pluginfacts.rb +2 -1
- data/lib/puppet/file_serving/mount/plugins.rb +2 -1
- data/lib/puppet/file_serving/mount/tasks.rb +4 -2
- data/lib/puppet/file_system/uniquefile.rb +4 -2
- data/lib/puppet/functions/match.rb +2 -3
- data/lib/puppet/generate/type.rb +2 -1
- data/lib/puppet/graph/relationship_graph.rb +2 -1
- data/lib/puppet/graph/simple_graph.rb +3 -2
- data/lib/puppet/indirector/catalog/compiler.rb +16 -8
- data/lib/puppet/indirector/certificate/rest.rb +2 -1
- data/lib/puppet/indirector/face.rb +2 -2
- data/lib/puppet/indirector/file_server.rb +4 -2
- data/lib/puppet/indirector/indirection.rb +12 -6
- data/lib/puppet/indirector/node/exec.rb +2 -1
- data/lib/puppet/indirector/report/processor.rb +2 -1
- data/lib/puppet/indirector/request.rb +9 -5
- data/lib/puppet/indirector/ssl_file.rb +10 -8
- data/lib/puppet/indirector/terminus.rb +6 -3
- data/lib/puppet/info_service.rb +9 -0
- data/lib/puppet/info_service/plan_information_service.rb +36 -0
- data/lib/puppet/interface.rb +2 -1
- data/lib/puppet/interface/action.rb +10 -5
- data/lib/puppet/interface/action_manager.rb +2 -1
- data/lib/puppet/interface/documentation.rb +10 -7
- data/lib/puppet/interface/face_collection.rb +6 -3
- data/lib/puppet/interface/option.rb +4 -2
- data/lib/puppet/interface/option_manager.rb +4 -2
- data/lib/puppet/module.rb +35 -1
- data/lib/puppet/module/plan.rb +160 -0
- data/lib/puppet/module_tool.rb +2 -1
- data/lib/puppet/module_tool/applications/application.rb +2 -1
- data/lib/puppet/module_tool/applications/installer.rb +4 -2
- data/lib/puppet/module_tool/applications/upgrader.rb +4 -2
- data/lib/puppet/module_tool/contents_description.rb +2 -1
- data/lib/puppet/module_tool/metadata.rb +2 -3
- data/lib/puppet/module_tool/shared_behaviors.rb +2 -1
- data/lib/puppet/network/authconfig.rb +4 -2
- data/lib/puppet/network/authstore.rb +2 -1
- data/lib/puppet/network/formats.rb +2 -1
- data/lib/puppet/network/http/api/indirected_routes.rb +6 -4
- data/lib/puppet/network/http/handler.rb +2 -1
- data/lib/puppet/network/http/request.rb +2 -1
- data/lib/puppet/network/http/route.rb +2 -1
- data/lib/puppet/network/resolver.rb +3 -2
- data/lib/puppet/network/rights.rb +2 -1
- data/lib/puppet/node.rb +8 -4
- data/lib/puppet/pal/catalog_compiler.rb +8 -1
- data/lib/puppet/pal/compiler.rb +2 -1
- data/lib/puppet/pal/pal_impl.rb +8 -0
- data/lib/puppet/pal/script_compiler.rb +4 -2
- data/lib/puppet/parameter.rb +4 -2
- data/lib/puppet/parameter/value_collection.rb +8 -8
- data/lib/puppet/parser/ast/pops_bridge.rb +2 -1
- data/lib/puppet/parser/compiler.rb +10 -5
- data/lib/puppet/parser/files.rb +2 -1
- data/lib/puppet/parser/functions.rb +2 -1
- data/lib/puppet/parser/relationship.rb +2 -1
- data/lib/puppet/parser/resource.rb +6 -3
- data/lib/puppet/parser/scope.rb +6 -4
- data/lib/puppet/parser/templatewrapper.rb +2 -1
- data/lib/puppet/parser/type_loader.rb +2 -1
- data/lib/puppet/pops/adaptable.rb +2 -5
- data/lib/puppet/pops/evaluator/collectors/exported_collector.rb +2 -1
- data/lib/puppet/pops/evaluator/collectors/fixed_set_collector.rb +2 -1
- data/lib/puppet/pops/evaluator/runtime3_resource_support.rb +2 -1
- data/lib/puppet/pops/evaluator/runtime3_support.rb +8 -4
- data/lib/puppet/pops/loader/base_loader.rb +4 -2
- data/lib/puppet/pops/loader/dependency_loader.rb +4 -2
- data/lib/puppet/pops/loader/gem_support.rb +4 -2
- data/lib/puppet/pops/loader/loader.rb +4 -2
- data/lib/puppet/pops/loader/loader_paths.rb +2 -1
- data/lib/puppet/pops/loader/static_loader.rb +1 -1
- data/lib/puppet/pops/lookup/interpolation.rb +2 -1
- data/lib/puppet/pops/model/factory.rb +4 -2
- data/lib/puppet/pops/parser/epp_support.rb +2 -1
- data/lib/puppet/pops/parser/heredoc_support.rb +2 -1
- data/lib/puppet/pops/parser/interpolation_support.rb +10 -5
- data/lib/puppet/pops/parser/lexer2.rb +6 -3
- data/lib/puppet/pops/parser/locator.rb +2 -1
- data/lib/puppet/pops/types/type_calculator.rb +1 -1
- data/lib/puppet/pops/types/type_parser.rb +4 -2
- data/lib/puppet/pops/validation.rb +2 -1
- data/lib/puppet/pops/validation/checker4_0.rb +6 -3
- data/lib/puppet/pops/visitor.rb +12 -6
- data/lib/puppet/property.rb +19 -16
- data/lib/puppet/property/ensure.rb +2 -1
- data/lib/puppet/property/keyvalue.rb +2 -1
- data/lib/puppet/property/list.rb +2 -1
- data/lib/puppet/provider.rb +10 -8
- data/lib/puppet/provider/exec.rb +7 -4
- data/lib/puppet/provider/file/posix.rb +6 -3
- data/lib/puppet/provider/group/groupadd.rb +2 -1
- data/lib/puppet/provider/group/ldap.rb +7 -4
- data/lib/puppet/provider/group/pw.rb +4 -2
- data/lib/puppet/provider/ldap.rb +8 -4
- data/lib/puppet/provider/nameservice.rb +8 -5
- data/lib/puppet/provider/nameservice/directoryservice.rb +8 -4
- data/lib/puppet/provider/network_device.rb +4 -2
- data/lib/puppet/provider/package.rb +2 -1
- data/lib/puppet/provider/package/aix.rb +4 -2
- data/lib/puppet/provider/package/appdmg.rb +4 -2
- data/lib/puppet/provider/package/apple.rb +2 -1
- data/lib/puppet/provider/package/apt.rb +4 -2
- data/lib/puppet/provider/package/blastwave.rb +2 -1
- data/lib/puppet/provider/package/dpkg.rb +6 -3
- data/lib/puppet/provider/package/fink.rb +2 -1
- data/lib/puppet/provider/package/gem.rb +4 -2
- data/lib/puppet/provider/package/macports.rb +6 -3
- data/lib/puppet/provider/package/nim.rb +8 -4
- data/lib/puppet/provider/package/openbsd.rb +14 -8
- data/lib/puppet/provider/package/opkg.rb +2 -1
- data/lib/puppet/provider/package/pacman.rb +2 -1
- data/lib/puppet/provider/package/pip.rb +2 -1
- data/lib/puppet/provider/package/pkgdmg.rb +4 -2
- data/lib/puppet/provider/package/pkgng.rb +4 -2
- data/lib/puppet/provider/package/pkgutil.rb +2 -1
- data/lib/puppet/provider/package/portupgrade.rb +2 -1
- data/lib/puppet/provider/package/rpm.rb +8 -4
- data/lib/puppet/provider/package/windows/package.rb +2 -1
- data/lib/puppet/provider/parsedfile.rb +14 -7
- data/lib/puppet/provider/service/base.rb +7 -4
- data/lib/puppet/provider/service/launchd.rb +4 -2
- data/lib/puppet/provider/service/service.rb +2 -1
- data/lib/puppet/provider/service/upstart.rb +11 -8
- data/lib/puppet/provider/user/directoryservice.rb +2 -1
- data/lib/puppet/provider/user/hpux.rb +1 -1
- data/lib/puppet/provider/user/ldap.rb +8 -4
- data/lib/puppet/provider/user/openbsd.rb +2 -1
- data/lib/puppet/provider/user/pw.rb +2 -1
- data/lib/puppet/provider/user/user_role_add.rb +4 -2
- data/lib/puppet/provider/user/useradd.rb +7 -4
- data/lib/puppet/reference/providers.rb +2 -3
- data/lib/puppet/reference/type.rb +4 -2
- data/lib/puppet/relationship.rb +4 -9
- data/lib/puppet/resource.rb +16 -9
- data/lib/puppet/resource/capability_finder.rb +12 -8
- data/lib/puppet/resource/catalog.rb +36 -40
- data/lib/puppet/resource/type.rb +7 -3
- data/lib/puppet/resource/type_collection.rb +4 -2
- data/lib/puppet/settings.rb +36 -19
- data/lib/puppet/settings/base_setting.rb +2 -1
- data/lib/puppet/settings/config_file.rb +2 -1
- data/lib/puppet/settings/file_setting.rb +2 -1
- data/lib/puppet/settings/ini_file.rb +2 -1
- data/lib/puppet/ssl/base.rb +2 -1
- data/lib/puppet/ssl/host.rb +16 -8
- data/lib/puppet/ssl/key.rb +2 -2
- data/lib/puppet/ssl/state_machine.rb +22 -3
- data/lib/puppet/transaction/event.rb +2 -1
- data/lib/puppet/transaction/event_manager.rb +4 -2
- data/lib/puppet/transaction/report.rb +10 -10
- data/lib/puppet/transaction/resource_harness.rb +4 -2
- data/lib/puppet/type.rb +84 -48
- data/lib/puppet/type/component.rb +2 -1
- data/lib/puppet/type/exec.rb +11 -7
- data/lib/puppet/type/file.rb +15 -9
- data/lib/puppet/type/file/content.rb +7 -3
- data/lib/puppet/type/file/ctime.rb +2 -1
- data/lib/puppet/type/file/data_sync.rb +2 -1
- data/lib/puppet/type/file/ensure.rb +10 -7
- data/lib/puppet/type/file/mode.rb +2 -1
- data/lib/puppet/type/file/mtime.rb +2 -1
- data/lib/puppet/type/file/selcontext.rb +2 -1
- data/lib/puppet/type/file/source.rb +6 -7
- data/lib/puppet/type/file/target.rb +2 -1
- data/lib/puppet/type/file/type.rb +2 -1
- data/lib/puppet/type/package.rb +6 -3
- data/lib/puppet/type/resources.rb +2 -1
- data/lib/puppet/type/service.rb +2 -1
- data/lib/puppet/type/tidy.rb +14 -7
- data/lib/puppet/type/user.rb +19 -7
- data/lib/puppet/util.rb +6 -3
- data/lib/puppet/util/checksums.rb +1 -1
- data/lib/puppet/util/classgen.rb +12 -6
- data/lib/puppet/util/command_line.rb +8 -4
- data/lib/puppet/util/connection.rb +4 -2
- data/lib/puppet/util/diff.rb +4 -2
- data/lib/puppet/util/execution.rb +4 -2
- data/lib/puppet/util/feature.rb +7 -4
- data/lib/puppet/util/fileparsing.rb +57 -46
- data/lib/puppet/util/filetype.rb +2 -1
- data/lib/puppet/util/http_proxy.rb +2 -1
- data/lib/puppet/util/instance_loader.rb +2 -1
- data/lib/puppet/util/ldap/connection.rb +4 -2
- data/lib/puppet/util/ldap/manager.rb +6 -3
- data/lib/puppet/util/log.rb +6 -3
- data/lib/puppet/util/metric.rb +2 -1
- data/lib/puppet/util/posix.rb +4 -2
- data/lib/puppet/util/rdoc/code_objects.rb +2 -1
- data/lib/puppet/util/rdoc/generators/puppet_generator.rb +4 -2
- data/lib/puppet/util/selinux.rb +2 -1
- data/lib/puppet/version.rb +2 -5
- data/locales/puppet.pot +713 -685
- data/man/man5/puppet.conf.5 +9 -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-key.8 +1 -1
- data/man/man8/puppet-lookup.8 +1 -1
- data/man/man8/puppet-man.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-status.8 +1 -1
- data/man/man8/puppet.8 +2 -2
- data/spec/lib/puppet_spec/modules.rb +16 -2
- data/spec/unit/indirector/request_spec.rb +5 -6
- data/spec/unit/info_service_spec.rb +48 -0
- data/spec/unit/module_spec.rb +73 -0
- data/spec/unit/plan_spec.rb +65 -0
- data/spec/unit/puppet_pal_catalog_spec.rb +12 -0
- data/spec/unit/ssl/state_machine_spec.rb +68 -5
- metadata +6 -2
data/lib/puppet/resource/type.rb
CHANGED
@@ -89,7 +89,8 @@ class Puppet::Resource::Type
|
|
89
89
|
produced_resource.resource_type.parameters.each do |name|
|
90
90
|
next if name == :name
|
91
91
|
|
92
|
-
|
92
|
+
expr = blueprint[:mappings][name.to_s]
|
93
|
+
if expr
|
93
94
|
produced_resource[name] = expr.safeevaluate(scope)
|
94
95
|
else
|
95
96
|
produced_resource[name] = scope[name.to_s]
|
@@ -147,7 +148,8 @@ class Puppet::Resource::Type
|
|
147
148
|
set_name_and_namespace(name)
|
148
149
|
|
149
150
|
[:code, :doc, :line, :file, :parent].each do |param|
|
150
|
-
|
151
|
+
value = options[param]
|
152
|
+
next unless value
|
151
153
|
send(param.to_s + '=', value)
|
152
154
|
end
|
153
155
|
|
@@ -453,7 +455,9 @@ class Puppet::Resource::Type
|
|
453
455
|
end
|
454
456
|
|
455
457
|
def evaluate_parent_type(resource)
|
456
|
-
|
458
|
+
klass = parent_type(resource.scope)
|
459
|
+
parent_resource = resource.scope.compiler.catalog.resource(:class, klass.name) || resource.scope.compiler.catalog.resource(:node, klass.name) if klass
|
460
|
+
return unless klass && parent_resource
|
457
461
|
parent_resource.evaluate unless parent_resource.evaluated?
|
458
462
|
parent_scope(resource.scope, klass)
|
459
463
|
end
|
@@ -124,7 +124,8 @@ class Puppet::Resource::TypeCollection
|
|
124
124
|
def node(name)
|
125
125
|
name = munge_name(name)
|
126
126
|
|
127
|
-
|
127
|
+
node = @nodes[name]
|
128
|
+
if node
|
128
129
|
return node
|
129
130
|
end
|
130
131
|
|
@@ -250,7 +251,8 @@ class Puppet::Resource::TypeCollection
|
|
250
251
|
end
|
251
252
|
|
252
253
|
def dupe_check(instance, hash)
|
253
|
-
|
254
|
+
dupe = hash[instance.name]
|
255
|
+
return unless dupe
|
254
256
|
message = yield dupe
|
255
257
|
instance.fail Puppet::ParseError, message
|
256
258
|
end
|
data/lib/puppet/settings.rb
CHANGED
@@ -298,7 +298,7 @@ class Puppet::Settings
|
|
298
298
|
|
299
299
|
# remove run_mode options from the arguments so that later parses don't think
|
300
300
|
# it is an unknown option.
|
301
|
-
while option_index = args.index('--run_mode') do
|
301
|
+
while option_index = args.index('--run_mode') do #rubocop:disable Lint/AssignmentInCondition
|
302
302
|
args.delete_at option_index
|
303
303
|
args.delete_at option_index
|
304
304
|
end
|
@@ -380,7 +380,8 @@ class Puppet::Settings
|
|
380
380
|
|
381
381
|
# Return a value's description.
|
382
382
|
def description(name)
|
383
|
-
|
383
|
+
obj = @config[name.to_sym]
|
384
|
+
if obj
|
384
385
|
obj.desc
|
385
386
|
else
|
386
387
|
nil
|
@@ -436,7 +437,8 @@ class Puppet::Settings
|
|
436
437
|
end
|
437
438
|
end
|
438
439
|
|
439
|
-
|
440
|
+
s = @config[str]
|
441
|
+
if s
|
440
442
|
@deprecated_settings_that_have_been_configured << s if s.completely_deprecated?
|
441
443
|
end
|
442
444
|
|
@@ -651,7 +653,8 @@ class Puppet::Settings
|
|
651
653
|
# and I'm too lazy to only set the metadata once.
|
652
654
|
if @configuration_file
|
653
655
|
searchpath(nil, preferred_run_mode).reverse_each do |source|
|
654
|
-
|
656
|
+
section = @configuration_file.sections[source.name] if source.type == :section
|
657
|
+
if section
|
655
658
|
apply_metadata_from_section(section)
|
656
659
|
end
|
657
660
|
end
|
@@ -661,7 +664,8 @@ class Puppet::Settings
|
|
661
664
|
|
662
665
|
def apply_metadata_from_section(section)
|
663
666
|
section.settings.each do |setting|
|
664
|
-
|
667
|
+
type = @config[setting.name] if setting.has_metadata?
|
668
|
+
if type
|
665
669
|
type.set_meta(setting.meta)
|
666
670
|
end
|
667
671
|
end
|
@@ -695,8 +699,10 @@ class Puppet::Settings
|
|
695
699
|
klass = nil
|
696
700
|
hash[:section] = hash[:section].to_sym if hash[:section]
|
697
701
|
|
698
|
-
|
699
|
-
|
702
|
+
type = hash[:type]
|
703
|
+
if type
|
704
|
+
klass = SETTING_TYPES[type]
|
705
|
+
unless klass
|
700
706
|
raise ArgumentError, _("Invalid setting type '%{type}'") % { type: type }
|
701
707
|
end
|
702
708
|
hash.delete(:type)
|
@@ -728,7 +734,8 @@ class Puppet::Settings
|
|
728
734
|
# Reparse our config file, if necessary.
|
729
735
|
def reparse_config_files
|
730
736
|
if files
|
731
|
-
|
737
|
+
filename = any_files_changed?
|
738
|
+
if filename
|
732
739
|
Puppet.notice "Config file #{filename} changed; triggering re-parse of all config files."
|
733
740
|
parse_config_files
|
734
741
|
reuse
|
@@ -835,7 +842,8 @@ class Puppet::Settings
|
|
835
842
|
when :values
|
836
843
|
@value_sets[source.name]
|
837
844
|
when :section
|
838
|
-
|
845
|
+
section = @configuration_file.sections[source.name] if @configuration_file
|
846
|
+
if section
|
839
847
|
ValuesFromSection.new(source.name, section)
|
840
848
|
end
|
841
849
|
when :environment
|
@@ -850,7 +858,8 @@ class Puppet::Settings
|
|
850
858
|
def set_by_config?(param, environment = nil, run_mode = preferred_run_mode)
|
851
859
|
param = param.to_sym
|
852
860
|
configsearchpath(environment, run_mode).any? do |source|
|
853
|
-
|
861
|
+
vals = searchpath_values(source)
|
862
|
+
if vals
|
854
863
|
vals.lookup(param)
|
855
864
|
end
|
856
865
|
end
|
@@ -910,8 +919,10 @@ class Puppet::Settings
|
|
910
919
|
hash[:section] = section
|
911
920
|
raise ArgumentError, _("Setting %{name} is already defined") % { name: name } if @config.include?(name)
|
912
921
|
tryconfig = newsetting(hash)
|
913
|
-
|
914
|
-
|
922
|
+
short = tryconfig.short
|
923
|
+
if short
|
924
|
+
other = @shortnames[short]
|
925
|
+
if other
|
915
926
|
raise ArgumentError, _("Setting %{name} is already using short name '%{short}'") % { name: other.name, short: short }
|
916
927
|
end
|
917
928
|
@shortnames[short] = tryconfig
|
@@ -946,7 +957,8 @@ class Puppet::Settings
|
|
946
957
|
file = @config[key]
|
947
958
|
next if file.value.nil?
|
948
959
|
next unless (sections.nil? or sections.include?(file.section))
|
949
|
-
|
960
|
+
resource = file.to_resource
|
961
|
+
next unless resource
|
950
962
|
next if catalog.resource(resource.ref)
|
951
963
|
|
952
964
|
Puppet.debug {"Using settings: adding file resource '#{key}': '#{resource.inspect}'"}
|
@@ -1147,7 +1159,8 @@ Generated on #{Time.now}.
|
|
1147
1159
|
def record_deprecations_from_puppet_conf(puppet_conf)
|
1148
1160
|
puppet_conf.sections.values.each do |section|
|
1149
1161
|
section.settings.each do |conf_setting|
|
1150
|
-
|
1162
|
+
setting = self.setting(conf_setting.name)
|
1163
|
+
if setting
|
1151
1164
|
@deprecated_settings_that_have_been_configured << setting if setting.deprecated?
|
1152
1165
|
end
|
1153
1166
|
end
|
@@ -1209,12 +1222,14 @@ Generated on #{Time.now}.
|
|
1209
1222
|
next unless setting.respond_to?(:owner)
|
1210
1223
|
next unless sections.nil? or sections.include?(setting.section)
|
1211
1224
|
|
1212
|
-
|
1225
|
+
user = setting.owner
|
1226
|
+
if user && user != "root" && catalog.resource(:user, user).nil?
|
1213
1227
|
resource = Puppet::Resource.new(:user, user, :parameters => {:ensure => :present})
|
1214
1228
|
resource[:gid] = self[:group] if self[:group]
|
1215
1229
|
catalog.add_resource resource
|
1216
1230
|
end
|
1217
|
-
|
1231
|
+
group = setting.group
|
1232
|
+
if group && ! %w{root wheel}.include?(group) && catalog.resource(:group, group).nil?
|
1218
1233
|
catalog.add_resource Puppet::Resource.new(:group, group, :parameters => {:ensure => :present})
|
1219
1234
|
end
|
1220
1235
|
end
|
@@ -1478,9 +1493,11 @@ Generated on #{Time.now}.
|
|
1478
1493
|
end
|
1479
1494
|
|
1480
1495
|
def conf
|
1481
|
-
@conf
|
1482
|
-
|
1483
|
-
|
1496
|
+
unless @conf
|
1497
|
+
environments = Puppet.lookup(:environments) { nil }
|
1498
|
+
@conf = environments.get_conf(@environment_name) if environments
|
1499
|
+
end
|
1500
|
+
@conf
|
1484
1501
|
end
|
1485
1502
|
|
1486
1503
|
def inspect
|
@@ -59,7 +59,8 @@ class Puppet::Settings::BaseSetting
|
|
59
59
|
|
60
60
|
# Create the new element. Pretty much just sets the name.
|
61
61
|
def initialize(args = {})
|
62
|
-
|
62
|
+
@settings = args.delete(:settings)
|
63
|
+
unless @settings
|
63
64
|
raise ArgumentError.new("You must refer to a settings object")
|
64
65
|
end
|
65
66
|
|
@@ -109,7 +109,8 @@ private
|
|
109
109
|
|
110
110
|
# Check to see if this is a file argument and it has extra options
|
111
111
|
begin
|
112
|
-
if value.is_a?(String)
|
112
|
+
options = extract_fileinfo(value) if value.is_a?(String)
|
113
|
+
if options
|
113
114
|
section.with_setting(var, options[:value], Meta.new(options[:owner],
|
114
115
|
options[:group],
|
115
116
|
options[:mode]))
|
@@ -125,7 +125,8 @@ class Puppet::Settings::FileSetting < Puppet::Settings::StringSetting
|
|
125
125
|
|
126
126
|
# Turn our setting thing into a Puppet::Resource instance.
|
127
127
|
def to_resource
|
128
|
-
|
128
|
+
type = self.type
|
129
|
+
return nil unless type
|
129
130
|
|
130
131
|
path = self.value
|
131
132
|
|
@@ -96,7 +96,8 @@ class Puppet::Settings::IniFile
|
|
96
96
|
end
|
97
97
|
|
98
98
|
def set_default_section_write_sectionline(value)
|
99
|
-
|
99
|
+
index = @lines.find_index { |line| line.is_a?(DefaultSection) }
|
100
|
+
if index
|
100
101
|
@lines[index].write_sectionline = true
|
101
102
|
end
|
102
103
|
end
|
data/lib/puppet/ssl/base.rb
CHANGED
@@ -135,7 +135,8 @@ class Puppet::SSL::Base
|
|
135
135
|
/sha\d*/i
|
136
136
|
)
|
137
137
|
ln = content.signature_algorithm
|
138
|
-
|
138
|
+
match = digest_re.match(ln)
|
139
|
+
if match
|
139
140
|
match[0].downcase
|
140
141
|
else
|
141
142
|
raise Puppet::Error, _("Unknown signature algorithm '%{ln}'") % { ln: ln }
|
data/lib/puppet/ssl/host.rb
CHANGED
@@ -179,10 +179,14 @@ ERROR_STRING
|
|
179
179
|
# @return [Puppet::SSL::CertificateRequest, nil]
|
180
180
|
def certificate_request
|
181
181
|
unless @certificate_request
|
182
|
-
|
183
|
-
|
184
|
-
elsif csr = download_csr_from_ca
|
182
|
+
csr = load_certificate_request_from_file
|
183
|
+
if csr
|
185
184
|
@certificate_request = csr
|
185
|
+
else
|
186
|
+
csr = download_csr_from_ca
|
187
|
+
if csr
|
188
|
+
@certificate_request = csr
|
189
|
+
end
|
186
190
|
end
|
187
191
|
end
|
188
192
|
@certificate_request
|
@@ -389,13 +393,17 @@ ERROR_STRING
|
|
389
393
|
# no certificate could be found.
|
390
394
|
# @return [Puppet::SSL::Certificate, nil]
|
391
395
|
def get_host_certificate
|
392
|
-
|
393
|
-
|
394
|
-
elsif cert = download_certificate_from_ca(name)
|
395
|
-
save_host_certificate(cert)
|
396
|
+
cert = check_for_certificate_on_disk(name)
|
397
|
+
if cert
|
396
398
|
return cert
|
397
399
|
else
|
398
|
-
|
400
|
+
cert = download_certificate_from_ca(name)
|
401
|
+
if cert
|
402
|
+
save_host_certificate(cert)
|
403
|
+
return cert
|
404
|
+
else
|
405
|
+
return nil
|
406
|
+
end
|
399
407
|
end
|
400
408
|
end
|
401
409
|
|
data/lib/puppet/ssl/key.rb
CHANGED
@@ -45,6 +45,18 @@ class Puppet::SSL::StateMachine
|
|
45
45
|
next_ctx = @ssl_provider.create_root_context(cacerts: cacerts, revocation: false)
|
46
46
|
else
|
47
47
|
pem = Puppet::Rest::Routes.get_certificate(Puppet::SSL::CA_NAME, @ssl_context)
|
48
|
+
if @machine.ca_fingerprint
|
49
|
+
actual_digest = Puppet::SSL::Digest.new(@machine.digest, pem).to_hex
|
50
|
+
expected_digest = @machine.ca_fingerprint.scan(/../).join(':').upcase
|
51
|
+
if actual_digest == expected_digest
|
52
|
+
Puppet.info(_("Verified CA bundle with digest (%{digest_type}) %{actual_digest}") %
|
53
|
+
{ digest_type: @machine.digest, actual_digest: actual_digest })
|
54
|
+
else
|
55
|
+
e = Puppet::Error.new(_("CA bundle with digest (%{digest_type}) %{actual_digest} did not match expected digest %{expected_digest}") % { digest_type: @machine.digest, actual_digest: actual_digest, expected_digest: expected_digest })
|
56
|
+
return Error.new(@machine, e.message, e)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
48
60
|
cacerts = @cert_provider.load_cacerts_from_pem(pem)
|
49
61
|
# verify cacerts before saving
|
50
62
|
next_ctx = @ssl_provider.create_root_context(cacerts: cacerts, revocation: false)
|
@@ -292,7 +304,7 @@ class Puppet::SSL::StateMachine
|
|
292
304
|
#
|
293
305
|
class Done < SSLState; end
|
294
306
|
|
295
|
-
attr_reader :waitforcert, :wait_deadline, :cert_provider, :ssl_provider
|
307
|
+
attr_reader :waitforcert, :wait_deadline, :cert_provider, :ssl_provider, :ca_fingerprint, :digest
|
296
308
|
|
297
309
|
# Construct a state machine to manage the SSL initialization process. By
|
298
310
|
# default, if the state machine encounters an exception, it will log the
|
@@ -312,18 +324,25 @@ class Puppet::SSL::StateMachine
|
|
312
324
|
# to load and save X509 objects.
|
313
325
|
# @param ssl_provider [Puppet::SSL::SSLProvider] ssl provider to use
|
314
326
|
# to construct ssl contexts.
|
327
|
+
# @param digest [String] digest algorithm to use for certificate fingerprinting
|
328
|
+
# @param ca_fingerprint [String] optional fingerprint to verify the
|
329
|
+
# downloaded CA bundle
|
315
330
|
def initialize(waitforcert: Puppet[:waitforcert],
|
316
331
|
maxwaitforcert: Puppet[:maxwaitforcert],
|
317
332
|
onetime: Puppet[:onetime],
|
318
333
|
cert_provider: Puppet::X509::CertProvider.new,
|
319
334
|
ssl_provider: Puppet::SSL::SSLProvider.new,
|
320
|
-
lockfile: Puppet::Util::Pidlock.new(Puppet[:ssl_lockfile])
|
335
|
+
lockfile: Puppet::Util::Pidlock.new(Puppet[:ssl_lockfile]),
|
336
|
+
digest: 'SHA256',
|
337
|
+
ca_fingerprint: Puppet[:ca_fingerprint])
|
321
338
|
@waitforcert = waitforcert
|
322
339
|
@wait_deadline = Time.now.to_i + maxwaitforcert
|
323
340
|
@onetime = onetime
|
324
341
|
@cert_provider = cert_provider
|
325
342
|
@ssl_provider = ssl_provider
|
326
343
|
@lockfile = lockfile
|
344
|
+
@digest = digest
|
345
|
+
@ca_fingerprint = ca_fingerprint
|
327
346
|
end
|
328
347
|
|
329
348
|
# Run the state machine for CA certs and CRLs.
|
@@ -347,7 +366,7 @@ class Puppet::SSL::StateMachine
|
|
347
366
|
chain = ssl_context.client_chain
|
348
367
|
# print from root to client
|
349
368
|
chain.reverse.each_with_index do |cert, i|
|
350
|
-
digest = Puppet::SSL::Digest.new(
|
369
|
+
digest = Puppet::SSL::Digest.new(@digest, cert.to_der)
|
351
370
|
if i == chain.length - 1
|
352
371
|
Puppet.debug(_("Verified client certificate '%{subject}' fingerprint %{digest}") % {subject: cert.subject.to_utf8, digest: digest})
|
353
372
|
else
|
@@ -109,7 +109,8 @@ class Puppet::Transaction::Event
|
|
109
109
|
end
|
110
110
|
|
111
111
|
def resource=(res)
|
112
|
-
if res.respond_to?(:[])
|
112
|
+
level = res[:loglevel] if res.respond_to?(:[])
|
113
|
+
if level
|
113
114
|
@default_log_level = level
|
114
115
|
end
|
115
116
|
@resource = res.to_s
|
@@ -68,7 +68,8 @@ class Puppet::Transaction::EventManager
|
|
68
68
|
received = (event.name != :restarted)
|
69
69
|
relationship_graph.matching_edges(event, resource).each do |edge|
|
70
70
|
received ||= true unless edge.target.is_a?(Puppet::Type.type(:whit))
|
71
|
-
|
71
|
+
method = edge.callback
|
72
|
+
next unless method
|
72
73
|
next unless edge.target.respond_to?(method)
|
73
74
|
|
74
75
|
queue_events_for_resource(resource, edge.target, method, list)
|
@@ -114,7 +115,8 @@ class Puppet::Transaction::EventManager
|
|
114
115
|
end
|
115
116
|
|
116
117
|
def queued_events(resource)
|
117
|
-
|
118
|
+
callbacks = @event_queues[resource]
|
119
|
+
return unless callbacks
|
118
120
|
callbacks.each do |callback, events|
|
119
121
|
yield callback, events unless events.empty?
|
120
122
|
end
|
@@ -256,24 +256,24 @@ class Puppet::Transaction::Report
|
|
256
256
|
@time = data['time']
|
257
257
|
@corrective_change = data['corrective_change']
|
258
258
|
|
259
|
-
if
|
260
|
-
@master_used = master_used
|
259
|
+
if data['master_used']
|
260
|
+
@master_used = data['master_used']
|
261
261
|
end
|
262
262
|
|
263
|
-
if
|
264
|
-
@catalog_uuid = catalog_uuid
|
263
|
+
if data['catalog_uuid']
|
264
|
+
@catalog_uuid = data['catalog_uuid']
|
265
265
|
end
|
266
266
|
|
267
|
-
if
|
268
|
-
@job_id = job_id
|
267
|
+
if data['job_id']
|
268
|
+
@job_id = data['job_id']
|
269
269
|
end
|
270
270
|
|
271
|
-
if
|
272
|
-
@code_id = code_id
|
271
|
+
if data['code_id']
|
272
|
+
@code_id = data['code_id']
|
273
273
|
end
|
274
274
|
|
275
|
-
if
|
276
|
-
@cached_catalog_status = cached_catalog_status
|
275
|
+
if data['cached_catalog_status']
|
276
|
+
@cached_catalog_status = data['cached_catalog_status']
|
277
277
|
end
|
278
278
|
|
279
279
|
if @time.is_a? String
|
@@ -35,7 +35,8 @@ class Puppet::Transaction::ResourceHarness
|
|
35
35
|
|
36
36
|
def scheduled?(resource)
|
37
37
|
return true if Puppet[:ignoreschedules]
|
38
|
-
|
38
|
+
schedule = schedule(resource)
|
39
|
+
return true unless schedule
|
39
40
|
|
40
41
|
# We use 'checked' here instead of 'synced' because otherwise we'll
|
41
42
|
# end up checking most resources most times, because they will generally
|
@@ -51,7 +52,8 @@ class Puppet::Transaction::ResourceHarness
|
|
51
52
|
return nil
|
52
53
|
end
|
53
54
|
|
54
|
-
|
55
|
+
name = resource[:schedule]
|
56
|
+
return nil unless name
|
55
57
|
resource.catalog.resource(:schedule, name) || resource.fail(_("Could not find schedule %{name}") % { name: name })
|
56
58
|
end
|
57
59
|
|