diff options
author | Micah Anderson <micah@riseup.net> | 2014-12-18 11:50:32 -0500 |
---|---|---|
committer | Micah Anderson <micah@riseup.net> | 2015-03-27 15:27:12 -0400 |
commit | 5c9ce49321f4ea5d502eca98d9e9a23bae57b1da (patch) | |
tree | 793cf446ddd3bbd3c9c2a5795c160ad0c0edb6c0 /lib/puppet/parser/functions/ssh_keygen.rb | |
parent | 52fd60c9f65025d32be275d98bcc2c88b3408de2 (diff) | |
download | puppet-sshd-5c9ce49321f4ea5d502eca98d9e9a23bae57b1da.tar.gz puppet-sshd-5c9ce49321f4ea5d502eca98d9e9a23bae57b1da.tar.bz2 |
change the ssh_keygen function to use different methods depending on if
its puppet 3 or puppet 2
Diffstat (limited to 'lib/puppet/parser/functions/ssh_keygen.rb')
-rw-r--r-- | lib/puppet/parser/functions/ssh_keygen.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/puppet/parser/functions/ssh_keygen.rb b/lib/puppet/parser/functions/ssh_keygen.rb index b732b87..e304f24 100644 --- a/lib/puppet/parser/functions/ssh_keygen.rb +++ b/lib/puppet/parser/functions/ssh_keygen.rb @@ -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 + |