vendored/puppet/lib/puppet/pops/loaders.rb in bolt-0.7.0 vs vendored/puppet/lib/puppet/pops/loaders.rb in bolt-0.8.0
- old
+ new
@@ -82,11 +82,15 @@
loaders.find_loader(module_name)
end
def self.static_loader
# The static loader can only be changed after a reboot
- @@static_loader ||= Loader::StaticLoader.new()
+ if !class_variable_defined?(:@@static_loader) || @@static_loader.nil?
+ @@static_loader = Loader::StaticLoader.new()
+ @@static_loader.create_built_in_puppet_types
+ end
+ @@static_loader
end
def self.implementation_registry
loaders = Puppet.lookup(:loaders) { nil }
loaders.nil? ? nil : loaders.implementation_registry
@@ -434,22 +438,10 @@
end
def resolved?
!@private_loader.nil?
end
-
- def restrict_to_dependencies?
- @puppet_module.has_metadata?
- end
-
- def unmet_dependencies?
- @puppet_module.unmet_dependencies.any?
- end
-
- def dependency_names
- @puppet_module.dependencies_as_modules.collect(&:name)
- end
end
# Resolves module loaders - resolution of model dependencies is done by Puppet::Module
#
class ModuleResolver
@@ -474,44 +466,17 @@
def resolve(module_data)
if module_data.resolved?
nil
else
- module_data.private_loader =
- if module_data.restrict_to_dependencies?
- create_loader_with_only_dependencies_visible(module_data)
- else
- create_loader_with_all_modules_visible(module_data)
- end
+ module_data.private_loader = create_loader_with_all_modules_visible(module_data)
end
end
private
def create_loader_with_all_modules_visible(from_module_data)
- Puppet.debug{"ModuleLoader: module '#{from_module_data.name}' has unknown dependencies - it will have all other modules visible"}
-
@loaders.add_loader_by_name(Loader::DependencyLoader.new(from_module_data.public_loader, "#{from_module_data.name} private", all_module_loaders()))
- end
-
- def create_loader_with_only_dependencies_visible(from_module_data)
- if from_module_data.unmet_dependencies?
- if Puppet[:strict] != :off
- msg = "ModuleLoader: module '#{from_module_data.name}' has unresolved dependencies" \
- " - it will only see those that are resolved." \
- " Use 'puppet module list --tree' to see information about modules"
- case Puppet[:strict]
- when :error
- raise LoaderError.new(msg)
- when :warning
- Puppet.warn_once(:unresolved_module_dependencies,
- "unresolved_dependencies_for_module_#{from_module_data.name}",
- msg)
- end
- end
- end
- dependency_loaders = from_module_data.dependency_names.collect { |name| @index[name].public_loader }
- @loaders.add_loader_by_name(Loader::DependencyLoader.new(from_module_data.public_loader, "#{from_module_data.name} private", dependency_loaders))
end
end
end
end