Skip to content

Commit fca4d4f

Browse files
balasankarcRobert Marshall
authored andcommitted
Fix deprecation warnings for root configurations
Do not warn if nothing is set and the default empty hash is returned for some configurations. Signed-off-by: Balasankar 'Balu' C <[email protected]>
1 parent 454718e commit fca4d4f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

files/gitlab-cookbooks/package/libraries/deprecations.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,12 @@ def applicable_deprecations(incoming_version, existing_config, type)
550550
# Getting settings from gitlab.rb that are in deprecations list and
551551
# has been removed in incoming or a previous version.
552552
current_deprecations = list(existing_config).select { |deprecation| version >= Gem::Version.new(deprecation[type]) }
553-
current_deprecations.select { |deprecation| !existing_config.dig(*deprecation[:config_keys]).nil? }
553+
554+
# If the value of the configuration is `nil` or an empty hash (in case
555+
# of root configurations where ConfigMash logic in SettingsDSL will set
556+
# an empty Hash as the default value), then the configuration is a
557+
# valid deprecation that user has to be warned about.
558+
current_deprecations.select { |deprecation| !(existing_config.dig(*deprecation[:config_keys]).nil? || (existing_config.dig(*deprecation[:config_keys]).is_a?(Hash) && existing_config.dig(*deprecation[:config_keys])&.empty?)) }
554559
end
555560

556561
def check_config(incoming_version, existing_config, type = :removal)

0 commit comments

Comments
 (0)