Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
cubicweb
cubes
trustedauth
Commits
16440ba3e74d
Commit
cf3de7f9
authored
Oct 21, 2010
by
Aurelien Campeas
Browse files
[hooks] do not crash on startup if the config entry is missing
parent
395866a00f8f
Changes
1
Hide whitespace changes
Inline
Side-by-side
hooks.py
View file @
16440ba3
...
...
@@ -23,12 +23,13 @@ class ServerStartupHook(hook.Hook):
self
.
debug
(
'registering kerberos authentifier'
)
self
.
repo
.
system_source
.
add_authentifier
(
XRemoteUserAuthentifier
())
CONFENTRY
=
'secret-key-filepath'
def
registration_callback
(
vreg
):
vreg
.
register
(
ServerStartupHook
)
fpath
=
vreg
.
config
.
get
(
'secret-key-filepath'
)
fpath
=
vreg
.
config
.
get
(
CONFENTRY
)
if
fpath
is
None
or
not
osp
.
exists
(
fpath
):
msg
=
'invalid or missing value for the
secret-key-filepth'
msg
=
'invalid or missing value for the
%s'
%
CONFENTRY
vreg
.
error
(
msg
)
raise
Exception
(
msg
)
vreg
.
config
.
_secret
=
open
(
fpath
,
'rb'
).
read
().
strip
()
vreg
.
debug
(
'loaded secret key'
)
else
:
vreg
.
register
(
ServerStartupHook
)
vreg
.
config
.
_secret
=
open
(
fpath
,
'rb'
).
read
().
strip
()
vreg
.
debug
(
'loaded secret key'
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment