summaryrefslogtreecommitdiffstats
path: root/odl-pipeline/lib/utils/utils_yaml.py
diff options
context:
space:
mode:
authorNikolas Hermanns <nikolas.hermanns@ericsson.com>2016-12-13 10:26:11 +0000
committerGerrit Code Review <gerrit@opnfv.org>2016-12-13 10:26:11 +0000
commit2dd53e9153a37a5a9f14a8772224dbdaa091bbfa (patch)
tree7e083f4959878d78f943c07cc32575c66a4ba05d /odl-pipeline/lib/utils/utils_yaml.py
parent2445ba0a0325611e0b927ecc7ed4d361426e5fc4 (diff)
parent416f9cf177801cecfe39f5249d73e3a4a85f0bbd (diff)
Merge "adding odl-pipeline"
Diffstat (limited to 'odl-pipeline/lib/utils/utils_yaml.py')
-rwxr-xr-xodl-pipeline/lib/utils/utils_yaml.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/odl-pipeline/lib/utils/utils_yaml.py b/odl-pipeline/lib/utils/utils_yaml.py
new file mode 100755
index 0000000..f9513b8
--- /dev/null
+++ b/odl-pipeline/lib/utils/utils_yaml.py
@@ -0,0 +1,20 @@
+#
+# Copyright (c) 2015 All rights reserved
+# This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+#
+import yaml
+
+
+def write_dict_to_yaml(config, path):
+ with open(path, 'w+') as f:
+ yaml.dump(config, f, default_flow_style=False)
+
+
+def read_dict_from_yaml(path):
+ with open(path, 'r') as f:
+ return yaml.load(f)