Fix issue when the .ssh dir is not present

This commit is contained in:
Thomas S Hatch 2011-10-29 15:49:39 -06:00
parent adaf07edaf
commit 5799b9034a

View File

@ -216,7 +216,8 @@ def set_auth_key(
enc,
comment,
options)
open(
os.path.join(uinfo['home'], config), 'a+').write(
'\n{0}'.format(auth_line))
fconfig = os.path.join(uinfo['home'], config)
if not os.path.isdir(os.path.dirname(fconfig)):
os.makedirs(os.path.dirname(fconfig))
open(fconfig, 'a+').write('\n{0}'.format(auth_line))
return 'new'