diff --git a/lib/modulesync.rb b/lib/modulesync.rb index 0e9f2c24..915a7353 100644 --- a/lib/modulesync.rb +++ b/lib/modulesync.rb @@ -199,8 +199,12 @@ def self.execute(cli_options) managed_modules.each do |puppet_module| $stdout.puts "#{puppet_module.given_name}:" - puppet_module.repository.clone unless puppet_module.repository.cloned? - puppet_module.repository.switch branch: @options[:branch] + if puppet_module.repository.cloned? + puppet_module.repository.switch branch: @options[:branch] if @options[:branch] + else + puppet_module.repository.clone + puppet_module.repository.switch branch: @options[:branch] + end command_args = cli_options[:command_args] local_script = File.expand_path command_args[0]