Sha256: ac824047c6981992f5cb757d995f133670eae634b456aaa1db74cdafffc65478

Contents?: true

Size: 1.11 KB

Versions: 30

Compression:

Stored size: 1.11 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)
          return 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

30 entries across 30 versions & 1 rubygems

Version Path
chef-12.18.31-universal-mingw32 lib/chef/chef_fs/data_handler/organization_data_handler.rb
chef-12.18.31 lib/chef/chef_fs/data_handler/organization_data_handler.rb
chef-12.17.44-universal-mingw32 lib/chef/chef_fs/data_handler/organization_data_handler.rb
chef-12.17.44 lib/chef/chef_fs/data_handler/organization_data_handler.rb
chef-12.16.42 lib/chef/chef_fs/data_handler/organization_data_handler.rb
chef-12.16.42-universal-mingw32 lib/chef/chef_fs/data_handler/organization_data_handler.rb
chef-12.15.19 lib/chef/chef_fs/data_handler/organization_data_handler.rb
chef-12.15.19-universal-mingw32 lib/chef/chef_fs/data_handler/organization_data_handler.rb
chef-12.14.89-universal-mingw32 lib/chef/chef_fs/data_handler/organization_data_handler.rb
chef-12.14.89 lib/chef/chef_fs/data_handler/organization_data_handler.rb
chef-12.14.77-universal-mingw32 lib/chef/chef_fs/data_handler/organization_data_handler.rb
chef-12.14.77 lib/chef/chef_fs/data_handler/organization_data_handler.rb
chef-12.14.60-universal-mingw32 lib/chef/chef_fs/data_handler/organization_data_handler.rb
chef-12.14.60 lib/chef/chef_fs/data_handler/organization_data_handler.rb
chef-12.13.37-universal-mingw32 lib/chef/chef_fs/data_handler/organization_data_handler.rb
chef-12.13.37 lib/chef/chef_fs/data_handler/organization_data_handler.rb
chef-12.13.30 lib/chef/chef_fs/data_handler/organization_data_handler.rb
chef-12.13.30-universal-mingw32 lib/chef/chef_fs/data_handler/organization_data_handler.rb
chef-12.12.15-universal-mingw32 lib/chef/chef_fs/data_handler/organization_data_handler.rb
chef-12.12.15 lib/chef/chef_fs/data_handler/organization_data_handler.rb