diff options
Diffstat (limited to 'lib/chef/org.rb')
-rw-r--r-- | lib/chef/org.rb | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/lib/chef/org.rb b/lib/chef/org.rb index cf6f605370..bed5600920 100644 --- a/lib/chef/org.rb +++ b/lib/chef/org.rb @@ -73,15 +73,15 @@ class Chef end def create - payload = { :name => self.name, :full_name => self.full_name } + payload = { :name => name, :full_name => full_name } new_org = chef_rest.post("organizations", payload) - Chef::Org.from_hash(self.to_hash.merge(new_org)) + Chef::Org.from_hash(to_hash.merge(new_org)) end def update - payload = { :name => self.name, :full_name => self.full_name } + payload = { :name => name, :full_name => full_name } new_org = chef_rest.put("organizations/#{name}", payload) - Chef::Org.from_hash(self.to_hash.merge(new_org)) + Chef::Org.from_hash(to_hash.merge(new_org)) end def destroy @@ -89,14 +89,12 @@ class Chef end def save - begin - create - rescue Net::HTTPServerException => e - if e.response.code == "409" - update - else - raise e - end + create + rescue Net::HTTPServerException => e + if e.response.code == "409" + update + else + raise e end end |