Method: ModuleSync.managed_modules

Defined in:
lib/modulesync.rb

.managed_modulesObject



66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/modulesync.rb', line 66

def self.managed_modules
  config_file = config_path(options[:managed_modules_conf], options)
  filter = options[:filter]
  negative_filter = options[:negative_filter]

  managed_modules = Util.parse_config(config_file)
  if managed_modules.empty?
    warn "No modules found in #{config_file}. " \
         'Check that you specified the right :configs directory and :managed_modules_conf file.'
    exit 1
  end
  managed_modules.select! { |m| m =~ Regexp.new(filter) } unless filter.nil?
  managed_modules.reject! { |m| m =~ Regexp.new(negative_filter) } unless negative_filter.nil?
  managed_modules.map { |given_name, options| PuppetModule.new(given_name, options) }
end