Sha256: 643dd2f75965d3a1571d891354523f234c254cce6b238fd2af7d303abbadd9a0

Contents?: true

Size: 960 Bytes

Versions: 41

Compression:

Stored size: 960 Bytes

Contents

require 'chef/chef_fs/data_handler/data_handler_base'
require 'chef/api_client'

class Chef
  module ChefFS
    module DataHandler
      class ClientDataHandler < DataHandlerBase
        def normalize(client, entry)
          defaults = {
            'name' => remove_dot_json(entry.name),
            'clientname' => remove_dot_json(entry.name),
            'admin' => false,
            'validator' => false,
            'chef_type' => 'client'
          }
          if entry.respond_to?(:org) && entry.org
            defaults['orgname'] = entry.org
          end
          result = normalize_hash(client, defaults)
          # You can NOT send json_class, or it will fail
          result.delete('json_class')
          result
        end

        def preserve_key?(key)
          return key == 'name'
        end

        def chef_class
          Chef::ApiClient
        end

        # There is no Ruby API for Chef::ApiClient
      end
    end
  end
end

Version data entries

41 entries across 41 versions & 1 rubygems

Version Path
chef-12.4.3-universal-mingw32 lib/chef/chef_fs/data_handler/client_data_handler.rb
chef-12.4.3 lib/chef/chef_fs/data_handler/client_data_handler.rb
chef-12.4.2-universal-mingw32 lib/chef/chef_fs/data_handler/client_data_handler.rb
chef-12.4.2 lib/chef/chef_fs/data_handler/client_data_handler.rb
chef-12.5.0.alpha.1 lib/chef/chef_fs/data_handler/client_data_handler.rb
chef-12.4.1-universal-mingw32 lib/chef/chef_fs/data_handler/client_data_handler.rb
chef-12.4.1 lib/chef/chef_fs/data_handler/client_data_handler.rb
chef-12.4.0 lib/chef/chef_fs/data_handler/client_data_handler.rb
chef-12.4.0-universal-mingw32 lib/chef/chef_fs/data_handler/client_data_handler.rb
chef-12.4.0.rc.2 lib/chef/chef_fs/data_handler/client_data_handler.rb
chef-12.4.0.rc.2-universal-mingw32 lib/chef/chef_fs/data_handler/client_data_handler.rb
chef-12.4.0.rc.0 lib/chef/chef_fs/data_handler/client_data_handler.rb
chef-12.4.0.rc.0-universal-mingw32 lib/chef/chef_fs/data_handler/client_data_handler.rb
chef-12.3.0-x86-mingw32 lib/chef/chef_fs/data_handler/client_data_handler.rb
chef-12.3.0 lib/chef/chef_fs/data_handler/client_data_handler.rb
chef-12.3.0.rc.0-x86-mingw32 lib/chef/chef_fs/data_handler/client_data_handler.rb
chef-12.3.0.rc.0 lib/chef/chef_fs/data_handler/client_data_handler.rb
chef-12.2.1-x86-mingw32 lib/chef/chef_fs/data_handler/client_data_handler.rb
chef-12.2.1 lib/chef/chef_fs/data_handler/client_data_handler.rb
chef-12.2.0.rc.2-x86-mingw32 lib/chef/chef_fs/data_handler/client_data_handler.rb