1
0
mirror of https://github.com/kakwa/ldapcherry synced 2024-12-22 21:00:04 +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
from ldapcherry.pyyamlwrapper import loadNoDump
from ldapcherry.pyyamlwrapper import DumplicatedKey
from ldapcherry.exceptions import DumplicateRoleKey, MissingKey, DumplicateRoleContent
class Roles:
def __init__(self, role_file):
stream = open(role_file, 'r')
self.roles_raw = loadNoDump(stream)
try:
self.roles_raw = loadNoDump(stream)
except DumplicatedKey as e:
raise DumplicateRoleKey(e.key)
stream.close()
self._nest()