summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChr1831 <Chris@Chr1831.com>2013-03-29 16:38:04 -0700
committerChr1831 <Chris@Chr1831.com>2013-03-29 16:38:04 -0700
commit8c55d8f76c032385906a17199f53efe96e7e25cd (patch)
tree99539fec14d96f993d1201d1c751900e81f052e2
parent93bfff7b3fc30fc362b90c4d362528f6e49786e6 (diff)
downloadgitlab-shell-8c55d8f76c032385906a17199f53efe96e7e25cd.tar.gz
Added fallback to default to localhost if the redis configuration block is missing in config.yml
-rw-r--r--lib/gitlab_update.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/gitlab_update.rb b/lib/gitlab_update.rb
index acb99cb..93f9c41 100644
--- a/lib/gitlab_update.rb
+++ b/lib/gitlab_update.rb
@@ -51,9 +51,13 @@ class GitlabUpdate
end
def update_redis
- command = "#{@redis['bin']} -h #{@redis['host']} -p #{@redis['port']} rpush '#{@redis['namespace']}:queue:post_receive' "+
- "'{\"class\":\"PostReceive\",\"args\":[\"#{@repo_path}\",\"#{@oldrev}\",\"#{@newrev}\",\"#{@refname}\",\"#{@key_id}\"]}' > /dev/null 2>&1"
+ if @redis.present?
+ redis_command = "#{@redis['bin']} -h #{@redis['host']} -p #{@redis['port']} rpush '#{@redis['namespace']}:queue:post_receive'"
+ else
+ redis_commend = "env -i redis-cli"
+ end
+ command = "#{redis_command} '{\"class\":\"PostReceive\",\"args\":[\"#{@repo_path}\",\"#{@oldrev}\",\"#{@newrev}\",\"#{@refname}\",\"#{@key_id}\"]}' > /dev/null 2>&1"
system(command)
end
end