Sha256: 104a6b914602c871c01218060d744c44887bfd5566cab6ce2acf3c0ce8caa0ff

Contents?: true

Size: 1.1 KB

Versions: 6

Compression:

Stored size: 1.1 KB

Contents

require "chef/chef_fs/data_handler/data_handler_base"
require "chef/environment"

class Chef
  module ChefFS
    module DataHandler
      class EnvironmentDataHandler < DataHandlerBase
        def normalize(environment, entry)
          normalize_hash(environment, {
            "name" => remove_dot_json(entry.name),
            "description" => "",
            "cookbook_versions" => {},
            "default_attributes" => {},
            "override_attributes" => {},
            "json_class" => "Chef::Environment",
            "chef_type" => "environment",
          })
        end

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

        def chef_class
          Chef::Environment
        end

        def to_ruby(object)
          result = to_ruby_keys(object, %w{name description default_attributes override_attributes})
          if object["cookbook_versions"]
            object["cookbook_versions"].each_pair do |name, version|
              result << "cookbook #{name.inspect}, #{version.inspect}"
            end
          end
          result
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
chef-12.10.24 lib/chef/chef_fs/data_handler/environment_data_handler.rb
chef-12.10.24-universal-mingw32 lib/chef/chef_fs/data_handler/environment_data_handler.rb
chef-12.9.41 lib/chef/chef_fs/data_handler/environment_data_handler.rb
chef-12.9.41-universal-mingw32 lib/chef/chef_fs/data_handler/environment_data_handler.rb
chef-12.9.38 lib/chef/chef_fs/data_handler/environment_data_handler.rb
chef-12.9.38-universal-mingw32 lib/chef/chef_fs/data_handler/environment_data_handler.rb