summaryrefslogtreecommitdiffstats
path: root/extras/volgen/Common.py
diff options
context:
space:
mode:
authorAmar Tumballi <amar@gluster.com>2011-02-09 06:11:02 +0000
committerAnand V. Avati <avati@dev.gluster.com>2011-02-10 22:18:01 -0800
commit08ca1d3c7801d22f1de452f098b0a5df251ca5e7 (patch)
tree211ada0e02d58c8bbfd7e868640cd2d98946110f /extras/volgen/Common.py
parent07402f590e12b097e8267e924e0ae69d9b8964fb (diff)
removed some of the stale scripts
Signed-off-by: Amar Tumballi <amar@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 2393 ('gluster-volgen' and 'gluster-defrag' scripts are stale, but present in AMI) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2393
Diffstat (limited to 'extras/volgen/Common.py')
-rw-r--r--extras/volgen/Common.py83
1 files changed, 0 insertions, 83 deletions
diff --git a/extras/volgen/Common.py b/extras/volgen/Common.py
deleted file mode 100644
index 298dee989..000000000
--- a/extras/volgen/Common.py
+++ /dev/null
@@ -1,83 +0,0 @@
-import os, sys, re, string
-
-def check_duplicate_entry(args):
- """Check duplicate entries in incoming arguments"""
- _tmp = []
- for server in args:
- if server not in _tmp:
- _tmp.append (server)
- else:
- print "Duplicate arguments detected (%s)" % server
- raise ValueError
-
- return
-
-def args2dict(args):
-
- keyvalue = {}
- for arg in args:
- if int(arg.find(':')) == -1:
- continue
- first = arg.split(':')[0]
- keyvalue[first] = []
-
- for arg in args:
- if int(arg.find(':')) == -1:
- continue
- first = arg.split(':')[0]
- if arg.split(':')[1] not in keyvalue[first]:
- if arg.split(':')[1][0] != '/':
- print "Absolute export path required for %s" % arg
- raise ValueError
- keyvalue[first].append (arg.split(':')[1])
-
- return keyvalue
-
-def args2array(args):
-
- array = []
-
- for arg in args:
- if int(arg.find(':')) == -1:
- continue
- array.append(arg)
-
- return array
-
-def list_export_vols(configdir, volumename):
-
- list_export = []
- if os.path.isdir(configdir):
- for line in os.listdir(configdir):
- if re.match(r'[a-zA-Z0-9_]\S+%s-export.vol' % volumename, line):
- list_export.append(line)
-
- return list_export
-
-def get_old_server_args(exports, configdir):
-
- list_args = []
- for export in exports:
- array = gfParser("%s/%s" % (configdir, export))
- for dt in array:
- if dt.has_key('option'):
- if re.match("\w+tory", dt['option']):
- list_args.append(export.split('-')[0] + ":" + dt['option'].split()[1])
-
- return list_args
-
-def gfParser (volfile):
-
- volfile_rl = open (volfile).readlines()
- volume_array = []
- for line in volfile_rl:
- line = line.strip()
- volfile_dict = {}
- if re.match(r"[a-zA-Z0-9_]+", line):
- if line.split() > 1:
- volfile_dict[line.split()[0]] = string.join (line.split()[1:], ' ')
- else:
- volfile_dict[line.split()[0]] = " "
- volume_array.append(volfile_dict)
-
- return volume_array