Bit by os.path.join not liking leading /

join ignores all path components to the left of any component that
starts with a /. Tested and found working.

Signed-off-by: Manoj Srivastava <srivasta@golden-gryphon.com>
This commit is contained in:
Manoj Srivastava 2016-02-08 02:50:55 -08:00
parent 32ef6fc571
commit 4a29e5eec5
No known key found for this signature in database
GPG key ID: 36BD720F6F576472

View file

@ -89,11 +89,11 @@ class AdminUserCredentialsPublicKey(Task):
username = info.manifest.plugins['admin_user']['username'] username = info.manifest.plugins['admin_user']['username']
ssh_file = os.path.join('/home/', username, '.ssh/authorized_keys') ssh_file = os.path.join('/home', username, '.ssh/authorized_keys')
rel_ssh_file = os.path.join(info.root, ssh_file) rel_ssh_file = os.path.join(info.root, 'home', username, '.ssh/authorized_keys')
ssh_dir = os.path.dirname(ssh_file) ssh_dir = os.path.dirname(ssh_file)
rel_ssh_dir = os.path.join(info.root, ssh_dir) rel_ssh_dir = os.path.dirname(rel_ssh_file)
if not os.path.exists(rel_ssh_dir): if not os.path.exists(rel_ssh_dir):
log.debug('Creating %s.' % rel_ssh_dir) log.debug('Creating %s.' % rel_ssh_dir)
os.mkdir(rel_ssh_dir) os.mkdir(rel_ssh_dir)