summaryrefslogtreecommitdiff
path: root/lib/chef/api_client.rb
diff options
context:
space:
mode:
authortylercloke <tylercloke@gmail.com>2015-06-01 15:09:40 -0700
committertylercloke <tylercloke@gmail.com>2015-06-05 10:38:49 -0700
commitfb73d4ae3a0c20a3c0dfa5a85b652b8f0cba5a32 (patch)
tree55c4821657ad8a8ab106e767e3c52b543dc0b6c4 /lib/chef/api_client.rb
parentaa569ebb6fe0c6263bcb93fae80cc65ddfaff481 (diff)
downloadchef-fb73d4ae3a0c20a3c0dfa5a85b652b8f0cba5a32.tar.gz
Fixed bug where boolean fields would not be populated in Chef::User/ApiClient.
Diffstat (limited to 'lib/chef/api_client.rb')
-rw-r--r--lib/chef/api_client.rb8
1 files changed, 4 insertions, 4 deletions
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?