mirror of
https://github.com/xcat2/confluent.git
synced 2024-11-22 09:32:21 +00:00
Fix osdeploy initialize dependency on master key
Make sure confluent has made /etc/confluent, and further always initialize the encryption key, as it will almost certainly be needed and easiest to just always generate on first startup.
This commit is contained in:
parent
b1032d8c4c
commit
b809514ef9
@ -121,6 +121,9 @@ def init_confluent_myname():
|
||||
return
|
||||
mynamedone = True
|
||||
hasconfluentuser = None
|
||||
neededuid = os.stat('/etc/confluent').st_uid
|
||||
if neededuid == 0:
|
||||
return
|
||||
try:
|
||||
hasconfluentuser = pwd.getpwnam('confluent')
|
||||
except KeyError:
|
||||
@ -247,6 +250,17 @@ def initialize(cmdset):
|
||||
'subject.')
|
||||
else:
|
||||
didsomething = False
|
||||
if not os.path.exists('/etc/confluent'):
|
||||
sys.stderr.write('Start confluent service prior to initializng OS deployment\n')
|
||||
sys.exit(1)
|
||||
if cmdset.t or cmdset.s or cmdset.a or cmdset.u:
|
||||
neededuid = os.stat('/etc/confluent').st_uid
|
||||
try:
|
||||
os.makedirs('/var/lib/confluent')
|
||||
os.chown('/var/lib/confluent', neededuid, -1)
|
||||
except OSError as e:
|
||||
if e.errno != 17:
|
||||
raise
|
||||
if cmdset.u:
|
||||
didsomething = True
|
||||
if not glob.glob('/root/.ssh/*.pub'):
|
||||
@ -258,14 +272,6 @@ def initialize(cmdset):
|
||||
sys.exit(1)
|
||||
init_confluent_myname()
|
||||
sshutil.initialize_root_key(False)
|
||||
if cmdset.t or cmdset.s or cmdset.a or cmdset.u:
|
||||
neededuid = os.stat('/etc/confluent').st_uid
|
||||
try:
|
||||
os.makedirs('/var/lib/confluent')
|
||||
os.chown('/var/lib/confluent', neededuid, -1)
|
||||
except OSError as e:
|
||||
if e.errno != 17:
|
||||
raise
|
||||
if cmdset.t:
|
||||
didsomething = True
|
||||
init_confluent_myname()
|
||||
|
@ -272,6 +272,8 @@ def run(args):
|
||||
if not confluentuuid:
|
||||
confluentuuid = str(uuid.uuid4())
|
||||
configmanager.set_global('confluent_uuid', confluentuuid)
|
||||
if not configmanager._masterkey:
|
||||
configmanager.init_masterkey()
|
||||
if dbgif:
|
||||
oumask = os.umask(0o077)
|
||||
try:
|
||||
|
Loading…
Reference in New Issue
Block a user