mirror of
https://github.com/kakwa/ldapcherry
synced 2025-07-04 12:27:47 +02:00
adding an exception for failures to open role file
This commit is contained in:
parent
17b8aa6406
commit
804e2b7202
3 changed files with 25 additions and 3 deletions
|
@ -10,13 +10,16 @@ import sys
|
|||
|
||||
from ldapcherry.pyyamlwrapper import loadNoDump
|
||||
from ldapcherry.pyyamlwrapper import DumplicatedKey
|
||||
from ldapcherry.exceptions import DumplicateRoleKey, MissingKey, DumplicateRoleContent
|
||||
from ldapcherry.exceptions import DumplicateRoleKey, MissingKey, DumplicateRoleContent, MissingRolesFile
|
||||
|
||||
|
||||
class Roles:
|
||||
|
||||
def __init__(self, role_file):
|
||||
stream = open(role_file, 'r')
|
||||
try:
|
||||
stream = open(role_file, 'r')
|
||||
except:
|
||||
raise MissingRolesFile(role_file)
|
||||
try:
|
||||
self.roles_raw = loadNoDump(stream)
|
||||
except DumplicatedKey as e:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue