diff --git a/lib/ridley/client.rb b/lib/ridley/client.rb index 627e29e..b41721c 100644 --- a/lib/ridley/client.rb +++ b/lib/ridley/client.rb @@ -7,7 +7,7 @@ def initialize(registry, options) options[:server_url], options[:client_name], options[:client_key], - options.slice(*Ridley::Connection::VALID_OPTIONS) + Buff::Extensions::Hash.slice(options, *Ridley::Connection::VALID_OPTIONS) ], as: :connection_pool) end end @@ -16,15 +16,15 @@ class ResourcesSupervisor < ::Celluloid::SupervisionGroup def initialize(registry, connection_registry, options) super(registry) supervise_as :client_resource, Ridley::ClientResource, connection_registry - supervise_as :cookbook_resource, Ridley::CookbookResource, connection_registry, - options[:client_name], options[:client_key], options.slice(*Ridley::Connection::VALID_OPTIONS) + supervise_as :cookbook_resource, Ridley::CookbookResource, connection_registry, options[:client_name], + options[:client_key], Buff::Extensions::Hash.slice(options, *Ridley::Connection::VALID_OPTIONS) supervise_as :data_bag_resource, Ridley::DataBagResource, connection_registry, options[:encrypted_data_bag_secret] supervise_as :environment_resource, Ridley::EnvironmentResource, connection_registry supervise_as :node_resource, Ridley::NodeResource, connection_registry, options supervise_as :role_resource, Ridley::RoleResource, connection_registry - supervise_as :sandbox_resource, Ridley::SandboxResource, connection_registry, - options[:client_name], options[:client_key], options.slice(*Ridley::Connection::VALID_OPTIONS) + supervise_as :sandbox_resource, Ridley::SandboxResource, connection_registry, options[:client_name], + options[:client_key], Buff::Extensions::Hash.slice(options, *Ridley::Connection::VALID_OPTIONS) supervise_as :search_resource, Ridley::SearchResource, connection_registry supervise_as :user_resource, Ridley::UserResource, connection_registry end @@ -49,7 +49,7 @@ def validate_options(options) raise ArgumentError, "Missing required option(s): #{missing.join(', ')}" end - missing_values = options.slice(*REQUIRED_OPTIONS).select { |key, value| !value.present? } + missing_values = Buff::Extensions::Hash.slice(options, *REQUIRED_OPTIONS).select { |key, value| !value.present? } if missing_values.any? values = missing_values.keys.collect { |opt| "'#{opt}'" } raise ArgumentError, "Missing value for required option(s): '#{values.join(', ')}'" diff --git a/lib/ridley/connection.rb b/lib/ridley/connection.rb index 09f1c85..21caf10 100644 --- a/lib/ridley/connection.rb +++ b/lib/ridley/connection.rb @@ -65,7 +65,7 @@ def initialize(server_url, client_name, client_key, options = {}) b.adapter :net_http_persistent end - uri_hash = Addressable::URI.parse(server_url).to_hash.slice(:scheme, :host, :port) + uri_hash = Buff::Extensions::Hash.slice(Addressable::URI.parse(server_url).to_hash, :scheme, :host, :port) unless uri_hash[:port] uri_hash[:port] = (uri_hash[:scheme] == "https" ? 443 : 80) diff --git a/lib/ridley/resources/cookbook_resource.rb b/lib/ridley/resources/cookbook_resource.rb index 1bd1d2e..87eaad1 100644 --- a/lib/ridley/resources/cookbook_resource.rb +++ b/lib/ridley/resources/cookbook_resource.rb @@ -225,7 +225,7 @@ def upload(path, options = {}) sandbox.upload(checksums) sandbox.commit - update(cookbook, options.slice(:force, :freeze)) + update(cookbook, Buff::Extensions::Hash.slice(options, :force, :freeze)) ensure # Destroy the compiled metadata only if it was created File.delete(compiled_metadata) unless compiled_metadata.nil?