mirror of
https://github.com/xcat2/confluent.git
synced 2025-02-16 10:39:23 +00:00
Merge pull request #159 from adrianreber/2024-08-13-cat-keys
Do not overwrite the node SSH key with the last found public key
This commit is contained in:
commit
83a4df49c7
@ -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()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user