comparison libervia/backend/memory/memory.py @ 4193:730f542e4ad0

core: add new `init_script_path` option: `init_script_path` option can be used in `[DEFAULTS]` to run a script at the end of backend initialisation. A new `init_pre_script` method is used to wait for backend to reach this stage (designed to be used mostly by CLI frontend), then the usual `ready_get` method is finished once the script is finished.
author Goffi <goffi@goffi.org>
date Wed, 13 Dec 2023 22:00:22 +0100
parents 54b8cf8c8daf
children 9fc3d28bc3f6
comparison
equal deleted inserted replaced
4192:1d24ff583794 4193:730f542e4ad0
378 378
379 auth_d = defer.ensureDeferred(self.profile_authenticate(password, profile)) 379 auth_d = defer.ensureDeferred(self.profile_authenticate(password, profile))
380 auth_d.addCallback(do_start_session) 380 auth_d.addCallback(do_start_session)
381 return auth_d 381 return auth_d
382 382
383 if self.host.initialised.called: 383 if self.host.init_pre_script.called:
384 return defer.succeed(None).addCallback(backend_initialised) 384 return defer.succeed(None).addCallback(backend_initialised)
385 else: 385 else:
386 return self.host.initialised.addCallback(backend_initialised) 386 return self.host.init_pre_script.addCallback(backend_initialised)
387 387
388 def stop_session(self, profile): 388 def stop_session(self, profile):
389 """Delete a profile session 389 """Delete a profile session
390 390
391 @param profile: %(doc_profile)s 391 @param profile: %(doc_profile)s