diff options
author | bnewbold <bnewbold@robocracy.org> | 2012-07-12 20:26:24 -0400 |
---|---|---|
committer | bnewbold <bnewbold@robocracy.org> | 2012-07-12 20:26:24 -0400 |
commit | 82da70ad92f82dc2bedf26cbbd057a758e94960e (patch) | |
tree | b291576c552e233c6aa56d81aaff2859984cb01c /exmachina.py | |
parent | 47543de6fa707b8f82d9b7c9c8af0fda02971f0e (diff) | |
download | exmachina-82da70ad92f82dc2bedf26cbbd057a758e94960e.tar.gz exmachina-82da70ad92f82dc2bedf26cbbd057a758e94960e.zip |
pidfile not pid_file; no auth ok
Diffstat (limited to 'exmachina.py')
-rwxr-xr-x | exmachina.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/exmachina.py b/exmachina.py index 35559da..fc04beb 100755 --- a/exmachina.py +++ b/exmachina.py @@ -88,6 +88,9 @@ class ExMachinaHandler(bjsonrpc.handlers.BaseHandler): self.augeas = augeas.Augeas() def authenticate(self, secret_key): + if not self.secret_key: + log.warn("Unecessary authentication attempt") + return if not secret_key.strip() == self.secret_key.strip(): # fail hard log.error("Authentication failed!") @@ -300,7 +303,7 @@ def main(): default="/tmp/exmachina.sock", help="UNIX Domain socket file path to listen on", metavar="FILE") - parser.add_option("--pid-file", + parser.add_option("--pidfile", default=None, help="Daemonize and write pid to this file", metavar="FILE") @@ -333,14 +336,14 @@ def main(): secret_key = sys.stdin.readline().strip() log.debug("Got it!") - if options.pid_file: - with open(options.pid_file, 'w') as pfile: + if options.pidfile: + with open(options.pidfile, 'w') as pfile: # ensure file is available/writable pass - os.unlink(options.pid_file) + os.unlink(options.pidfile) daemonize() pid = os.getpid() - with open(options.pid_file, 'w') as pfile: + with open(options.pidfile, 'w') as pfile: pfile.write("%s" % pid) log.info("Daemonized, pid is %s" % pid) |