summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Ipsum <richard.ipsum@codethink.co.uk>2013-10-02 18:35:07 +0100
committerRichard Ipsum <richard.ipsum@codethink.co.uk>2013-10-02 18:35:07 +0100
commita0f3280392586224ba4ef4e12ff3028972f8989f (patch)
tree5f35510980045e375092624e2ba216bfbe39c8d5
parentf59d7392f000a885e204ee10b05cab5801c5de54 (diff)
downloadgitano-a0f3280392586224ba4ef4e12ff3028972f8989f.tar.bz2
Add syslogging to gitano-auth
-rw-r--r--bin/gitano-auth.in12
1 files changed, 12 insertions, 0 deletions
diff --git a/bin/gitano-auth.in b/bin/gitano-auth.in
index e99eb11..51ba85d 100644
--- a/bin/gitano-auth.in
+++ b/bin/gitano-auth.in
@@ -25,6 +25,8 @@ gitano.config.repo_path(repo_root)
local cmdline = luxio.getenv "SSH_ORIGINAL_COMMAND" or ""
+local transactionid = gitano.log.syslog.open()
+
if cmdline:match("^[ \t\n]*$") then
gitano.log.fatal("No command provided, cannot continue")
end
@@ -89,6 +91,11 @@ local repo
-- Find the command
+
+ip = string.match(luxio.getenv "SSH_CLIENT", "^[^ ]+") or ""
+gitano.log.syslog.info("Client connected from ", ip,
+ " Executing command: ", cmdline)
+
local cmd = gitano.command.get(parsed_cmdline[1])
if not cmd then
@@ -153,6 +160,7 @@ local env = {
["GITANO_KEYTAG"] = keytag,
["GITANO_PROJECT"] = (repo or {}).name,
["GITANO_SOURCE"] = "ssh",
+ ["GITANO_TRANSACTION_ID"] = transactionid,
}
local how, why = cmd.run(config, repo, parsed_cmdline, env)
@@ -161,6 +169,10 @@ if how ~= "exit" or why ~= 0 then
gitano.log.critical("Error running sub-process:",
("%s (%d)"):format(how, why))
gitano.log.fatal("Unable to continue")
+else
+ gitano.log.syslog.info(cmdline, "completed successfully")
end
+gitano.log.syslog.close()
+
return 0