summaryrefslogtreecommitdiffstats
path: root/extras
diff options
context:
space:
mode:
Diffstat (limited to 'extras')
-rwxr-xr-xextras/create_new_xlator/generate_xlator.py2
-rwxr-xr-xextras/prot_filter.py2
-rwxr-xr-xextras/snap_scheduler/gcron.py7
-rwxr-xr-xextras/snap_scheduler/snap_scheduler.py18
-rw-r--r--extras/volfilter.py2
5 files changed, 16 insertions, 15 deletions
diff --git a/extras/create_new_xlator/generate_xlator.py b/extras/create_new_xlator/generate_xlator.py
index 3af7ac48d54..1647efa2618 100755
--- a/extras/create_new_xlator/generate_xlator.py
+++ b/extras/create_new_xlator/generate_xlator.py
@@ -36,7 +36,7 @@ def get_error_arg(type_str):
def get_param(names, types):
# Convert two separate tuples to one of (name, type) sub-tuples.
- as_tuples = zip(types, names)
+ as_tuples = list(zip(types, names))
# Convert each sub-tuple into a "type name" string.
as_strings = map(string.join, as_tuples)
# Join all of those into one big string.
diff --git a/extras/prot_filter.py b/extras/prot_filter.py
index 0c48fd5b8e1..0e3e72cf461 100755
--- a/extras/prot_filter.py
+++ b/extras/prot_filter.py
@@ -42,7 +42,7 @@ class Translator:
def load (path):
# If it's a string, open it; otherwise, assume it's already a
# file-like object (most notably from urllib*).
- if type(path) in types.StringTypes:
+ if type(path) in (str,):
fp = file(path,"r")
else:
fp = path
diff --git a/extras/snap_scheduler/gcron.py b/extras/snap_scheduler/gcron.py
index 3f2ba388ccc..8324231a82c 100755
--- a/extras/snap_scheduler/gcron.py
+++ b/extras/snap_scheduler/gcron.py
@@ -122,12 +122,13 @@ def main():
global start_time
if sys.argv[1] == "--update":
if not os.path.exists(GCRON_TASKS):
- # Create a flag in /var/run/gluster which indicates that this nodes
- # doesn't have access to GCRON_TASKS right now, so that
+ # Create a flag in /var/run/gluster which indicates that this
+ # node doesn't have access to GCRON_TASKS right now, so that
# when the mount is available and GCRON_TASKS is available
# the flag will tell this routine to reload GCRON_CROND_TASK
try:
- f = os.open(GCRON_RELOAD_FLAG, os.O_CREAT | os.O_NONBLOCK, 0644)
+ f = os.open(GCRON_RELOAD_FLAG,
+ os.O_CREAT | os.O_NONBLOCK, 0o644)
os.close(f)
except OSError as (errno, strerror):
if errno != EEXIST:
diff --git a/extras/snap_scheduler/snap_scheduler.py b/extras/snap_scheduler/snap_scheduler.py
index a22c0bccbf3..e461ef4f1dc 100755
--- a/extras/snap_scheduler/snap_scheduler.py
+++ b/extras/snap_scheduler/snap_scheduler.py
@@ -207,7 +207,7 @@ def enable_scheduler():
os.remove(GCRON_TASKS)
try:
f = os.open(GCRON_ENABLED, os.O_CREAT | os.O_NONBLOCK,
- 0644)
+ 0o644)
os.close(f)
except OSError as (errno, strerror):
log.error("Failed to open %s. Error: %s.",
@@ -262,7 +262,7 @@ def disable_scheduler():
os.remove(GCRON_DISABLED)
if os.path.lexists(GCRON_TASKS):
os.remove(GCRON_TASKS)
- f = os.open(GCRON_DISABLED, os.O_CREAT, 0644)
+ f = os.open(GCRON_DISABLED, os.O_CREAT, 0o644)
os.close(f)
os.symlink(GCRON_DISABLED, GCRON_TASKS)
log.info("Snapshot scheduling is disabled")
@@ -363,7 +363,7 @@ def list_schedules():
def write_tasks_to_file():
try:
- with open(TMP_FILE, "w", 0644) as f:
+ with open(TMP_FILE, "w", 0o644) as f:
# If tasks is empty, just create an empty tmp file
if len(tasks) != 0:
for key in sorted(tasks):
@@ -388,7 +388,7 @@ def write_tasks_to_file():
def update_current_scheduler(data):
try:
- with open(TMP_FILE, "w", 0644) as f:
+ with open(TMP_FILE, "w", 0o644) as f:
f.write("%s" % data)
f.flush()
os.fsync(f.fileno())
@@ -457,7 +457,7 @@ def add_schedules(jobname, schedule, volname):
job_lockfile = LOCK_FILE_DIR + jobname
try:
f = os.open(job_lockfile, os.O_CREAT | os.O_NONBLOCK,
- 0644)
+ 0o644)
os.close(f)
except OSError as (errno, strerror):
log.error("Failed to open %s. Error: %s.",
@@ -643,7 +643,7 @@ def initialise_scheduler():
return ret
try:
- with open(TMP_FILE, "w+", 0644) as f:
+ with open(TMP_FILE, "w+", 0o644) as f:
updater = ("* * * * * root PATH=$PATH:/usr/local/sbin:"
"/usr/sbin gcron.py --update\n")
f.write("%s\n" % updater)
@@ -659,7 +659,7 @@ def initialise_scheduler():
if not os.path.lexists(GCRON_TASKS):
try:
- f = open(GCRON_TASKS, "w", 0644)
+ f = open(GCRON_TASKS, "w", 0o644)
f.close()
except IOError as (errno, strerror):
log.error("Failed to open %s. Error: %s.", GCRON_TASKS, strerror)
@@ -902,7 +902,7 @@ def main(argv):
return INTERNAL_ERROR
if not os.path.exists(GCRON_ENABLED):
- f = os.open(GCRON_ENABLED, os.O_CREAT | os.O_NONBLOCK, 0644)
+ f = os.open(GCRON_ENABLED, os.O_CREAT | os.O_NONBLOCK, 0o644)
os.close(f)
if not os.path.exists(LOCK_FILE_DIR):
@@ -916,7 +916,7 @@ def main(argv):
return INTERNAL_ERROR
try:
- f = os.open(LOCK_FILE, os.O_CREAT | os.O_RDWR | os.O_NONBLOCK, 0644)
+ f = os.open(LOCK_FILE, os.O_CREAT | os.O_RDWR | os.O_NONBLOCK, 0o644)
try:
fcntl.flock(f, fcntl.LOCK_EX | fcntl.LOCK_NB)
ret = perform_operation(args)
diff --git a/extras/volfilter.py b/extras/volfilter.py
index d242e60dcba..79be8f7c378 100644
--- a/extras/volfilter.py
+++ b/extras/volfilter.py
@@ -83,7 +83,7 @@ class Translator:
def load (path):
# If it's a string, open it; otherwise, assume it's already a
# file-like object (most notably from urllib*).
- if type(path) in types.StringTypes:
+ if type(path) in (str,):
fp = file(path,"r")
else:
fp = path