X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=plugins%2Fsliverauth.py;fp=plugins%2Fsliverauth.py;h=61349daabe0c218f0f0769c087bde7c2faf0887a;hb=1b4f53e648b13f7629970787b6ec03387e2d966a;hp=07986500cfe9360de78480602f19da4d2fdf5153;hpb=9e596e6eb3c871ab25837903b0ed30f165d9d688;p=nodemanager.git diff --git a/plugins/sliverauth.py b/plugins/sliverauth.py index 0798650..61349da 100644 --- a/plugins/sliverauth.py +++ b/plugins/sliverauth.py @@ -112,12 +112,13 @@ def generate_sshkey (sliver): if not os.path.isdir (dotssh): os.mkdir (dotssh, 0700) logger.log_call ( [ 'chown', "%s:slices"%(sliver['name']), dotssh ] ) - if not os.path.isfile (pubfile): + if not os.path.isfile(pubfile): comment="%s@%s"%(sliver['name'],socket.gethostname()) logger.log_call( [ 'ssh-keygen', '-t', 'rsa', '-N', '', '-f', keyfile , '-C', comment] ) os.chmod (keyfile, 0400) logger.log_call ( [ 'chown', "%s:slices"%(sliver['name']), keyfile, pubfile ] ) - return file(pubfile).read().strip() + with open(pubfile) as f: + return f.read().strip() # a sliver can get created, deleted and re-created # the slice having the tag is not sufficient to skip key geneneration