app/controllers/nodes.rb in chef-server-webui-0.9.12 vs app/controllers/nodes.rb in chef-server-webui-0.9.14.beta.1
- old
+ new
@@ -87,18 +87,18 @@
def create
begin
@node = Chef::Node.new
@node.name params[:name]
- @node.normal_attrs = JSON.parse(params[:attributes])
+ @node.normal_attrs = Chef::JSON.from_json(params[:attributes])
@node.run_list.reset!(params[:for_node] ? params[:for_node] : [])
raise ArgumentError, "Node name cannot be blank" if (params[:name].nil? || params[:name].length==0)
@node.create
redirect(url(:nodes), :message => { :notice => "Created Node #{@node.name}" })
rescue => e
Chef::Log.error("#{e}\n#{e.backtrace.join("\n")}")
- @node.normal_attrs = JSON.parse(params[:attributes])
+ @node.normal_attrs = Chef::JSON.from_json(params[:attributes])
@available_recipes = get_available_recipes
@available_roles = Chef::Role.list.keys.sort
@node.run_list params[:for_node]
@run_list = @node.run_list
@_message = { :error => "Exception raised creating node, #{e.message.length <= 150 ? e.message : "please check logs for details"}" }
@@ -108,10 +108,10 @@
def update
begin
@node = Chef::Node.load(params[:id])
@node.run_list.reset!(params[:for_node] ? params[:for_node] : [])
- @node.normal_attrs = JSON.parse(params[:attributes])
+ @node.normal_attrs = Chef::JSON.from_json(params[:attributes])
@node.save
@_message = { :notice => "Updated Node" }
render :show
rescue => e
Chef::Log.error("#{e}\n#{e.backtrace.join("\n")}")