X-Git-Url: https://git.openstreetmap.org/chef.git/blobdiff_plain/9bca5f05185dde08efcf2d5f1a2bf66c8cdc9f00..846b489e99b9e5237dd230d19da419be88635677:/cookbooks/postgresql/libraries/postgresql.rb diff --git a/cookbooks/postgresql/libraries/postgresql.rb b/cookbooks/postgresql/libraries/postgresql.rb index 0b405e89b..266a7b833 100644 --- a/cookbooks/postgresql/libraries/postgresql.rb +++ b/cookbooks/postgresql/libraries/postgresql.rb @@ -1,4 +1,4 @@ -require 'chef/mixin/command' +require "chef/mixin/command" class Chef class PostgreSQL @@ -6,7 +6,7 @@ class Chef TABLE_PRIVILEGES = [ :select, :insert, :update, :delete, :truncate, :references, :trigger - ] + ].freeze def initialize(cluster) @cluster = cluster @@ -109,7 +109,7 @@ class Chef def parse_acl(acl) acl.sub(/^\{(.*)\}$/, "\\1").split(",").each_with_object({}) do |entry, permissions| - entry = entry.sub(/^"(.*)"$/) { Regexp.last_match[1].gsub(/\\"/, '"') }.sub(/\/.*$/, "") + entry = entry.sub(/^"(.*)"$/) { Regexp.last_match[1].gsub(/\\"/, '"') }.sub(%r{/.*$}, "") user, privileges = entry.split("=") user = user.sub(/^"(.*)"$/, "\\1") @@ -118,7 +118,7 @@ class Chef permissions[user] = { "a" => :insert, "r" => :select, "w" => :update, "d" => :delete, "D" => :truncate, "x" => :references, "t" => :trigger - }.values_at(*(privileges.chars)).compact + }.values_at(*privileges.chars).compact end end end