mirror of
https://github.com/kakwa/ldapcherry
synced 2024-11-25 18:54:29 +01:00
handling exception if a role key is duplicated
This commit is contained in:
parent
89e8e2aac0
commit
4aac712286
@ -9,13 +9,18 @@ import os
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
from ldapcherry.pyyamlwrapper import loadNoDump
|
from ldapcherry.pyyamlwrapper import loadNoDump
|
||||||
|
from ldapcherry.pyyamlwrapper import DumplicatedKey
|
||||||
|
from ldapcherry.exceptions import DumplicateRoleKey, MissingKey, DumplicateRoleContent
|
||||||
|
|
||||||
|
|
||||||
class Roles:
|
class Roles:
|
||||||
|
|
||||||
def __init__(self, role_file):
|
def __init__(self, role_file):
|
||||||
stream = open(role_file, 'r')
|
stream = open(role_file, 'r')
|
||||||
|
try:
|
||||||
self.roles_raw = loadNoDump(stream)
|
self.roles_raw = loadNoDump(stream)
|
||||||
|
except DumplicatedKey as e:
|
||||||
|
raise DumplicateRoleKey(e.key)
|
||||||
stream.close()
|
stream.close()
|
||||||
self._nest()
|
self._nest()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user