summaryrefslogtreecommitdiff
path: root/lib/chef/chef_fs/data_handler/policy_group_data_handler.rb
diff options
context:
space:
mode:
authorDaniel Steen <dsteen@millennialmedia.com>2016-01-19 18:34:46 -0500
committerDaniel Steen <dsteen@millennialmedia.com>2016-01-19 18:34:46 -0500
commit7ec34e35657ca1f0330667da53bec1366ba5bdf8 (patch)
tree8f9df4bd48111b36baf5f8045be6c99035bc340c /lib/chef/chef_fs/data_handler/policy_group_data_handler.rb
parent3c6bc501334880f01ff41dc3cc8d32122adcaeba (diff)
parent25b2c0559caaf29872d6cfe3ab146cb63c496d00 (diff)
downloadchef-7ec34e35657ca1f0330667da53bec1366ba5bdf8.tar.gz
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'lib/chef/chef_fs/data_handler/policy_group_data_handler.rb')
-rw-r--r--lib/chef/chef_fs/data_handler/policy_group_data_handler.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/lib/chef/chef_fs/data_handler/policy_group_data_handler.rb b/lib/chef/chef_fs/data_handler/policy_group_data_handler.rb
new file mode 100644
index 0000000000..e5c430ab64
--- /dev/null
+++ b/lib/chef/chef_fs/data_handler/policy_group_data_handler.rb
@@ -0,0 +1,27 @@
+require "chef/chef_fs/data_handler/data_handler_base"
+
+class Chef
+ module ChefFS
+ module DataHandler
+ class PolicyGroupDataHandler < DataHandlerBase
+
+ def normalize(policy_group, entry)
+ defaults = {
+ "name" => remove_dot_json(entry.name),
+ "policies" => {},
+ }
+ result = normalize_hash(policy_group, defaults)
+ result.delete("uri") # not useful data
+ result
+ end
+
+ def verify_integrity(object_data, entry, &on_error)
+ if object_data["policies"].empty?
+ on_error.call("Policy group #{object_data["name"]} does not have any policies in it.")
+ end
+ end
+
+ end
+ end
+ end
+end