From ad8fa9ba5f36d9cf794bf224a774310e0d66588c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Seux?= Date: Fri, 5 Feb 2016 14:51:21 +0100 Subject: [PATCH] Correct acl creation Otherwise the diplomat gem raise an exception. Diplomat::Acl.info expects a third argument to specify the behavior when the acl does not exist. Default value is to raise an exception. also updates the rubocop rule name to make test pass --- .rubocop.yml | 2 +- libraries/consul_acl.rb | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index b476a527..ffbb410f 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -32,7 +32,7 @@ Metrics/AbcSize: Enabled: false PerceivedComplexity: Enabled: false -Style/SingleSpaceBeforeFirstArg: +Style/SpaceBeforeFirstArg: Enabled: false Style/ClassAndModuleChildren: Enabled: false diff --git a/libraries/consul_acl.rb b/libraries/consul_acl.rb index 45f3ac08..99314e90 100644 --- a/libraries/consul_acl.rb +++ b/libraries/consul_acl.rb @@ -84,10 +84,10 @@ def configure_diplomat end def up_to_date? - old_acl = Diplomat::Acl.info(new_resource.to_acl['ID']).first + old_acl = Diplomat::Acl.info(new_resource.to_acl['ID'], nil, :return) return false if old_acl.nil? - old_acl.select! { |k, _v| %w(ID Type Name Rules).include?(k) } - old_acl == new_resource.to_acl + old_acl.first.select! { |k, _v| %w(ID Type Name Rules).include?(k) } + old_acl.first == new_resource.to_acl end end end