lib/modulesync.rb in modulesync-0.8.2 vs lib/modulesync.rb in modulesync-0.9.0
- old
+ new
@@ -41,14 +41,14 @@
def self.module_files(local_files, path)
local_files.map { |file| file.sub(/#{path}/, '') }
end
- def self.managed_modules(path, filter, negative_filter)
- managed_modules = Util.parse_config(path)
+ def self.managed_modules(config_file, filter, negative_filter)
+ managed_modules = Util.parse_config(config_file)
if managed_modules.empty?
- puts "No modules found at #{path}. Check that you specified the right configs directory containing managed_modules.yml."
+ puts "No modules found in #{config_file}. Check that you specified the right :configs directory and :managed_modules_conf file."
exit
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
@@ -124,19 +124,22 @@
path = "#{options[:configs]}/#{MODULE_FILES_DIR}"
local_files = self.local_files(path)
module_files = self.module_files(local_files, path)
- managed_modules = self.managed_modules("#{options[:configs]}/managed_modules.yml", options[:filter], options[:negative_filter])
+ managed_modules = self.managed_modules("#{options[:configs]}/#{options[:managed_modules_conf]}", options[:filter], options[:negative_filter])
+ errors = false
# managed_modules is either an array or a hash
managed_modules.each do |puppet_module, module_options|
begin
manage_module(puppet_module, module_files, module_options, defaults, options)
rescue # rubocop:disable Lint/RescueWithoutErrorClass
STDERR.puts "Error while updating #{puppet_module}"
raise unless options[:skip_broken]
+ errors = true
puts "Skipping #{puppet_module} as update process failed"
end
end
+ exit 1 if errors && options[:fail_on_warnings]
end
end