summaryrefslogtreecommitdiff
path: root/lib/chef/user.rb
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2017-02-13 09:52:10 -0800
committerLamont Granquist <lamont@scriptkiddie.org>2017-02-13 09:52:10 -0800
commit404a9bc88be538769c6c80b3b31f39a6582991d2 (patch)
tree2f8795e5f64153440c22a522d669c235a627f289 /lib/chef/user.rb
parentb949a48acc21d4b64869bd7b834708d5232b1f2a (diff)
downloadchef-404a9bc88be538769c6c80b3b31f39a6582991d2.tar.gz
fix specs: RedundantReturn, RedundantSelf, RedundantBegin
department of redundancy department Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'lib/chef/user.rb')
-rw-r--r--lib/chef/user.rb20
1 files changed, 9 insertions, 11 deletions
diff --git a/lib/chef/user.rb b/lib/chef/user.rb
index 261ce43ef2..fffaa106f8 100644
--- a/lib/chef/user.rb
+++ b/lib/chef/user.rb
@@ -97,10 +97,10 @@ class Chef
end
def create
- payload = { :name => self.name, :admin => self.admin, :password => self.password }
+ payload = { :name => name, :admin => admin, :password => password }
payload[:public_key] = public_key if public_key
new_user = chef_rest_v0.post("users", payload)
- Chef::User.from_hash(self.to_hash.merge(new_user))
+ Chef::User.from_hash(to_hash.merge(new_user))
end
def update(new_key = false)
@@ -108,18 +108,16 @@ class Chef
payload[:private_key] = new_key if new_key
payload[:password] = password if password
updated_user = chef_rest_v0.put("users/#{name}", payload)
- Chef::User.from_hash(self.to_hash.merge(updated_user))
+ Chef::User.from_hash(to_hash.merge(updated_user))
end
def save(new_key = false)
- begin
- create
- rescue Net::HTTPServerException => e
- if e.response.code == "409"
- update(new_key)
- else
- raise e
- end
+ create
+ rescue Net::HTTPServerException => e
+ if e.response.code == "409"
+ update(new_key)
+ else
+ raise e
end
end