]> gitweb.fluxo.info Git - puppet-sshd.git/commitdiff
change the ssh_keygen function to use different methods depending on if
authorMicah Anderson <micah@riseup.net>
Thu, 18 Dec 2014 16:50:32 +0000 (11:50 -0500)
committerMicah Anderson <micah@riseup.net>
Fri, 27 Mar 2015 19:27:12 +0000 (15:27 -0400)
its puppet 3 or puppet 2

lib/puppet/parser/functions/ssh_keygen.rb

index b732b87ad3e4becd2c1fd623ee0092551d4d8fad..e304f2426350c8c50fb80a3f9e44611c55506a80 100644 (file)
@@ -19,10 +19,12 @@ 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?
     end
     [File.read(private_key_path),File.read(public_key_path)]
 end
+