Sha256: 3b9aa604c9a0633fd14c09589ac7312ff9061b05daa358fa019b36da9325f156

Contents?: true

Size: 1.09 KB

Versions: 64

Compression:

Stored size: 1.09 KB

Contents

require_relative "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

64 entries across 64 versions & 1 rubygems

Version Path
chef-15.17.4-universal-mingw32 lib/chef/chef_fs/data_handler/organization_data_handler.rb
chef-15.17.4 lib/chef/chef_fs/data_handler/organization_data_handler.rb
chef-15.16.7-universal-mingw32 lib/chef/chef_fs/data_handler/organization_data_handler.rb
chef-15.16.7 lib/chef/chef_fs/data_handler/organization_data_handler.rb
chef-15.16.4-universal-mingw32 lib/chef/chef_fs/data_handler/organization_data_handler.rb
chef-15.16.4 lib/chef/chef_fs/data_handler/organization_data_handler.rb
chef-15.16.2-universal-mingw32 lib/chef/chef_fs/data_handler/organization_data_handler.rb
chef-15.16.2 lib/chef/chef_fs/data_handler/organization_data_handler.rb
chef-15.15.0-universal-mingw32 lib/chef/chef_fs/data_handler/organization_data_handler.rb
chef-15.15.0 lib/chef/chef_fs/data_handler/organization_data_handler.rb
chef-15.14.0 lib/chef/chef_fs/data_handler/organization_data_handler.rb
chef-15.14.0-universal-mingw32 lib/chef/chef_fs/data_handler/organization_data_handler.rb
chef-15.13.8 lib/chef/chef_fs/data_handler/organization_data_handler.rb
chef-15.13.8-universal-mingw32 lib/chef/chef_fs/data_handler/organization_data_handler.rb
chef-16.2.73 lib/chef/chef_fs/data_handler/organization_data_handler.rb
chef-16.2.73-universal-mingw32 lib/chef/chef_fs/data_handler/organization_data_handler.rb
chef-15.12.22 lib/chef/chef_fs/data_handler/organization_data_handler.rb
chef-15.12.22-universal-mingw32 lib/chef/chef_fs/data_handler/organization_data_handler.rb
chef-16.2.50 lib/chef/chef_fs/data_handler/organization_data_handler.rb
chef-16.2.50-universal-mingw32 lib/chef/chef_fs/data_handler/organization_data_handler.rb