From fb73d4ae3a0c20a3c0dfa5a85b652b8f0cba5a32 Mon Sep 17 00:00:00 2001 From: tylercloke Date: Mon, 1 Jun 2015 15:09:40 -0700 Subject: Fixed bug where boolean fields would not be populated in Chef::User/ApiClient. --- lib/chef/api_client.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lib/chef/api_client.rb') diff --git a/lib/chef/api_client.rb b/lib/chef/api_client.rb index f3a83d7bcb..9e964081ec 100644 --- a/lib/chef/api_client.rb +++ b/lib/chef/api_client.rb @@ -141,9 +141,9 @@ class Chef 'json_class' => self.class.name, "chef_type" => "client" } - result["private_key"] = @private_key if @private_key - result["public_key"] = @public_key if @public_key - result["create_key"] = @create_key if @create_key + result["private_key"] = @private_key unless @private_key.nil? + result["public_key"] = @public_key unless @public_key.nil? + result["create_key"] = @create_key unless @create_key.nil? result end @@ -269,7 +269,7 @@ class Chef } begin # try API V1 - raise Chef::Exceptions::InvalidClientAttribute, "You cannot set both public_key and create_key for create." if create_key && public_key + raise Chef::Exceptions::InvalidClientAttribute, "You cannot set both public_key and create_key for create." if !create_key.nil? && !public_key.nil? payload[:public_key] = public_key unless public_key.nil? payload[:create_key] = create_key unless create_key.nil? -- cgit v1.2.1