recmkdir is gone

This commit is contained in:
mh 2012-06-08 13:17:23 -03:00
parent 8d0127b219
commit 8aab254eaa
3 changed files with 6 additions and 3 deletions

View file

@ -14,7 +14,10 @@ Puppet::Parser::Functions::newfunction(:ssh_keygen, :type => :rvalue, :doc =>
end
dir = File.dirname(private_key_path)
Puppet::Util.recmkdir(dir,0700) unless File.directory?(dir)
unless File.directory?(dir)
require 'fileutils'
FileUtils.mkdir_p(dir, :mode => 0700)
end
unless [private_key_path,public_key_path].all?{|path| File.exists?(path) }
output = Puppet::Util.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?

View file

@ -74,7 +74,7 @@ describe "the ssh_keygen function" do
File.stubs(:exists?).with("/tmp/a/b/c").returns(false)
File.stubs(:exists?).with("/tmp/a/b/c.pub").returns(false)
File.stubs(:directory?).with("/tmp/a/b").returns(false)
Puppet::Util.expects(:recmkdir).with("/tmp/a/b",0700)
FileUtils.expects(:mkdir_p).with("/tmp/a/b", :mode => 0700)
Puppet::Util.expects(:execute).returns("")
result = @scope.function_ssh_keygen('/tmp/a/b/c')
result.length.should == 2

View file

@ -95,7 +95,7 @@ AllowTcpForwarding <%= scope.lookupvar('sshd::tcp_forwarding') %>
X11Forwarding <%= scope.lookupvar('sshd::x11_forwarding') %>
#X11DisplayOffset 10
#X11UseLocalhost yes
PrintMotd <%= sshd_print_motd %>
PrintMotd <%= scope.lookupvar('sshd::sshd_print_motd') %>
#PrintLastLog yes
#TCPKeepAlive yes
#UseLogin no