summaryrefslogtreecommitdiff
path: root/lib/chef/chef_fs/data_handler/node_data_handler.rb
blob: dfa094cbaaf5d8d259e449c15606c546146113dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
require "chef/chef_fs/data_handler/data_handler_base"
require "chef/node"

class Chef
  module ChefFS
    module DataHandler
      class NodeDataHandler < DataHandlerBase
        def normalize(node, entry)
          result = normalize_hash(node, {
            "name" => remove_dot_json(entry.name),
            "json_class" => "Chef::Node",
            "chef_type" => "node",
            "chef_environment" => "_default",
            "override" => {},
            "normal" => {},
            "default" => {},
            "automatic" => {},
            "run_list" => []
          })
          result["run_list"] = normalize_run_list(result["run_list"])
          result
        end

        def preserve_key?(key)
          return key == "name"
        end

        def chef_class
          Chef::Node
        end

        # Nodes do not support .rb files
      end
    end
  end
end