summaryrefslogtreecommitdiffstats
path: root/combox/config.py
diff options
context:
space:
mode:
authorSiddharth Ravikumar <sravik@bgsu.edu>2015-01-13 23:13:06 -0500
committerSiddharth Ravikumar <sravik@bgsu.edu>2015-01-13 23:13:06 -0500
commit30cf34bef72df235be4ada2e7b15afbeeb84dd23 (patch)
tree27cd87c2643ffa57a94bf3fa0c0dc929385a2159 /combox/config.py
parentd17974e00be1541aff4a646d17c83825e1527bbd (diff)
combox/config.py: added get_nodedirs function.
Diffstat (limited to 'combox/config.py')
-rw-r--r--combox/config.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/combox/config.py b/combox/config.py
index 12ced21..40c1372 100644
--- a/combox/config.py
+++ b/combox/config.py
@@ -47,6 +47,8 @@ import hashlib
import sys
import stat
+from os import path
+
def get_secret():
"Gets the pass phrase from std. input."
return getpass.getpass('passphrase: ')
@@ -91,3 +93,17 @@ def config_cb(config_dir = os.path.join(os.getenv('HOME'),'.combox/'),
yaml.dump(config_info, config_file, default_flow_style=False)
os.chmod(config_file_path,stat.S_IRUSR|stat.S_IWUSR)
+
+def get_nodedirs(config):
+ """
+ Returns the node path to directories as a list.
+
+ config: a dictionary which has the combox configuration
+ """
+ nodes = []
+
+ for node in config['nodes_info'].itervalues():
+ node_path = path.abspath(node['path'])
+ nodes.append(node_path)
+
+ return sorted(nodes)