CHANGE reflect recent changes in liberouter-gui
diff --git a/backend/inventory.py b/backend/inventory.py
new file mode 100644
index 0000000..3bb0d23
--- /dev/null
+++ b/backend/inventory.py
@@ -0,0 +1,26 @@
+"""
+Manipulation with the YANG schemas.
+File: schemas.py
+Author: Radek Krejci <rkrejci@cesnet.cz>
+"""
+
+import os
+import errno
+
+from liberouterapi import config
+
+from .error import NetopeerException
+
+INVENTORY = config['netopeer'].get('usersdata_path', './')
+
+def inventory_check(path):
+ try:
+ os.makedirs(path, mode=0o750)
+ except OSError as e:
+ if e.errno == errno.EEXIST and os.path.isdir(path):
+ pass
+ elif e.errno == errno.EEXIST:
+ raise NetopeerException('User\'s inventory (' + path + ') already exists and it\'s not a directory.')
+ else:
+ raise NetopeerException('Unable to use inventory path ' + path +' (' + str(e) + ').')
+