From 30cf34bef72df235be4ada2e7b15afbeeb84dd23 Mon Sep 17 00:00:00 2001 From: Siddharth Ravikumar Date: Tue, 13 Jan 2015 23:13:06 -0500 Subject: combox/config.py: added get_nodedirs function. --- combox/config.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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) -- cgit v1.2.3