Sha256: f405aa48d2053d567063ac7b7c6d4241167e5d03b2b7b92740d4f96102b19217
Contents?: true
Size: 1.42 KB
Versions: 87
Compression:
Stored size: 1.42 KB
Contents
require "chef/chef_fs/data_handler/data_handler_base" require "chef/api_client" class Chef 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 normalize_for_post(group, entry) normalize_for_put(group, entry) end def preserve_key?(key) key == "name" end def chef_class Chef::ApiClient end # There is no Ruby API for Chef::ApiClient end end end end
Version data entries
87 entries across 87 versions & 1 rubygems