Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
P
protokoll_skript
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Fachschaftsrat Physik TUKL
Protokoll
protokoll_skript
Commits
bc8b47da
Commit
bc8b47da
authored
Jul 25, 2018
by
Lorenz Steinert
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed some bugs
parent
1b840d2e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
10 deletions
+18
-10
bin/generate_fallback.py
bin/generate_fallback.py
+3
-3
bin/module/esme.py
bin/module/esme.py
+14
-6
bin/proto.py
bin/proto.py
+1
-1
No files found.
bin/generate_fallback.py
View file @
bc8b47da
...
...
@@ -26,13 +26,13 @@ if __name__ == "__main__":
SHARE_DIR
=
get_share
(
RUNDIR
,
CONFIG
,
OPT
.
sharedir
)
LDAP_SERVER
=
get_ldap_server
(
CONFIG
,
OPT
.
s
erver
)
LDAP_SERVER
=
get_ldap_server
(
CONFIG
,
OPT
.
S
erver
)
LDAP_SERVER_BASE
=
get_ldap_base
(
CONFIG
,
OPT
.
base
)
ESME
=
FsrLdap
(
LDAP_SERVER
,
LDAP_SERVER_BASE
,
debug
=
True
,
timeout
=
30
)
FSR
=
ESME
.
get_fsr_ldap
(
[]
)
FSR_EXTERN
=
ESME
.
get_fsr_extern_ldap
(
[]
)
FSR
=
ESME
.
get_fsr_ldap
(
gen_fallback
=
True
)
FSR_EXTERN
=
ESME
.
get_fsr_extern_ldap
(
gen_fallback
=
True
)
fsr_out
=
""
fsr_extern_out
=
""
...
...
bin/module/esme.py
View file @
bc8b47da
...
...
@@ -57,7 +57,7 @@ class FsrLdap:
print
(
"Couldn't Connect to ldap.
\n
Using fallback default.
\n
"
)
return
get_protokollant
(
config
)
def
get_fsr_ldap
(
self
,
share_dir
):
def
get_fsr_ldap
(
self
,
share_dir
=
None
,
gen_fallback
=
False
):
"""get fsr from LDAP"""
print
(
"Fetching FSR from LDAP ..."
)
try
:
...
...
@@ -74,16 +74,20 @@ class FsrLdap:
fsr
.
sort
()
fsr
=
[
" "
.
join
(
i
.
split
(
', '
)[::
-
1
])
for
i
in
fsr
]
return
fsr
return
get_fallback_fsr
(
share_dir
)
if
not
gen_fallback
:
return
get_fallback_fsr
(
share_dir
)
print
(
"Could not fetch from LDAP Server. Aborting."
)
sys
.
exit
(
1
)
except
ldap
.
core
.
exceptions
.
LDAPException
as
error_message
:
if
self
.
debug
:
print
(
"Couldn't Connect to ldap.
\n
\
Using fallback File.
\n
%s
\n
"
%
error_message
)
else
:
print
(
"Couldn't Connect to ldap.
\n
Using fallback File.
\n
"
)
return
get_fallback_fsr
(
share_dir
)
if
not
gen_fallback
:
return
get_fallback_fsr
(
share_dir
)
def
get_fsr_extern_ldap
(
self
,
share_dir
):
def
get_fsr_extern_ldap
(
self
,
share_dir
=
None
,
gen_fallback
=
False
):
"""get the EFSR from LDAP"""
print
(
"Fetching EFSR from LDAP ..."
)
try
:
...
...
@@ -100,14 +104,18 @@ class FsrLdap:
fsr_extern
.
sort
()
fsr_extern
=
[
" "
.
join
(
i
.
split
(
', '
)[::
-
1
])
for
i
in
fsr_extern
]
return
fsr_extern
return
get_fallback_fsr_extern
(
share_dir
)
if
not
gen_fallback
:
return
get_fallback_fsr_extern
(
share_dir
)
print
(
"Could not fetch from LDAP Server. Aborting"
)
sys
.
exit
(
1
)
except
ldap
.
core
.
exceptions
.
LDAPException
as
error_message
:
if
self
.
debug
:
print
(
"Couldn't Connect to ldap.
\n
\
Using fallback File.
\n
%s
\n
"
%
error_message
)
else
:
print
(
"Couldn't Connect to ldap.
\n
Using fallback File.
\n
"
)
return
get_fallback_fsr_extern
(
share_dir
)
if
not
gen_fallback
:
return
get_fallback_fsr_extern
(
share_dir
)
def
get_fallback_fsr
(
share_dir
):
...
...
bin/proto.py
View file @
bc8b47da
...
...
@@ -174,7 +174,7 @@ if __name__ == "__main__":
CONFIG
=
get_config
(
RUNDIR
,
OPT
.
config
)
SHARE_DIR
=
get_share
(
RUNDIR
,
CONFIG
,
OPT
.
sharedir
)
LDAP_SERVER
=
get_ldap_server
(
CONFIG
,
OPT
.
s
erver
)
LDAP_SERVER
=
get_ldap_server
(
CONFIG
,
OPT
.
S
erver
)
LDAP_SERVER_BASE
=
get_ldap_base
(
CONFIG
,
OPT
.
base
)
SERVER_TIMEOUT
=
get_server_timeout
(
CONFIG
,
OPT
.
test
)
...
...
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