Sha256: 2c093272b8513e276dd996d4e0e3308b02f4634853b1a0ec8f1e8af55ee94683

Contents?: true

Size: 1.14 KB

Versions: 27

Compression:

Stored size: 1.14 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_file_extension(entry.name),
            "description" => "",
            "cookbook_versions" => {},
            "default_attributes" => {},
            "override_attributes" => {},
            "json_class" => "Chef::Environment",
            "chef_type" => "environment",
          })
        end

        def preserve_key?(key)
          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

27 entries across 27 versions & 1 rubygems

Version Path
chef-14.13.11-universal-mingw32 lib/chef/chef_fs/data_handler/environment_data_handler.rb
chef-14.12.9-universal-mingw32 lib/chef/chef_fs/data_handler/environment_data_handler.rb
chef-14.12.3-universal-mingw32 lib/chef/chef_fs/data_handler/environment_data_handler.rb
chef-13.12.14-universal-mingw32 lib/chef/chef_fs/data_handler/environment_data_handler.rb
chef-14.11.21-universal-mingw32 lib/chef/chef_fs/data_handler/environment_data_handler.rb
chef-14.10.9-universal-mingw32 lib/chef/chef_fs/data_handler/environment_data_handler.rb
chef-14.9.13-universal-mingw32 lib/chef/chef_fs/data_handler/environment_data_handler.rb
chef-14.8.12-universal-mingw32 lib/chef/chef_fs/data_handler/environment_data_handler.rb
chef-14.7.17-universal-mingw32 lib/chef/chef_fs/data_handler/environment_data_handler.rb
chef-13.12.3-universal-mingw32 lib/chef/chef_fs/data_handler/environment_data_handler.rb
chef-14.6.47-universal-mingw32 lib/chef/chef_fs/data_handler/environment_data_handler.rb
chef-13.11.3-universal-mingw32 lib/chef/chef_fs/data_handler/environment_data_handler.rb
chef-14.5.33-universal-mingw32 lib/chef/chef_fs/data_handler/environment_data_handler.rb
chef-13.10.4-universal-mingw32 lib/chef/chef_fs/data_handler/environment_data_handler.rb
chef-14.3.37-universal-mingw32 lib/chef/chef_fs/data_handler/environment_data_handler.rb
chef-13.10.0-universal-mingw32 lib/chef/chef_fs/data_handler/environment_data_handler.rb
chef-13.9.4-universal-mingw32 lib/chef/chef_fs/data_handler/environment_data_handler.rb
chef-14.2.0-universal-mingw32 lib/chef/chef_fs/data_handler/environment_data_handler.rb
chef-14.1.12-universal-mingw32 lib/chef/chef_fs/data_handler/environment_data_handler.rb
chef-14.1.1-universal-mingw32 lib/chef/chef_fs/data_handler/environment_data_handler.rb