-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Global params for host obfuscation and migrate off settings
- Loading branch information
Showing
8 changed files
with
29 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
db/migrate/20241108165827_convert_obfuscation_settings_to_params.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
class ConvertObfuscationSettingsToParams < ActiveRecord::Migration[6.1] | ||
def change | ||
# Create the common parameters if they don't exist and set the default values to false | ||
CommonParameter.find_or_create_by!(name: 'obfuscate_inventory_hostnames', value: false) | ||
CommonParameter.find_or_create_by!(name: 'obfuscate_inventory_ips', value: false) | ||
|
||
# Copy the settings to the common parameters and remove the settings from the database | ||
# rubocop:disable Style/GuardClause | ||
if Setting.find_by(name: 'obfuscate_inventory_hostnames')&.value | ||
hostname_setting = CommonParameter.find_by(name: 'obfuscate_inventory_hostnames') | ||
hostname_setting.update!(value: Setting.find_by(name: 'obfuscate_inventory_hostnames')&.value) | ||
Setting.find_by(name: 'obfuscate_inventory_hostnames').destroy_all | ||
end | ||
|
||
if Setting.find_by(name: 'obfuscate_inventory_ips')&.value | ||
ip_setting = CommonParameter.find_by(name: 'obfuscate_inventory_ips') | ||
ip_setting.update!(value: Setting.find_by(name: 'obfuscate_inventory_ips')&.value) | ||
Setting.find_by(name: 'obfuscate_inventory_ips').destroy_all | ||
end | ||
# rubocop:enable Style/GuardClause | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters