Permalink
Browse files

haproxy v1.0.1

* support instance where lb and pool are on the same node
  • Loading branch information...
1 parent ab44237 commit 1254eaf92b7026755a9cd758e09ef4b9a697ec69 @schisamo schisamo committed Jun 2, 2011
Showing with 9 additions and 3 deletions.
  1. +1 −1 haproxy/metadata.rb
  2. +8 −2 haproxy/recipes/app_lb.rb
View
@@ -3,7 +3,7 @@
license "Apache 2.0"
description "Installs and configures haproxy"
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
-version "1.0.0"
+version "1.0.1"
recipe "haproxy", "Installs and configures haproxy"
recipe "haproxy::app_lb", "Installs and configures haproxy by searching for nodes of a particular role"
View
@@ -2,7 +2,7 @@
# Cookbook Name:: haproxy
# Recipe:: app_lb
#
-# Copyright 2010, Opscode, Inc.
+# Copyright 2011, Opscode, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -17,7 +17,13 @@
# limitations under the License.
#
-pool_members = search("node", "role:#{node['haproxy']['app_server_role']} AND chef_environment:#{node.chef_environment}") || []
+pool_members = []
+# if we are the load balancer and pool
+if node.run_list.roles.include?(node['haproxy']['app_server_role'])
+ pool_members << node
+else
+ pool_members << search("node", "role:#{node['haproxy']['app_server_role']} AND chef_environment:#{node.chef_environment}")
+end
package "haproxy" do
action :install

0 comments on commit 1254eaf

Please sign in to comment.