Class: PDK::Context::ControlRepo
- Inherits:
-
AbstractContext
- Object
- AbstractContext
- PDK::Context::ControlRepo
- Defined in:
- lib/pdk/context/control_repo.rb
Overview
Represents a context for a directory based Control Repository
Instance Attribute Summary
Attributes inherited from AbstractContext
Instance Method Summary collapse
-
#actualized_module_paths ⇒ Array[String]
The relative module_paths that exist on disk.
-
#display_name ⇒ Object
:nocov:.
-
#initialize(repo_root, context_path) ⇒ ControlRepo
constructor
A new instance of ControlRepo.
-
#module_paths ⇒ Array[String]
The modulepath setting for this control repository as an array of strings.
- #pdk_compatible? ⇒ Boolean
Methods inherited from AbstractContext
#parent_context, #root_path, #to_debug_log, #to_s
Constructor Details
#initialize(repo_root, context_path) ⇒ ControlRepo
Returns a new instance of ControlRepo.
10 11 12 13 14 |
# File 'lib/pdk/context/control_repo.rb', line 10 def initialize(repo_root, context_path) super(context_path) @root_path = repo_root @environment_conf = nil end |
Instance Method Details
#actualized_module_paths ⇒ Array[String]
The relative module_paths that exist on disk.
40 41 42 43 |
# File 'lib/pdk/context/control_repo.rb', line 40 def actualized_module_paths @actualized_module_paths ||= module_paths.reject { |path| path.start_with?('$') } .select { |path| PDK::Util::Filesystem.directory?(PDK::Util::Filesystem.(File.join(root_path, path))) } end |
#display_name ⇒ Object
:nocov:
47 48 49 |
# File 'lib/pdk/context/control_repo.rb', line 47 def display_name 'a Control Repository context' end |
#module_paths ⇒ Array[String]
The modulepath setting for this control repository as an array of strings. These paths are relative and may contain interpolation strings (e.g. $basemodulepath)
27 28 29 30 31 32 33 34 35 |
# File 'lib/pdk/context/control_repo.rb', line 27 def module_paths return @module_paths unless @module_paths.nil? value = environment_conf['modulepath'] || '' # We have to use a hardcoded value here because File::PATH_SEPARATOR is ';' on Windows. # As the environment.conf is only used on Puppet Server, it's always ':' # Based on - https://github.com/puppetlabs/puppet/blob/f3e6d7e6d87f46408943a8e2176afb82ff6ea096/lib/puppet/settings/environment_conf.rb#L98-L106 @module_paths = value.split(':') end |
#pdk_compatible? ⇒ Boolean
17 18 19 20 21 |
# File 'lib/pdk/context/control_repo.rb', line 17 def pdk_compatible? # Currently there is nothing to determine compatibility with the PDK for a # Control Repo. For now assume everything is compatible true end |