diff options
author | Daniel Silverstone <dsilvers@digital-scurf.org> | 2013-10-03 11:12:25 +0100 |
---|---|---|
committer | Daniel Silverstone <dsilvers@digital-scurf.org> | 2013-10-03 11:12:25 +0100 |
commit | e2b5cd26956d71d80fdc2c9db3e85da98feb0f3d (patch) | |
tree | 8c2d5db36d079d4a965d55351634f1327db7c21c /bin/gitano-post-receive-hook.in | |
parent | b2532d86d95fa8ad9d21b7c31685d73da129485b (diff) | |
parent | ee630003284c4f7373b0f90ca5195d6892281772 (diff) | |
download | gitano-e2b5cd26956d71d80fdc2c9db3e85da98feb0f3d.tar.gz |
Merge remote-tracking branch 'baserock/baserock/richardipsum/syslog'
Also fix up test tool so that tests do not fail now that we depend
on the SSH_CLIENT environment variable coming from the caller.
Diffstat (limited to 'bin/gitano-post-receive-hook.in')
-rw-r--r-- | bin/gitano-post-receive-hook.in | 37 |
1 files changed, 29 insertions, 8 deletions
diff --git a/bin/gitano-post-receive-hook.in b/bin/gitano-post-receive-hook.in index b272b17..f495d89 100644 --- a/bin/gitano-post-receive-hook.in +++ b/bin/gitano-post-receive-hook.in @@ -23,6 +23,7 @@ local start_log_level = gitano.log.get_level() -- Clamp level at info until we have checked if the caller -- is an admin or not gitano.log.cap_level(gitano.log.level.INFO) +gitano.log.syslog.open() local repo_root = luxio.getenv("GITANO_ROOT") local username = luxio.getenv("GITANO_USER") or "gitano/anonymous" @@ -90,27 +91,41 @@ end -- that the updates (if any) will have been applied if updates["refs/gitano/admin"] then - gitano.log.chat("<" .. repo.name .. ">", - "Any changes to admin ref have been applied.") + local msg = "<" .. repo.name .. ">" .. " Any changes to admin ref have been applied." + + gitano.log.chat(msg) + gitano.log.syslog.info(msg) end local function report_repo(reponame, repo, msg) if repo then - gitano.log.chat("<" .. reponame .. ">", - "Any changes to hooks etc have been applied") + local s = "<" .. reponame ..">" .. " Any changes to hooks etc have been applied" + + gitano.log.chat(s) + gitano.log.syslog.info(s) else - gitano.log.crit("<" .. reponame ..">", "Unable to process:", msg) + gitano.log.crit("<" .. reponame .. ">", "Unable to process:", msg) end end if repo.name == "gitano-admin" and updates[admin_repo.HEAD] then -- Updating the 'master' of gitano-admin, let's iterate all the repositories - gitano.log.chat("Scanning repositories to apply hook/rules updates...") + + gitano.log.syslog.info("Updating gitano-admin") + + local msg = "Scanning repositories to apply hook/rules updates..." + gitano.log.chat(msg) + gitano.log.syslog.info(msg) + local ok, msg = gitano.repository.foreach(config, report_repo) if not ok then gitano.log.crit(msg) end - gitano.log.chat("All repositories updated where possible.") + + msg = "All repositories updated where possible." + gitano.log.chat(msg) + gitano.log.syslog.info(msg) + local proc = sp.spawn({ gitano.config.lib_bin_path() .. "/gitano-update-ssh", gitano.config.repo_path() @@ -140,7 +155,11 @@ end if repo:uses_hook("post-receive") then gitano.log.debug("Configuring for post-receive hook") gitano.actions.set_supple_globals("post-receive") - gitano.log.info("Running repository post-receive hook") + + local msg = "Running repository post-receive hook" + gitano.log.info(msg) + gitano.log.syslog.info(msg) + local info = { username = username, keytag = keytag, @@ -155,4 +174,6 @@ if repo:uses_hook("post-receive") then gitano.log.info("Finished") end +gitano.log.syslog.close() + return 0 |