Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

optional_installs support for munki #152

Closed
clburlison opened this issue Mar 13, 2018 · 2 comments
Closed

optional_installs support for munki #152

clburlison opened this issue Mar 13, 2018 · 2 comments

Comments

@clburlison
Copy link
Contributor

Since munki/munki#837 was merged it might be nice to add optional_installs support into cpe_munki. The following diff works for me.

A) would the fb team accept the PR?
B) should we wait until an official release of munki before merging into cpe_munki?

diff --git a/cookbooks/cpe_munki/attributes/default.rb b/cookbooks/cpe_munki/attributes/default.rb
index c2a2b35..dc43010 100644
--- a/cookbooks/cpe_munki/attributes/default.rb
+++ b/cookbooks/cpe_munki/attributes/default.rb
@@ -19,6 +19,7 @@ default['cpe_munki'] = {
 default['cpe_munki']['local'] = {
   'managed_installs' => [],
   'managed_uninstalls' => [],
+  'optional_installs' => [],
 }
 default['cpe_munki']['preferences'] = {
   'AppleSoftwareUpdatesOnly' => false,
diff --git a/cookbooks/cpe_munki/resources/cpe_munki_local.rb b/cookbooks/cpe_munki/resources/cpe_munki_local.rb
index bb46ee8..507a135 100644
--- a/cookbooks/cpe_munki/resources/cpe_munki_local.rb
+++ b/cookbooks/cpe_munki/resources/cpe_munki_local.rb
@@ -20,7 +20,8 @@ default_action :run
 
 action :run do
   locals_exist = node['cpe_munki']['local']['managed_installs'].any? ||
-                node['cpe_munki']['local']['managed_uninstalls'].any?
+                node['cpe_munki']['local']['managed_uninstalls'].any? ||
+                node['cpe_munki']['local']['optional_installs'].any?
 
   return unless locals_exist
   return unless ::File.exist?('/usr/local/munki/managedsoftwareupdate')
@@ -71,9 +72,13 @@ def gen_plist
   uninstalls = validate_install_array(
     node['cpe_munki']['local']['managed_uninstalls'],
   )
+  optional = validate_install_array(
+    node['cpe_munki']['local']['optional_installs'],
+  )
   plist_hash = {
     'managed_installs' => installs,
     'managed_uninstalls' => uninstalls,
+    'optional_installs' => optional,
   }
   ::Chef::Log.info("cpe_munki_local: Managed installs: #{installs}")
   Plist::Emit.dump(plist_hash) unless plist_hash.nil?
diff --git a/cookbooks/cpe_user_customizations/recipes/clayton.burlison.rb b/cookbooks/cpe_user_customizations/recipes/clayton.burlison.rb
index 2ab8a19..c41ec2d 100644
@mikedodge04
Copy link
Contributor

What no PR? :P

@natewalck
Copy link
Contributor

Hey @clburlison! Would you mind cutting a PR for this so we can get it merged in? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants