diff options
author | Chr1831 <Chris@Chr1831.com> | 2013-03-29 16:38:04 -0700 |
---|---|---|
committer | Chr1831 <Chris@Chr1831.com> | 2013-03-29 16:40:44 -0700 |
commit | 20eea0c76a7aee8088b55c45b0baa252f13f7f5d (patch) | |
tree | 99539fec14d96f993d1201d1c751900e81f052e2 | |
parent | 93bfff7b3fc30fc362b90c4d362528f6e49786e6 (diff) | |
download | gitlab-shell-20eea0c76a7aee8088b55c45b0baa252f13f7f5d.tar.gz |
Added fallback to default to localhost if the redis configuration block is missing or empty in config.yml
-rw-r--r-- | lib/gitlab_update.rb | 8 |
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 |