From 811dd0edb98115477a166fd86fb417926a64829f Mon Sep 17 00:00:00 2001 From: Austin Culter Date: Fri, 13 Nov 2020 17:26:05 +0100 Subject: [PATCH 1/8] Replace #Hash.reject with #Hash.compact --- .../resources/configure_adobe_flash_darwin.rb | 2 +- .../resources/configure_adobe_flash_windows.rb | 2 +- itchef/cookbooks/cpe_bluetooth/resources/cpe_bluetooth.rb | 2 +- itchef/cookbooks/cpe_chrome/resources/cpe_chrome_posix.rb | 2 +- itchef/cookbooks/cpe_munki/resources/cpe_munki_config.rb | 2 +- .../cpe_munki/resources/cpe_munki_defaults_config.rb | 2 +- itchef/cookbooks/cpe_nomad/resources/darwin.rb | 6 +++--- .../cpe_powermanagement/resources/cpe_powermanagement.rb | 6 +++--- itchef/cookbooks/cpe_preferencepanes/resources/default.rb | 2 +- itchef/cookbooks/cpe_profiles_local/README.md | 4 ++-- 10 files changed, 15 insertions(+), 15 deletions(-) diff --git a/itchef/cookbooks/cpe_adobe_flash/resources/configure_adobe_flash_darwin.rb b/itchef/cookbooks/cpe_adobe_flash/resources/configure_adobe_flash_darwin.rb index c7afb8d1..c0d297c3 100644 --- a/itchef/cookbooks/cpe_adobe_flash/resources/configure_adobe_flash_darwin.rb +++ b/itchef/cookbooks/cpe_adobe_flash/resources/configure_adobe_flash_darwin.rb @@ -27,7 +27,7 @@ def config_dir def configure return unless node['cpe_adobe_flash']['configure'] - configs = node['cpe_adobe_flash']['configs'].reject { |_k, v| v.nil? } + configs = node['cpe_adobe_flash']['configs'].compact # Until adobe removes this problematic naming convention, # we still have to use it. { diff --git a/itchef/cookbooks/cpe_adobe_flash/resources/configure_adobe_flash_windows.rb b/itchef/cookbooks/cpe_adobe_flash/resources/configure_adobe_flash_windows.rb index 4b402d52..c8a0d59d 100644 --- a/itchef/cookbooks/cpe_adobe_flash/resources/configure_adobe_flash_windows.rb +++ b/itchef/cookbooks/cpe_adobe_flash/resources/configure_adobe_flash_windows.rb @@ -23,7 +23,7 @@ def configure return unless node['cpe_adobe_flash']['configure'] - configs = node['cpe_adobe_flash']['configs'].reject { |_k, v| v.nil? } + configs = node['cpe_adobe_flash']['configs'].compact node.default['cpe_adobe_flash']['_applied_configs'] = configs template ::File.join(config_dir, 'mms.cfg') do # ~FB031 diff --git a/itchef/cookbooks/cpe_bluetooth/resources/cpe_bluetooth.rb b/itchef/cookbooks/cpe_bluetooth/resources/cpe_bluetooth.rb index 830e4b60..ad67a28a 100644 --- a/itchef/cookbooks/cpe_bluetooth/resources/cpe_bluetooth.rb +++ b/itchef/cookbooks/cpe_bluetooth/resources/cpe_bluetooth.rb @@ -20,7 +20,7 @@ default_action :config action :config do - prefs = node['cpe_bluetooth'].reject { |_k, v| v.nil? } + prefs = node['cpe_bluetooth'].compact if prefs.empty? Chef::Log.info("#{cookbook_name}: No prefs found.") return diff --git a/itchef/cookbooks/cpe_chrome/resources/cpe_chrome_posix.rb b/itchef/cookbooks/cpe_chrome/resources/cpe_chrome_posix.rb index f043bbdd..4a2b7ef3 100755 --- a/itchef/cookbooks/cpe_chrome/resources/cpe_chrome_posix.rb +++ b/itchef/cookbooks/cpe_chrome/resources/cpe_chrome_posix.rb @@ -69,7 +69,7 @@ def manage_chrome !node.installed?('com.google.Chrome') if node['cpe_chrome']['mp']['UseMasterPreferencesFile'] mprefs = - node['cpe_chrome']['mp']['FileContents'].reject { |_k, v| v.nil? } + node['cpe_chrome']['mp']['FileContents'].compact else mprefs = {} end diff --git a/itchef/cookbooks/cpe_munki/resources/cpe_munki_config.rb b/itchef/cookbooks/cpe_munki/resources/cpe_munki_config.rb index f6f06667..a7ee403d 100644 --- a/itchef/cookbooks/cpe_munki/resources/cpe_munki_config.rb +++ b/itchef/cookbooks/cpe_munki/resources/cpe_munki_config.rb @@ -22,7 +22,7 @@ action :config do return unless node['cpe_munki']['configure'] - munki_prefs = node['cpe_munki']['preferences'].reject { |_k, v| v.nil? } + munki_prefs = node['cpe_munki']['preferences'].compact if munki_prefs.empty? Chef::Log.info("#{cookbook_name}: No prefs found.") return diff --git a/itchef/cookbooks/cpe_munki/resources/cpe_munki_defaults_config.rb b/itchef/cookbooks/cpe_munki/resources/cpe_munki_defaults_config.rb index ec7a0caf..9585b497 100644 --- a/itchef/cookbooks/cpe_munki/resources/cpe_munki_defaults_config.rb +++ b/itchef/cookbooks/cpe_munki/resources/cpe_munki_defaults_config.rb @@ -22,7 +22,7 @@ return unless node['cpe_munki']['configure'] munki_prefs = node['cpe_munki'][ - 'defaults_preferences'].reject { |_k, v| v.nil? } + 'defaults_preferences'].compact if munki_prefs.empty? Chef::Log.info("#{cookbook_name}: No defaults prefs found.") diff --git a/itchef/cookbooks/cpe_nomad/resources/darwin.rb b/itchef/cookbooks/cpe_nomad/resources/darwin.rb index 717b482e..1b021184 100644 --- a/itchef/cookbooks/cpe_nomad/resources/darwin.rb +++ b/itchef/cookbooks/cpe_nomad/resources/darwin.rb @@ -74,11 +74,11 @@ def configure_login def configure_profile nomad_prefs = - node['cpe_nomad']['prefs'].reject { |_k, v| v.nil? } + node['cpe_nomad']['prefs'].compact login_prefs = - node['cpe_nomad']['login']['prefs'].reject { |_k, v| v.nil? } + node['cpe_nomad']['login']['prefs'].compact actions_prefs = - node['cpe_nomad']['actions']['prefs'].reject { |_k, v| v.nil? } + node['cpe_nomad']['actions']['prefs'].compact if [ nomad_prefs, login_prefs, diff --git a/itchef/cookbooks/cpe_powermanagement/resources/cpe_powermanagement.rb b/itchef/cookbooks/cpe_powermanagement/resources/cpe_powermanagement.rb index ed75a637..48ae186e 100644 --- a/itchef/cookbooks/cpe_powermanagement/resources/cpe_powermanagement.rb +++ b/itchef/cookbooks/cpe_powermanagement/resources/cpe_powermanagement.rb @@ -21,7 +21,7 @@ default_action :config action :config do - pw_prefs = node['cpe_powermanagement'].reject { |_k, v| v.nil? } + pw_prefs = node['cpe_powermanagement'].compact if pw_prefs.empty? Chef::Log.debug("#{cookbook_name}: No prefs found.") return @@ -58,9 +58,9 @@ pm_prefs = { 'ACPower' => - node['cpe_powermanagement']['ACPower'].reject { |_k, v| v.nil? }, + node['cpe_powermanagement']['ACPower'].compact, 'Battery' => - node['cpe_powermanagement']['Battery'].reject { |_k, v| v.nil? }, + node['cpe_powermanagement']['Battery'].compact, } # Apply all settings to the profile - AC and/or Battery diff --git a/itchef/cookbooks/cpe_preferencepanes/resources/default.rb b/itchef/cookbooks/cpe_preferencepanes/resources/default.rb index 881a46bb..0a42f790 100644 --- a/itchef/cookbooks/cpe_preferencepanes/resources/default.rb +++ b/itchef/cookbooks/cpe_preferencepanes/resources/default.rb @@ -21,7 +21,7 @@ # rubocop:disable Metrics/BlockLength action :config do - prefs = node['cpe_preferencepanes'].reject { |_k, v| v.nil? } + prefs = node['cpe_preferencepanes'].compact return if prefs.empty? prefix = node['cpe_profiles']['prefix'] organization = node['organization'] ? node['organization'] : 'Facebook' diff --git a/itchef/cookbooks/cpe_profiles_local/README.md b/itchef/cookbooks/cpe_profiles_local/README.md index e2308b98..f8cf039f 100644 --- a/itchef/cookbooks/cpe_profiles_local/README.md +++ b/itchef/cookbooks/cpe_profiles_local/README.md @@ -32,7 +32,7 @@ to `node.default['cpe_profiles_local']` For instance, add a hash to manage the loginwindow and use the default prefix: ``` -lw_prefs = node['cpe_loginwindow'].reject { |\_k, v| v.nil? } +lw_prefs = node['cpe_loginwindow'].compact if lw_prefs.empty? Chef::Log.debug("#{cookbook_name}: No prefs found.") return @@ -77,7 +77,7 @@ Or, if you want to customize the prefix and then add a profile, you would do: # Override the default prefix value of 'com.facebook.chef' node.default['cpe_profiles_local']['prefix'] = 'com.company.chef' # Use the specified prefix to name the configuration profile -lw_prefs = node['cpe_loginwindow'].reject { |\_k, v| v.nil? } +lw_prefs = node['cpe_loginwindow'].compact if lw_prefs.empty? Chef::Log.debug("#{cookbook_name}: No prefs found.") return From d64bcba2fbb860f691dc2d60d2f9e330c6d93b78 Mon Sep 17 00:00:00 2001 From: Austin Culter Date: Tue, 17 Nov 2020 11:34:50 +0100 Subject: [PATCH 2/8] Change octal notation format for Rubocop --- .../cpe_adobe_flash/resources/configure_adobe_flash_darwin.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/itchef/cookbooks/cpe_adobe_flash/resources/configure_adobe_flash_darwin.rb b/itchef/cookbooks/cpe_adobe_flash/resources/configure_adobe_flash_darwin.rb index c0d297c3..04425a79 100644 --- a/itchef/cookbooks/cpe_adobe_flash/resources/configure_adobe_flash_darwin.rb +++ b/itchef/cookbooks/cpe_adobe_flash/resources/configure_adobe_flash_darwin.rb @@ -47,14 +47,14 @@ def configure not_if { configs.empty? } owner 'root' group 'admin' - mode 0755 + mode '0755' action :create end template ::File.join(config_dir, 'mms.cfg') do # ~ FB016 source 'cpe_adobe_flash.erb' owner 'root' group 'admin' - mode 0644 + mode '0644' action configs.empty? ? :delete : :create notifies :restart, 'launchd[com.adobe.fpsaud]' end From dbe1dd1a92abe58dae4cfc2bb92448d47634e044 Mon Sep 17 00:00:00 2001 From: Austin Culter Date: Tue, 17 Nov 2020 11:35:13 +0100 Subject: [PATCH 3/8] Selectively disable rubocop for Style/RedundantCondition --- itchef/cookbooks/cpe_bluetooth/resources/cpe_bluetooth.rb | 2 +- itchef/cookbooks/cpe_chrome/resources/cpe_chrome_posix.rb | 8 ++++---- itchef/cookbooks/cpe_munki/resources/cpe_munki_config.rb | 2 +- itchef/cookbooks/cpe_nomad/resources/darwin.rb | 2 +- .../cpe_powermanagement/resources/cpe_powermanagement.rb | 2 +- itchef/cookbooks/cpe_preferencepanes/resources/default.rb | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/itchef/cookbooks/cpe_bluetooth/resources/cpe_bluetooth.rb b/itchef/cookbooks/cpe_bluetooth/resources/cpe_bluetooth.rb index ad67a28a..14a5acaf 100644 --- a/itchef/cookbooks/cpe_bluetooth/resources/cpe_bluetooth.rb +++ b/itchef/cookbooks/cpe_bluetooth/resources/cpe_bluetooth.rb @@ -27,7 +27,7 @@ end prefix = node['cpe_profiles']['prefix'] - organization = node['organization'] ? node['organization'] : 'Facebook' + organization = node['organization'] ? node['organization'] : 'Facebook' # rubocop:disable Style/RedundantCondition profile = { 'PayloadIdentifier' => "#{prefix}.bluetooth", diff --git a/itchef/cookbooks/cpe_chrome/resources/cpe_chrome_posix.rb b/itchef/cookbooks/cpe_chrome/resources/cpe_chrome_posix.rb index 4a2b7ef3..08057284 100755 --- a/itchef/cookbooks/cpe_chrome/resources/cpe_chrome_posix.rb +++ b/itchef/cookbooks/cpe_chrome/resources/cpe_chrome_posix.rb @@ -142,7 +142,7 @@ def manage_chrome_linux(mprefs, prefs) def manage_chrome_macos(mprefs, prefs) prefix = node['cpe_profiles']['prefix'] - organization = node['organization'] ? node['organization'] : 'Facebook' + organization = node['organization'] ? node['organization'] : 'Facebook' # rubocop:disable Style/RedundantCondition chrome_profile = { 'PayloadIdentifier' => "#{prefix}.browsers.chrome", 'PayloadRemovalDisallowed' => true, @@ -170,7 +170,7 @@ def manage_chrome_macos(mprefs, prefs) # Check for Chrome Canary if node.installed?('com.google.Chrome.canary') prefix = node['cpe_profiles']['prefix'] - organization = node['organization'] ? node['organization'] : 'Facebook' + organization = node['organization'] ? node['organization'] : 'Facebook' # rubocop:disable Style/RedundantCondition canary_profile = { 'PayloadIdentifier' => "#{prefix}.browsers.chromecanary", 'PayloadRemovalDisallowed' => true, @@ -224,7 +224,7 @@ def manage_chrome_macos(mprefs, prefs) def manage_chrome_extensions_macos(extprefs) return if extprefs.empty? prefix = node['cpe_profiles']['prefix'] - organization = node['organization'] ? node['organization'] : 'Facebook' + organization = node['organization'] ? node['organization'] : 'Facebook' # rubocop:disable Style/RedundantCondition extprefs.each do |k, v| chrome_ext_profile = { 'PayloadIdentifier' => "#{prefix}.browsers.chrome.extension.#{k}", @@ -253,7 +253,7 @@ def manage_chrome_extensions_macos(extprefs) # Check for Chrome Canary if node.installed?('com.google.Chrome.canary') prefix = node['cpe_profiles']['prefix'] - organization = node['organization'] ? node['organization'] : 'Facebook' + organization = node['organization'] ? node['organization'] : 'Facebook' # rubocop:disable Style/RedundantCondition extprefs.each do |k, v| canary_ext_profile = { 'PayloadIdentifier' => "#{prefix}.browsers.chromecanary.extension.#{k}", diff --git a/itchef/cookbooks/cpe_munki/resources/cpe_munki_config.rb b/itchef/cookbooks/cpe_munki/resources/cpe_munki_config.rb index a7ee403d..767f8e07 100644 --- a/itchef/cookbooks/cpe_munki/resources/cpe_munki_config.rb +++ b/itchef/cookbooks/cpe_munki/resources/cpe_munki_config.rb @@ -29,7 +29,7 @@ end prefix = node['cpe_profiles']['prefix'] - organization = node['organization'] ? node['organization'] : 'Facebook' + organization = node['organization'] ? node['organization'] : 'Facebook' # rubocop:disable Style/RedundantCondition munki_profile = { 'PayloadIdentifier' => "#{prefix}.munki", diff --git a/itchef/cookbooks/cpe_nomad/resources/darwin.rb b/itchef/cookbooks/cpe_nomad/resources/darwin.rb index 1b021184..77c83462 100644 --- a/itchef/cookbooks/cpe_nomad/resources/darwin.rb +++ b/itchef/cookbooks/cpe_nomad/resources/darwin.rb @@ -122,7 +122,7 @@ def configure_profile end prefix = node['cpe_profiles']['prefix'] - organization = node['organization'] ? node['organization'] : 'Facebook' + organization = node['organization'] ? node['organization'] : 'Facebook' # rubocop:disable Style/RedundantCondition { 'NoMAD' => nomad_prefs, diff --git a/itchef/cookbooks/cpe_powermanagement/resources/cpe_powermanagement.rb b/itchef/cookbooks/cpe_powermanagement/resources/cpe_powermanagement.rb index 48ae186e..8e449779 100644 --- a/itchef/cookbooks/cpe_powermanagement/resources/cpe_powermanagement.rb +++ b/itchef/cookbooks/cpe_powermanagement/resources/cpe_powermanagement.rb @@ -34,7 +34,7 @@ ident = "com.apple.EnergySaver.#{machine_type}" prefix = node['cpe_profiles']['prefix'] - organization = node['organization'] ? node['organization'] : 'Facebook' + organization = node['organization'] ? node['organization'] : 'Facebook' # rubocop:disable Style/RedundantCondition energy_profile = { 'PayloadIdentifier' => "#{prefix}.powermanagement", 'PayloadRemovalDisallowed' => true, diff --git a/itchef/cookbooks/cpe_preferencepanes/resources/default.rb b/itchef/cookbooks/cpe_preferencepanes/resources/default.rb index 0a42f790..d2ed65dd 100644 --- a/itchef/cookbooks/cpe_preferencepanes/resources/default.rb +++ b/itchef/cookbooks/cpe_preferencepanes/resources/default.rb @@ -24,7 +24,7 @@ prefs = node['cpe_preferencepanes'].compact return if prefs.empty? prefix = node['cpe_profiles']['prefix'] - organization = node['organization'] ? node['organization'] : 'Facebook' + organization = node['organization'] ? node['organization'] : 'Facebook' # rubocop:disable Style/RedundantCondition pane_profile = { 'PayloadIdentifier' => "#{prefix}.prefpanes", 'PayloadRemovalDisallowed' => true, From 3c282bf373202aa670da949b8253dc8608de187e Mon Sep 17 00:00:00 2001 From: Austin Culter Date: Tue, 17 Nov 2020 11:41:54 +0100 Subject: [PATCH 4/8] Disable rubocop where needed --- .../cpe_chrome/resources/cpe_chrome_posix.rb | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/itchef/cookbooks/cpe_chrome/resources/cpe_chrome_posix.rb b/itchef/cookbooks/cpe_chrome/resources/cpe_chrome_posix.rb index 08057284..703d5d47 100755 --- a/itchef/cookbooks/cpe_chrome/resources/cpe_chrome_posix.rb +++ b/itchef/cookbooks/cpe_chrome/resources/cpe_chrome_posix.rb @@ -26,7 +26,7 @@ manage_chrome_extensions end -action_class do +action_class do # rubocop:disable Metrics/BlockLength def install_repos return unless node.linux? return unless node['cpe_chrome']['manage_repo'] @@ -238,7 +238,7 @@ def manage_chrome_extensions_macos(extprefs) 'PayloadContent' => [{ 'PayloadType' => "com.google.Chrome.extensions.#{k}", 'PayloadVersion' => 1, - 'PayloadIdentifier' => "#{prefix}.browsers.chrome.extension.settings.#{k}", + 'PayloadIdentifier' => "#{prefix}.browsers.chrome.extension.settings.#{k}", # rubocop:disable Layout/LineLength 'PayloadUUID' => v['payload_uuid'], 'PayloadEnabled' => true, 'PayloadDisplayName' => "Chrome Extension (#{v['display_name']})", @@ -247,7 +247,8 @@ def manage_chrome_extensions_macos(extprefs) v['profile'].each do |k_ext, v_ext| chrome_ext_profile['PayloadContent'][0][k_ext] = v_ext['value'] end - node.default['cpe_profiles']["#{prefix}.browsers.chrome.extension.#{k}"] = chrome_ext_profile + node.default['cpe_profiles']["#{prefix}.browsers.chrome.extension.#{k}"] = + chrome_ext_profile end # Check for Chrome Canary @@ -256,7 +257,7 @@ def manage_chrome_extensions_macos(extprefs) organization = node['organization'] ? node['organization'] : 'Facebook' # rubocop:disable Style/RedundantCondition extprefs.each do |k, v| canary_ext_profile = { - 'PayloadIdentifier' => "#{prefix}.browsers.chromecanary.extension.#{k}", + 'PayloadIdentifier' => "#{prefix}.browsers.chromecanary.extension.#{k}", # rubocop:disable Layout/LineLength 'PayloadRemovalDisallowed' => true, 'PayloadScope' => 'System', 'PayloadType' => 'Configuration', @@ -267,16 +268,16 @@ def manage_chrome_extensions_macos(extprefs) 'PayloadContent' => [{ 'PayloadType' => "com.google.Chrome.canary.extensions.#{k}", 'PayloadVersion' => 1, - 'PayloadIdentifier' => "#{prefix}.browsers.chromecanary.extension.settings.#{k}", + 'PayloadIdentifier' => "#{prefix}.browsers.chromecanary.extension.settings.#{k}", # rubocop:disable Layout/LineLength 'PayloadUUID' => v['payload_uuid'], 'PayloadEnabled' => true, - 'PayloadDisplayName' => "Chrome Canary Extension (#{v['display_name']})", + 'PayloadDisplayName' => "Chrome Canary Extension (#{v['display_name']})", # rubocop:disable Layout/LineLength }], } v['profile'].each do |k_ext, v_ext| canary_ext_profile['PayloadContent'][0][k_ext] = v_ext['value'] end - node.default['cpe_profiles']["#{prefix}.browsers.chromecanary.extension.#{k}"] = canary_ext_profile + node.default['cpe_profiles']["#{prefix}.browsers.chromecanary.extension.#{k}"] = canary_ext_profile # rubocop:disable Layout/LineLength end end end @@ -318,6 +319,7 @@ def migrate_chromium_settings_linux ::File.directory?('/etc/chromium') && !::File.symlink?('/etc/chromium') end + # rubocop:disable Naming/HeredocDelimiterNaming code <<-EOH find /etc/chromium -type d -exec chmod 0755 {} \\; find /etc/chromium -type f -exec chmod 0644 {} \\; @@ -326,5 +328,6 @@ def migrate_chromium_settings_linux rm -rf /etc/chromium EOH end + # rubocop:enable Naming/HeredocDelimiterNaming end end From 53d5bcb7ed0bfdcea7f30e9766c94fe89d6a0170 Mon Sep 17 00:00:00 2001 From: Austin Culter Date: Tue, 17 Nov 2020 11:42:34 +0100 Subject: [PATCH 5/8] Fix: Hash kv alignment; lint: keys.each to each_key --- .../resources/cpe_powermanagement.rb | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/itchef/cookbooks/cpe_powermanagement/resources/cpe_powermanagement.rb b/itchef/cookbooks/cpe_powermanagement/resources/cpe_powermanagement.rb index 8e449779..12a0e159 100644 --- a/itchef/cookbooks/cpe_powermanagement/resources/cpe_powermanagement.rb +++ b/itchef/cookbooks/cpe_powermanagement/resources/cpe_powermanagement.rb @@ -36,15 +36,15 @@ prefix = node['cpe_profiles']['prefix'] organization = node['organization'] ? node['organization'] : 'Facebook' # rubocop:disable Style/RedundantCondition energy_profile = { - 'PayloadIdentifier' => "#{prefix}.powermanagement", + 'PayloadIdentifier' => "#{prefix}.powermanagement", 'PayloadRemovalDisallowed' => true, - 'PayloadScope' => 'System', - 'PayloadType' => 'Configuration', - 'PayloadUUID' => 'd1207590-f93a-0133-92e4-4cc760f34b36', - 'PayloadOrganization' => organization, - 'PayloadVersion' => 1, - 'PayloadDisplayName' => 'Power Management', - 'PayloadContent' => [ + 'PayloadScope' => 'System', + 'PayloadType' => 'Configuration', + 'PayloadUUID' => 'd1207590-f93a-0133-92e4-4cc760f34b36', + 'PayloadOrganization' => organization, + 'PayloadVersion' => 1, + 'PayloadDisplayName' => 'Power Management', + 'PayloadContent' => [ { 'PayloadType' => 'com.apple.MCX', 'PayloadVersion' => 1, @@ -64,7 +64,7 @@ } # Apply all settings to the profile - AC and/or Battery - pm_prefs.keys.each do |type| + pm_prefs.each_key do |type| next if pm_prefs[type].empty? energy_profile['PayloadContent'][0]["#{ident}.#{type}-ProfileNumber"] = -1 energy_profile['PayloadContent'][0]["#{ident}.#{type}"] = pm_prefs[type] From f1b8d14a79d65cbe39589244bc8caa59cd212ea5 Mon Sep 17 00:00:00 2001 From: Austin Culter Date: Tue, 17 Nov 2020 11:46:28 +0100 Subject: [PATCH 6/8] Disable Style/ExplicitBlockArgument for 1LOC in cpe_nomad --- itchef/cookbooks/cpe_nomad/resources/darwin.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/itchef/cookbooks/cpe_nomad/resources/darwin.rb b/itchef/cookbooks/cpe_nomad/resources/darwin.rb index 77c83462..a09f1643 100644 --- a/itchef/cookbooks/cpe_nomad/resources/darwin.rb +++ b/itchef/cookbooks/cpe_nomad/resources/darwin.rb @@ -172,7 +172,7 @@ def log_vars(action, status) end def log_if(msg) - CPE::Log.if( + CPE::Log.if( # rubocop:disable Style/ExplicitBlockArgument msg, :type => @type, :action => @action, :status => @status ) { yield } end From 0a326059ed9b8e0dcc8d7d08b2f33606a8f9ebfc Mon Sep 17 00:00:00 2001 From: Austin Culter Date: Tue, 17 Nov 2020 12:51:11 +0100 Subject: [PATCH 7/8] Add change to increase performance --- itchef/cookbooks/cpe_chrome/libraries/windows_chrome_setting.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/itchef/cookbooks/cpe_chrome/libraries/windows_chrome_setting.rb b/itchef/cookbooks/cpe_chrome/libraries/windows_chrome_setting.rb index 9bf976a0..2dd567bb 100644 --- a/itchef/cookbooks/cpe_chrome/libraries/windows_chrome_setting.rb +++ b/itchef/cookbooks/cpe_chrome/libraries/windows_chrome_setting.rb @@ -89,7 +89,7 @@ def data_has_multiple_entries? # Walks the available configuration to determine where the full registry path # is. def construct_reg_key_path(key = @name, suffix_path = nil) - if ENUM_REG_KEYS.keys.include?(key) + if ENUM_REG_KEYS.key?(key) { "#{CPE::ChromeManagement.chrome_reg_root}\\#{key}" => ENUM_REG_KEYS[key], From 0f714171bd06b7dc2f199fb29869c5f3c77bd240 Mon Sep 17 00:00:00 2001 From: Austin Culter Date: Tue, 17 Nov 2020 13:11:31 +0100 Subject: [PATCH 8/8] Revert last commit --- itchef/cookbooks/cpe_chrome/libraries/windows_chrome_setting.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/itchef/cookbooks/cpe_chrome/libraries/windows_chrome_setting.rb b/itchef/cookbooks/cpe_chrome/libraries/windows_chrome_setting.rb index 2dd567bb..9bf976a0 100644 --- a/itchef/cookbooks/cpe_chrome/libraries/windows_chrome_setting.rb +++ b/itchef/cookbooks/cpe_chrome/libraries/windows_chrome_setting.rb @@ -89,7 +89,7 @@ def data_has_multiple_entries? # Walks the available configuration to determine where the full registry path # is. def construct_reg_key_path(key = @name, suffix_path = nil) - if ENUM_REG_KEYS.key?(key) + if ENUM_REG_KEYS.keys.include?(key) { "#{CPE::ChromeManagement.chrome_reg_root}\\#{key}" => ENUM_REG_KEYS[key],