Sha256: 02f801d0e92da4dae8c9bf1aed44bf0aed4390a9aee455bdb929f1bcd6d16774
Contents?: true
Size: 1.23 KB
Versions: 8
Compression:
Stored size: 1.23 KB
Contents
require 'chef_fs/data_handler/data_handler_base' require 'chef/api_client' module ChefFS module DataHandler class GroupDataHandler < DataHandlerBase def normalize(group, entry) defaults = { 'name' => remove_dot_json(entry.name), 'groupname' => remove_dot_json(entry.name), 'users' => [], 'clients' => [], 'groups' => [], } if entry.org defaults['orgname'] = entry.org end result = normalize_hash(group, defaults) if result['actors'] && result['actors'].sort.uniq == (result['users'] + result['clients']).sort.uniq result.delete('actors') end result end def normalize_for_put(group, entry) result = super(group, entry) result['actors'] = { 'users' => result['users'], 'clients' => result['clients'], 'groups' => result['groups'] } result.delete('users') result.delete('clients') result.delete('groups') 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
8 entries across 8 versions & 1 rubygems