From 693cbda49e98da6505ed2815e6f9f35a02f1cf97 Mon Sep 17 00:00:00 2001 From: Bastien Jove Date: Tue, 21 May 2019 10:16:47 +0200 Subject: [PATCH] Strip slashes from partition to ensure coherence, fix the irule existence test --- libraries/base_client.rb | 4 ++-- resources/irule.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libraries/base_client.rb b/libraries/base_client.rb index 5ade7a0..583e436 100644 --- a/libraries/base_client.rb +++ b/libraries/base_client.rb @@ -5,7 +5,7 @@ def initialize(node, resource, load_balancer, partition) @node = node @resource = resource @load_balancer = load_balancer - @partition = partition + @partition = partition[%r{/?([^/]+)/?},1] # local module aliases reduce repetetive call chains @ProfileContextType = F5::Icontrol::LocalLB::ProfileContextType @@ -17,7 +17,7 @@ def initialize(node, resource, load_balancer, partition) private def strip_partition(key) - key.gsub(%r{^/Common/}, '') if key + key.gsub(%r{^/#{@partition}/}, '') if key end def with_partition(key) diff --git a/resources/irule.rb b/resources/irule.rb index 41d2032..ee7686f 100644 --- a/resources/irule.rb +++ b/resources/irule.rb @@ -12,7 +12,7 @@ actual_irule_name = new_resource.irule_name || new_resource.name irule = ChefF5::IRule.new(node, new_resource, new_resource.load_balancer, new_resource.partition) - if irule.is_missing?(actual_irule_name) + if irule.missing?(actual_irule_name) converge_by "Create IRule #{actual_irule_name}" do irule.create(actual_irule_name, new_resource.definition) return