Puppet Function: process_mcx_options
- Defined in:
- lib/puppet/parser/functions/process_mcx_options.rb
- Function type:
- Ruby 3.x API
Overview
Returns a com.apple.ManagedClient.preferences Payload.
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/puppet/parser/functions/process_mcx_options.rb', line 4 newfunction(:process_mcx_options, :type => :rvalue, :doc => <<-EOS Returns a com.apple.ManagedClient.preferences Payload. EOS ) do |args| if args.size != 5 e = "process_mcx_options(): Wrong number of args: #{args.size} for 5" raise(Puppet::ParseError, e) end bluetooth, wifi, loginitems, suppress_icloud_setup, hidden_preference_panes = *args settings = { 'com.apple.MCXBluetooth' => {}, 'com.apple.MCXAirPort' => {}, 'loginwindow' => {}, 'com.apple.SetupAssistant' => {}, 'com.apple.systempreferences' => {}, } case bluetooth when TrueClass, FalseClass settings['com.apple.MCXBluetooth'] = { 'Forced' => [ { 'mcx_preference_settings' => { 'DisableBluetooth' => true } } ] } else settings.delete('com.apple.MCXBluetooth') end case wifi when TrueClass, FalseClass settings['com.apple.MCXAirPort'] = { 'Forced' => [ { 'mcx_preference_settings' => { 'DisableAirPort' => true } } ] } else settings.delete('com.apple.MCXAirPort') end if loginitems.empty? settings.delete('loginwindow') else values = loginitems.collect do |path| Hash['Hide', false, 'Path', path] end settings['loginwindow'] = { 'Forced' => [ { 'mcx_preference_settings' => { 'AutoLaunchedApplicationDictionary-managed' => values, 'DisableLoginItemsSuppression' => false, 'LoginUserMayAddItems' => true, } }, ] } end case suppress_icloud_setup when true settings['com.apple.SetupAssistant'] = { 'Set-Once' => [ { 'mcx_data_timestamp' => Time.parse('2013-10-29T17:20:10'), 'mcx_preference_settings' => { 'DidSeeCloudSetup' => true, 'LastSeenCloudProductVersion' => lookupvar('macosx_productversion_major'), }, }, ] } else settings.delete('com.apple.SetupAssistant') end if hidden_preference_panes.empty? settings.delete('com.apple.systempreferences') else settings['com.apple.systempreferences'] = { 'Forced' => [ { 'mcx_preference_settings' => { 'HiddenPreferencePanes' => hidden_preference_panes, } }, ] } end return [] if settings.empty? # Return a PayloadContent Array hash = { 'PayloadType' => 'com.apple.ManagedClient.preferences', 'PayloadContent' => settings, } [hash] end |