Commit 06b988e2 by Michael DeHaan

Create the .ssh dir if it does not already exist.

parent 793a3d3f
...@@ -128,7 +128,10 @@ def keyfile(module, user, write=False, path=None, manage_dir=True): ...@@ -128,7 +128,10 @@ def keyfile(module, user, write=False, path=None, manage_dir=True):
os.chown(sshdir, uid, gid) os.chown(sshdir, uid, gid)
os.chmod(sshdir, 0700) os.chmod(sshdir, 0700)
if not os.path.exists( keysfile): if not os.path.exists(keysfile):
basedir = os.path.dirname(keysfile)
if not os.path.exists(basedir):
os.makedirs(basedir)
try: try:
f = open(keysfile, "w") #touches file so we can set ownership and perms f = open(keysfile, "w") #touches file so we can set ownership and perms
finally: finally:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment