Sha256: d732ccd62c2a502ad03ce96e8aed651ee3ad972ade420ef5bc14009168e118c3

Contents?: true

Size: 879 Bytes

Versions: 14

Compression:

Stored size: 879 Bytes

Contents

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

module ChefFS
  module DataHandler
    class ClientDataHandler < DataHandlerBase
      def normalize(client, entry)
        defaults = {
          'name' => remove_dot_json(entry.name),
          'clientname' => remove_dot_json(entry.name),
          'orgname' => entry.org,
          'admin' => false,
          'validator' => false,
          'chef_type' => 'client'
        }
        if entry.org
          defaults['orgname'] = entry.org
        end
        result = super(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

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
knife-essentials-1.3 lib/chef_fs/data_handler/client_data_handler.rb
knife-essentials-1.2.1 lib/chef_fs/data_handler/client_data_handler.rb
knife-essentials-1.2 lib/chef_fs/data_handler/client_data_handler.rb
knife-essentials-1.1.1 lib/chef_fs/data_handler/client_data_handler.rb
knife-essentials-1.1 lib/chef_fs/data_handler/client_data_handler.rb
knife-essentials-1.0.0 lib/chef_fs/data_handler/client_data_handler.rb
knife-essentials-1.0.0.beta5 lib/chef_fs/data_handler/client_data_handler.rb
knife-essentials-1.0.0.beta4 lib/chef_fs/data_handler/client_data_handler.rb
knife-essentials-1.0.0.beta3 lib/chef_fs/data_handler/client_data_handler.rb
knife-essentials-1.0.0.beta2 lib/chef_fs/data_handler/client_data_handler.rb
knife-essentials-1.0.0.beta1 lib/chef_fs/data_handler/client_data_handler.rb
knife-essentials-0.9.8 lib/chef_fs/data_handler/client_data_handler.rb
knife-essentials-0.9.7 lib/chef_fs/data_handler/client_data_handler.rb
knife-essentials-0.9.6 lib/chef_fs/data_handler/client_data_handler.rb