Skip to content

Define constants only if not already defined

Balasankar 'Balu' C requested to merge fix-reconfigure-warnings into master

Without this, warnings are thrown during cookbook compilation, as seen in latest nightly QA - https://gitlab.com/gitlab-org/quality/nightly/-/jobs/230276993

/opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/libraries/helpers/base_pg_helper.rb:9: warning: already initialized constant BasePgHelper::PG_HASH_PATTERN
/opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/libraries/helpers/base_pg_helper.rb:9: warning: previous definition of PG_HASH_PATTERN was here
/opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/libraries/helpers/base_pg_helper.rb:10: warning: already initialized constant BasePgHelper::PG_HASH_PAIR_SEPARATOR
/opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/libraries/helpers/base_pg_helper.rb:10: warning: previous definition of PG_HASH_PAIR_SEPARATOR was here
/opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/libraries/helpers/base_pg_helper.rb:11: warning: already initialized constant BasePgHelper::PG_HASH_PAIR_ESCAPED_PATTERN
/opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/libraries/helpers/base_pg_helper.rb:11: warning: previous definition of PG_HASH_PAIR_ESCAPED_PATTERN was here
/opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/libraries/helpers/base_pg_helper.rb:12: warning: already initialized constant BasePgHelper::PG_HASH_KEY_VALUE_SEPARATOR
/opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/libraries/helpers/base_pg_helper.rb:12: warning: previous definition of PG_HASH_KEY_VALUE_SEPARATOR was here
/opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/libraries/helpers/base_pg_helper.rb:13: warning: already initialized constant BasePgHelper::PG_ESCAPED_DOUBLE_QUOTE_PATTERN
/opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/libraries/helpers/base_pg_helper.rb:13: warning: previous definition of PG_ESCAPED_DOUBLE_QUOTE_PATTERN was here
/opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/libraries/helpers/base_pg_helper.rb:14: warning: already initialized constant BasePgHelper::PG_ESCAPED_BACKSLASH_PATTERN
/opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/libraries/helpers/base_pg_helper.rb:14: warning: previous definition of PG_ESCAPED_BACKSLASH_PATTERN was here

Introduced by !3339 (merged)

Merge request reports