mirror of
https://github.com/xcat2/confluent.git
synced 2025-08-23 19:50:23 +00:00
Do not overwrite the node SSH key with the last found public key
Instead of overwriting the SSH public code for the node concatenate all found SSH keys together in one file. Signed-off-by: Adrian Reber <areber@redhat.com>
This commit is contained in:
@@ -213,15 +213,17 @@ def initialize_root_key(generate, automation=False):
|
||||
suffix = 'automationpubkey'
|
||||
else:
|
||||
suffix = 'rootpubkey'
|
||||
keyname = '/var/lib/confluent/public/site/ssh/{0}.{1}'.format(
|
||||
myname, suffix)
|
||||
for auth in authorized:
|
||||
shutil.copy(
|
||||
auth,
|
||||
'/var/lib/confluent/public/site/ssh/{0}.{1}'.format(
|
||||
myname, suffix))
|
||||
os.chmod('/var/lib/confluent/public/site/ssh/{0}.{1}'.format(
|
||||
myname, suffix), 0o644)
|
||||
os.chown('/var/lib/confluent/public/site/ssh/{0}.{1}'.format(
|
||||
myname, suffix), neededuid, -1)
|
||||
local_key = open(auth, 'r')
|
||||
dest = open(keyname, 'a')
|
||||
dest.write(local_key.read())
|
||||
local_key.close()
|
||||
dest.close()
|
||||
if os.path.exists(keyname):
|
||||
os.chmod(keyname, 0o644)
|
||||
os.chown(keyname, neededuid, -1)
|
||||
if alreadyexist:
|
||||
raise AlreadyExists()
|
||||
|
||||
|
Reference in New Issue
Block a user