]> gitweb.fluxo.info Git - puppet-sshd.git/commitdiff
Fix ssh_keygen for Puppet < 3 installs
authorJerome Charaoui <jcharaoui@cmaisonneuve.qc.ca>
Thu, 15 Jan 2015 22:09:56 +0000 (17:09 -0500)
committerJerome Charaoui <jcharaoui@cmaisonneuve.qc.ca>
Thu, 15 Jan 2015 22:09:56 +0000 (17:09 -0500)
lib/puppet/parser/functions/ssh_keygen.rb

index b732b87ad3e4becd2c1fd623ee0092551d4d8fad..87a3452abd3c8afb99061870135ba3eedce6f7f0 100644 (file)
@@ -19,7 +19,8 @@ Puppet::Parser::Functions::newfunction(:ssh_keygen, :type => :rvalue, :doc =>
       FileUtils.mkdir_p(dir, :mode => 0700)
     end
     unless [private_key_path,public_key_path].all?{|path| File.exists?(path) }
-      output = Puppet::Util::Execution.execute(
+      executor = (Facter.value(:puppetversion).to_i < 3) ? Puppet::Util : Puppet::Util::Execution
+      output = executor.execute(
         ['/usr/bin/ssh-keygen','-t', 'rsa', '-b', '4096', 
          '-f', private_key_path, '-P', '', '-q'])
       raise Puppet::ParseError, "Something went wrong during key generation! Output: #{output}" unless output.empty?