summaryrefslogtreecommitdiff
path: root/lib/chef/knife
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2018-09-26 22:22:29 -0700
committerLamont Granquist <lamont@scriptkiddie.org>2018-09-26 22:22:29 -0700
commit8400f4cb7d977896531ae277fdcf3398dc2d4c6c (patch)
tree33b8b5ba385366457de4990636daa143d64f1043 /lib/chef/knife
parent8daa1c6598182777802eba6a74928f28a32f6835 (diff)
downloadchef-8400f4cb7d977896531ae277fdcf3398dc2d4c6c.tar.gz
replace some instances of to_hash with to_hlcg/to-h-cleanup
to_hash on a lot of these objects should go away, but even eliminating all our calls to to_hash on these objects internally is difficult. (e.g. converting the knife ui code to call #to_h means we wind up calling nil#to_h which "helpfully" becomes '{}' which is hilarious and i don't know why someone thought that was a good idea). Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'lib/chef/knife')
-rw-r--r--lib/chef/knife/client_edit.rb4
-rw-r--r--lib/chef/knife/data_bag_show.rb4
-rw-r--r--lib/chef/knife/osc_user_edit.rb4
-rw-r--r--lib/chef/knife/user_edit.rb4
4 files changed, 8 insertions, 8 deletions
diff --git a/lib/chef/knife/client_edit.rb b/lib/chef/knife/client_edit.rb
index 49526c72b3..21fd3f457d 100644
--- a/lib/chef/knife/client_edit.rb
+++ b/lib/chef/knife/client_edit.rb
@@ -1,6 +1,6 @@
#
# Author:: Adam Jacob (<adam@chef.io>)
-# Copyright:: Copyright 2009-2016, Chef Software Inc.
+# Copyright:: Copyright 2009-2018, Chef Software Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -37,7 +37,7 @@ class Chef
exit 1
end
- original_data = Chef::ApiClientV1.load(@client_name).to_hash
+ original_data = Chef::ApiClientV1.load(@client_name).to_h
edited_client = edit_hash(original_data)
if original_data != edited_client
client = Chef::ApiClientV1.from_hash(edited_client)
diff --git a/lib/chef/knife/data_bag_show.rb b/lib/chef/knife/data_bag_show.rb
index 5df0561276..eeebd11832 100644
--- a/lib/chef/knife/data_bag_show.rb
+++ b/lib/chef/knife/data_bag_show.rb
@@ -1,7 +1,7 @@
#
# Author:: Adam Jacob (<adam@chef.io>)
# Author:: Seth Falcon (<seth@chef.io>)
-# Copyright:: Copyright 2009-2016, Chef Software, Inc.
+# Copyright:: Copyright 2009-2018, Chef Software Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -46,7 +46,7 @@ class Chef
raw = Chef::EncryptedDataBagItem.load(@name_args[0],
@name_args[1],
secret)
- format_for_display(raw.to_hash)
+ format_for_display(raw.to_h)
elsif encrypted && !secret
ui.warn("Encrypted data bag detected, but no secret provided for decoding. Displaying encrypted data.")
format_for_display(raw_data)
diff --git a/lib/chef/knife/osc_user_edit.rb b/lib/chef/knife/osc_user_edit.rb
index 89986c6f04..dad90199f5 100644
--- a/lib/chef/knife/osc_user_edit.rb
+++ b/lib/chef/knife/osc_user_edit.rb
@@ -1,6 +1,6 @@
#
# Author:: Steven Danna (<steve@chef.io>)
-# Copyright:: Copyright 2012-2016, Chef Software Inc.
+# Copyright:: Copyright 2012-2018, Chef Software Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -43,7 +43,7 @@ class Chef
exit 1
end
- original_user = Chef::User.load(@user_name).to_hash
+ original_user = Chef::User.load(@user_name).to_h
edited_user = edit_hash(original_user)
if original_user != edited_user
user = Chef::User.from_hash(edited_user)
diff --git a/lib/chef/knife/user_edit.rb b/lib/chef/knife/user_edit.rb
index e445a31677..eb6d74c470 100644
--- a/lib/chef/knife/user_edit.rb
+++ b/lib/chef/knife/user_edit.rb
@@ -1,6 +1,6 @@
#
# Author:: Steven Danna (<steve@chef.io>)
-# Copyright:: Copyright 2012-2016, Chef Software Inc.
+# Copyright:: Copyright 2012-2018, Chef Software Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -57,7 +57,7 @@ EOF
exit 1
end
- original_user = Chef::UserV1.load(@user_name).to_hash
+ original_user = Chef::UserV1.load(@user_name).to_h
# DEPRECATION NOTE
# Remove this if statement and corrosponding code post OSC 11 support.
#