Create the .ssh dir if it does not already exist.
This commit is contained in:
parent
793a3d3f76
commit
06b988e2d5
1 changed files with 4 additions and 1 deletions
|
@ -128,7 +128,10 @@ def keyfile(module, user, write=False, path=None, manage_dir=True):
|
|||
os.chown(sshdir, uid, gid)
|
||||
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:
|
||||
f = open(keysfile, "w") #touches file so we can set ownership and perms
|
||||
finally:
|
||||
|
|
Loading…
Reference in a new issue