[icinga-checkins] icinga.org: chef-icinga2/master: update server_region with cloud provider only if new_resource.server_region is not set

git at icinga.org git at icinga.org
Sat Jul 16 19:49:37 CEST 2016


Module: chef-icinga2
Branch: master
Commit: 1e3e1bdf5583c702d8d230ddef996b5d978cb2e4
URL:    https://git.icinga.org/?p=chef-icinga2.git;a=commit;h=1e3e1bdf5583c702d8d230ddef996b5d978cb2e4

Author: Virender Khatri <vir.khatri at gmail.com>
Date:   Sat Jul 16 23:33:43 2016 +0530

update server_region with cloud provider only if new_resource.server_region is not set

---

 libraries/provider_environment.rb |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/libraries/provider_environment.rb b/libraries/provider_environment.rb
index 696a5fe..2b6e275 100644
--- a/libraries/provider_environment.rb
+++ b/libraries/provider_environment.rb
@@ -40,9 +40,10 @@ class Chef
 
       def object_template
         search_pattern = new_resource.search_pattern || "chef_environment:#{new_resource.environment}"
-        if new_resource.limit_region && !new_resource.server_region
-          server_region = nil
-          server_region node['ec2']['placement_availability_zone'].chop if node.key?('ec2')
+        server_region = new_resource.server_region
+
+        if new_resource.limit_region && !server_region
+          server_region = node['ec2']['placement_availability_zone'].chop if node.key?('ec2')
         end
         env_resources = new_resource.env_resources || Icinga2::Search.new(:environment => new_resource.environment,
                                                                           :enable_cluster_hostgroup => new_resource.enable_cluster_hostgroup,



More information about the icinga-checkins mailing list