Sha256: 04807da6784f4fc2dc4261ad3c2d6d8c0c28e479d800bc1e260e0d2afffa52fe

Contents?: true

Size: 1.1 KB

Versions: 87

Compression:

Stored size: 1.1 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

87 entries across 87 versions & 1 rubygems

Version Path
chef-14.15.6 lib/chef/chef_fs/data_handler/organization_data_handler.rb
chef-14.15.6-universal-mingw32 lib/chef/chef_fs/data_handler/organization_data_handler.rb
chef-14.14.29 lib/chef/chef_fs/data_handler/organization_data_handler.rb
chef-14.14.29-universal-mingw32 lib/chef/chef_fs/data_handler/organization_data_handler.rb
chef-14.14.25-universal-mingw32 lib/chef/chef_fs/data_handler/organization_data_handler.rb
chef-14.14.25 lib/chef/chef_fs/data_handler/organization_data_handler.rb
chef-14.14.14-universal-mingw32 lib/chef/chef_fs/data_handler/organization_data_handler.rb
chef-14.14.14 lib/chef/chef_fs/data_handler/organization_data_handler.rb
chef-14.13.11 lib/chef/chef_fs/data_handler/organization_data_handler.rb
chef-14.12.9 lib/chef/chef_fs/data_handler/organization_data_handler.rb
chef-14.12.3 lib/chef/chef_fs/data_handler/organization_data_handler.rb
chef-13.12.14 lib/chef/chef_fs/data_handler/organization_data_handler.rb
chef-14.11.21 lib/chef/chef_fs/data_handler/organization_data_handler.rb
chef-14.10.9 lib/chef/chef_fs/data_handler/organization_data_handler.rb
chef-14.9.13 lib/chef/chef_fs/data_handler/organization_data_handler.rb
chef-14.8.12 lib/chef/chef_fs/data_handler/organization_data_handler.rb
chef-14.7.17 lib/chef/chef_fs/data_handler/organization_data_handler.rb
chef-13.12.3 lib/chef/chef_fs/data_handler/organization_data_handler.rb
chef-14.6.47 lib/chef/chef_fs/data_handler/organization_data_handler.rb
chef-13.11.3 lib/chef/chef_fs/data_handler/organization_data_handler.rb