Sha256: 25f31cfa18bf5be7c5f16faa7e5b7795690df98a0b69100b23912eedb128ae24

Contents?: true

Size: 1.02 KB

Versions: 9

Compression:

Stored size: 1.02 KB

Contents

require 'chef_fs/data_handler/data_handler_base'
require 'chef/role'

module ChefFS
  module DataHandler
    class RoleDataHandler < DataHandlerBase
      def normalize(role, entry)
        result = normalize_hash(role, {
          'name' => remove_dot_json(entry.name),
          'description' => '',
          'json_class' => 'Chef::Role',
          'chef_type' => 'role',
          'default_attributes' => {},
          'override_attributes' => {},
          'run_list' => [],
          'env_run_lists' => {}
        })
        result['run_list'] = normalize_run_list(result['run_list'])
        result['env_run_lists'].each_pair do |env, run_list|
          result['env_run_lists'][env] = normalize_run_list(run_list)
        end
        result
      end

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

      def chef_class
        Chef::Role
      end

      def to_ruby(object)
        to_ruby_keys(object, %w(name description default_attributes override_attributes run_list env_run_lists))
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
knife-essentials-1.5.6 lib/chef_fs/data_handler/role_data_handler.rb
knife-essentials-1.5.5 lib/chef_fs/data_handler/role_data_handler.rb
knife-essentials-1.5.4 lib/chef_fs/data_handler/role_data_handler.rb
knife-essentials-1.5.3 lib/chef_fs/data_handler/role_data_handler.rb
knife-essentials-1.5.2 lib/chef_fs/data_handler/role_data_handler.rb
knife-essentials-1.5.1 lib/chef_fs/data_handler/role_data_handler.rb
knife-essentials-1.5 lib/chef_fs/data_handler/role_data_handler.rb
knife-essentials-1.4 lib/chef_fs/data_handler/role_data_handler.rb
knife-essentials-1.3.2 lib/chef_fs/data_handler/role_data_handler.rb