Skip to content

Commit 8469a48

Browse files
sdelanoSeth Falcon
authored andcommitted
delete environments from webui
1 parent 70ba60c commit 8469a48

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

chef-server-webui/app/controllers/environments.rb

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,16 @@ def update
7272

7373
# DELETE /environments/:id
7474
def destroy
75-
# TODO: implement this
75+
begin
76+
@environment = Chef::Environment.load(params[:id])
77+
@environment.destroy
78+
redirect(absolute_url(:environments), :message => { :notice => "Environment #{@environment.name} deleted successfully." }, :permanent => true)
79+
rescue => e
80+
Chef::Log.error("#{e}\n#{e.backtrace.join("\n")}")
81+
@environment_list = Chef::Environment.list()
82+
@_message = {:error => "Could not delete environment #{params[:id]}: #{e.message}"}
83+
render :index
84+
end
7685
end
7786

7887
# GET /environments/:environment_id/cookbooks

0 commit comments

Comments
 (0)