Sha256: 905345c9234e92b7a7452ca1a3d49698bef2a8de4cd6ea572a0f6937484be789

Contents?: true

Size: 1.14 KB

Versions: 27

Compression:

Stored size: 1.14 KB

Contents

require "chef/chef_fs/data_handler/data_handler_base"

class Chef
  module ChefFS
    module DataHandler
      class OrganizationDataHandler < DataHandlerBase
        def normalize(organization, entry)
          result = normalize_hash(organization, {
            "name" => entry.org,
            "full_name" => entry.org,
            "org_type" => "Business",
            "clientname" => "#{entry.org}-validator",
            "billing_plan" => "platform-free",
          })
          result
        end

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

        # Verify that the JSON hash for this type has a key that matches its name.
        #
        # @param object [Object] JSON hash of the object
        # @param entry [Chef::ChefFS::FileSystem::BaseFSObject] filesystem object we are verifying
        # @yield  [s] callback to handle errors
        # @yieldparam [s<string>] error message
        def verify_integrity(object, entry)
          if entry.org != object["name"]
            yield("Name must be '#{entry.org}' (is '#{object['name']}')")
          end
        end
      end
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
chef-13.9.1-universal-mingw32 lib/chef/chef_fs/data_handler/organization_data_handler.rb
chef-14.0.190-universal-mingw32 lib/chef/chef_fs/data_handler/organization_data_handler.rb
chef-13.8.5-universal-mingw32 lib/chef/chef_fs/data_handler/organization_data_handler.rb
chef-13.8.3-universal-mingw32 lib/chef/chef_fs/data_handler/organization_data_handler.rb
chef-12.22.1 lib/chef/chef_fs/data_handler/organization_data_handler.rb
chef-12.22.1-universal-mingw32 lib/chef/chef_fs/data_handler/organization_data_handler.rb
chef-13.8.0-universal-mingw32 lib/chef/chef_fs/data_handler/organization_data_handler.rb