1
0
mirror of https://github.com/kakwa/ldapcherry synced 2024-11-22 09:24:21 +01:00

handling exception if a role key is duplicated

This commit is contained in:
kakwa 2015-05-12 01:42:08 +02:00
parent 89e8e2aac0
commit 4aac712286

View File

@ -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()