corrected the string formatting (format isn't in 2.4 and even in some later versions of python 2.x requires an index). Tested for both compile ***& runtime exceptions*** against 2.4, 2.6, and 3.5.

This commit is contained in:
Mike Mars 2016-06-04 15:26:32 -07:00 committed by Matt Clay
parent 79d12db02f
commit a406ec30df

View file

@ -170,7 +170,7 @@ def daemonize_self(module, password, port, minutes, pid_file):
module.exit_json(msg="daemonized accelerate on port %s for %s minutes with pid %s" % (port, minutes, str(pid))) module.exit_json(msg="daemonized accelerate on port %s for %s minutes with pid %s" % (port, minutes, str(pid)))
except OSError: except OSError:
e = get_exception() e = get_exception()
message = "fork #1 failed: {} ({})".format(e.errno, e.strerror) message = "fork #1 failed: %s (%s)" % (e.errno, e.strerror)
module.fail_json(message) module.fail_json(message)
# decouple from parent environment # decouple from parent environment
@ -190,7 +190,7 @@ def daemonize_self(module, password, port, minutes, pid_file):
sys.exit(0) sys.exit(0)
except OSError: except OSError:
e = get_exception() e = get_exception()
message = 'fork #2 failed: {} ({})'.format(e.errno, e.strerror) message = 'fork #2 failed: %s (%s)' % (e.errno, e.strerror)
module.fail_json(message) module.fail_json(message)
dev_null = file('/dev/null','rw') dev_null = file('/dev/null','rw')
@ -695,7 +695,7 @@ def main():
e = get_exception() e = get_exception()
message = 'the accelerate daemon appears to be running' message = 'the accelerate daemon appears to be running'
message += 'as a different user that this user cannot access' message += 'as a different user that this user cannot access'
message += 'pid={}'.format(daemon_pid) message += 'pid=%s' % daemon_pid
if e.errno == errno.EPERM: if e.errno == errno.EPERM:
# no permissions means the pid is probably # no permissions means the pid is probably