a) fail_json uses kwargs, b) outside the fork, log instead of returning json on stdout.
This commit is contained in:
parent
1426a99cc0
commit
eb4813f1ca
1 changed files with 3 additions and 3 deletions
|
@ -171,7 +171,7 @@ def daemonize_self(module, password, port, minutes, pid_file):
|
||||||
except OSError:
|
except OSError:
|
||||||
e = get_exception()
|
e = get_exception()
|
||||||
message = "fork #1 failed: %d (%s)" % (e.errno, e.strerror)
|
message = "fork #1 failed: %d (%s)" % (e.errno, e.strerror)
|
||||||
module.fail_json(message)
|
module.fail_json(msg=message)
|
||||||
|
|
||||||
# decouple from parent environment
|
# decouple from parent environment
|
||||||
os.chdir("/")
|
os.chdir("/")
|
||||||
|
@ -190,8 +190,8 @@ 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: %d (%s)' % (e.errno, e.strerror)
|
log('fork #2 failed: %d (%s)' % (e.errno, e.strerror))
|
||||||
module.fail_json(message)
|
sys.exit(1)
|
||||||
|
|
||||||
dev_null = file('/dev/null','rw')
|
dev_null = file('/dev/null','rw')
|
||||||
os.dup2(dev_null.fileno(), sys.stdin.fileno())
|
os.dup2(dev_null.fileno(), sys.stdin.fileno())
|
||||||
|
|
Loading…
Reference in a new issue