summaryrefslogtreecommitdiffstats
path: root/xlators/features
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/features')
-rw-r--r--xlators/features/marker/utils/syncdaemon/__codecheck.py27
-rw-r--r--xlators/features/marker/utils/syncdaemon/configinterface.py2
-rw-r--r--xlators/features/marker/utils/syncdaemon/master.py2
-rw-r--r--xlators/features/marker/utils/syncdaemon/syncdutils.py10
4 files changed, 36 insertions, 5 deletions
diff --git a/xlators/features/marker/utils/syncdaemon/__codecheck.py b/xlators/features/marker/utils/syncdaemon/__codecheck.py
new file mode 100644
index 00000000000..832e75c444b
--- /dev/null
+++ b/xlators/features/marker/utils/syncdaemon/__codecheck.py
@@ -0,0 +1,27 @@
+import os
+import os.path
+import sys
+
+fl = os.listdir(os.path.dirname(sys.argv[0]) or '.')
+fl.sort()
+for f in fl:
+ if f[-3:] != '.py' or f[0] == '_':
+ continue
+ m = f[:-3]
+ sys.stdout.write('importing %s ...' % m)
+ __import__(m)
+ print(' OK.')
+
+def sys_argv_set(a):
+ sys.argv = sys.argv[:1] + a
+
+gsyncd = sys.modules['gsyncd']
+for a in [['--help'], ['--version'], ['--canonicalize-escape-url', '/foo']]:
+ print('>>> invoking program with args: %s' % ' '.join(a))
+ pid = os.fork()
+ if not pid:
+ sys_argv_set(a)
+ gsyncd.main()
+ _, r = os.waitpid(pid, 0)
+ if r:
+ raise RuntimeError('invocation failed')
diff --git a/xlators/features/marker/utils/syncdaemon/configinterface.py b/xlators/features/marker/utils/syncdaemon/configinterface.py
index fbf96c84336..e55bec519e9 100644
--- a/xlators/features/marker/utils/syncdaemon/configinterface.py
+++ b/xlators/features/marker/utils/syncdaemon/configinterface.py
@@ -173,7 +173,7 @@ class GConffile(object):
opt = norm(opt)
v = d.get(opt)
if v:
- print v
+ print(v)
else:
for k, v in d.iteritems():
if k == '__name__':
diff --git a/xlators/features/marker/utils/syncdaemon/master.py b/xlators/features/marker/utils/syncdaemon/master.py
index 4273bf0c419..de4b324214e 100644
--- a/xlators/features/marker/utils/syncdaemon/master.py
+++ b/xlators/features/marker/utils/syncdaemon/master.py
@@ -110,7 +110,7 @@ class GMaster(object):
self.volinfo_state = (uuid_preset and {'uuid': uuid_preset}, None)
# the actual volinfo we make use of
self.volinfo = None
- self.terminate = False
+ self.terminate = False
def crawl_loop(self):
"""start the keep-alive thread and iterate .crawl"""
diff --git a/xlators/features/marker/utils/syncdaemon/syncdutils.py b/xlators/features/marker/utils/syncdaemon/syncdutils.py
index 244e29628e0..6a08fbdaf9a 100644
--- a/xlators/features/marker/utils/syncdaemon/syncdutils.py
+++ b/xlators/features/marker/utils/syncdaemon/syncdutils.py
@@ -8,7 +8,11 @@ from threading import Lock, Thread as baseThread
from errno import EACCES, EAGAIN, EPIPE, ENOTCONN
from signal import SIGTERM, SIGKILL
from time import sleep
-from cPickle import PickleError
+try:
+ from cPickle import PickleError
+except ImportError:
+ # py 3
+ from pickle import PickleError
from gconf import gconf
@@ -184,7 +188,7 @@ class FreeObject(object):
"""wildcard class for which any attribute can be set"""
def __init__(self, **kw):
- for k,v in kw.iteritems():
+ for k,v in kw.items():
setattr(self, k, v)
class Thread(baseThread):
@@ -210,5 +214,5 @@ class Thread(baseThread):
baseThread.__init__(self, *a, **kw)
self.setDaemon(True)
-class GsyncdError(StandardError):
+class GsyncdError(Exception):
pass