puppetlabs / puppet-lint

Check that your Puppet manifests conform to the style guide
https://puppetlabs.github.io/puppet-lint/
MIT License
18 stars 12 forks source link

[5.0.0] many warnings on usage #169

Closed tuxmaster5000 closed 7 months ago

tuxmaster5000 commented 8 months ago

On usage ton's of warnings are logged:

/usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint.rb:255: warning: already initialized constant PuppetLint::CheckArrowOnRightOperandLine /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint.rb:255: warning: previous definition of CheckArrowOnRightOperandLine was here /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint.rb:255: warning: already initialized constant PuppetLint::CheckAutoloaderLayout /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint.rb:255: warning: previous definition of CheckAutoloaderLayout was here /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint.rb:255: warning: already initialized constant PuppetLint::CheckClassInheritsFromParamsClass /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint.rb:255: warning: previous definition of CheckClassInheritsFromParamsClass was here /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint.rb:255: warning: already initialized constant PuppetLint::CheckCodeOnTopScope /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint.rb:255: warning: previous definition of CheckCodeOnTopScope was here /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint.rb:255: warning: already initialized constant PuppetLint::CheckInheritsAcrossNamespaces /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint.rb:255: warning: previous definition of CheckInheritsAcrossNamespaces was here /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint.rb:255: warning: already initialized constant PuppetLint::CheckNamesContainingDash /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint.rb:255: warning: previous definition of CheckNamesContainingDash was here /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint.rb:255: warning: already initialized constant PuppetLint::CheckNamesContainingUppercase /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint.rb:255: warning: previous definition of CheckNamesContainingUppercase was here /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint/plugins/check_classes/nested_classes_or_defines.rb:5: warning: already initialized constant CLASS_DEFINE_TOKENS /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint/plugins/check_classes/nested_classes_or_defines.rb:5: warning: previous definition of CLASS_DEFINE_TOKENS was here /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint.rb:255: warning: already initialized constant PuppetLint::CheckNestedClassesOrDefines /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint.rb:255: warning: previous definition of CheckNestedClassesOrDefines was here /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint.rb:255: warning: already initialized constant PuppetLint::CheckParameterOrder /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint.rb:255: warning: previous definition of CheckParameterOrder was here /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint.rb:255: warning: already initialized constant PuppetLint::CheckRightToLeftRelationship /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint.rb:255: warning: previous definition of CheckRightToLeftRelationship was here /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint/plugins/check_classes/variable_scope.rb:8: warning: already initialized constant DEFAULT_SCOPE_VARS /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint/plugins/check_classes/variable_scope.rb:8: warning: previous definition of DEFAULT_SCOPE_VARS was here /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint/plugins/check_classes/variable_scope.rb:34: warning: already initialized constant POST_VAR_TOKENS /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint/plugins/check_classes/variable_scope.rb:34: warning: previous definition of POST_VAR_TOKENS was here /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint.rb:255: warning: already initialized constant PuppetLint::CheckVariableScope /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint.rb:255: warning: previous definition of CheckVariableScope was here /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint.rb:255: warning: already initialized constant PuppetLint::CheckSlashComments /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint.rb:255: warning: previous definition of CheckSlashComments was here /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint.rb:255: warning: already initialized constant PuppetLint::CheckStarComments /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint.rb:255: warning: previous definition of CheckStarComments was here /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint.rb:255: warning: already initialized constant PuppetLint::CheckCaseWithoutDefault /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint.rb:255: warning: previous definition of CheckCaseWithoutDefault was here /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint.rb:255: warning: already initialized constant PuppetLint::CheckSelectorInsideResource /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint.rb:255: warning: previous definition of CheckSelectorInsideResource was here /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint/plugins/check_documentation/documentation.rb:6: warning: already initialized constant COMMENT_TOKENS /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint/plugins/check_documentation/documentation.rb:6: warning: previous definition of COMMENT_TOKENS was here /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint/plugins/check_documentation/documentation.rb:7: warning: already initialized constant WHITESPACE_TOKENS /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint/plugins/check_documentation/documentation.rb:7: warning: previous definition of WHITESPACE_TOKENS was here /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint.rb:255: warning: already initialized constant PuppetLint::CheckDocumentation /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint.rb:255: warning: previous definition of CheckDocumentation was here /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint.rb:255: warning: already initialized constant PuppetLint::CheckUnquotedNodeName /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint.rb:255: warning: previous definition of CheckUnquotedNodeName was here /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint.rb:255: warning: already initialized constant PuppetLint::CheckDuplicateParams /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint.rb:255: warning: previous definition of CheckDuplicateParams was here /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint.rb:255: warning: already initialized constant PuppetLint::CheckEnsureFirstParam /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint.rb:255: warning: previous definition of CheckEnsureFirstParam was here /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint.rb:255: warning: already initialized constant PuppetLint::CheckEnsureNotSymlinkTarget /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint.rb:255: warning: previous definition of CheckEnsureNotSymlinkTarget was here /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint/plugins/check_resources/file_mode.rb:6: warning: already initialized constant MSG /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint/plugins/check_resources/file_mode.rb:6: warning: previous definition of MSG was here /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint/plugins/check_resources/file_mode.rb:7: warning: already initialized constant SYM_RE /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint/plugins/check_resources/file_mode.rb:7: warning: previous definition of SYM_RE was here /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint/plugins/check_resources/file_mode.rb:8: warning: already initialized constant IGNORE_TYPES /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint/plugins/check_resources/file_mode.rb:8: warning: previous definition of IGNORE_TYPES was here /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint/plugins/check_resources/file_mode.rb:9: warning: already initialized constant MODE_RE /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint/plugins/check_resources/file_mode.rb:9: warning: previous definition of MODE_RE was here /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint.rb:255: warning: already initialized constant PuppetLint::CheckFileMode /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint.rb:255: warning: previous definition of CheckFileMode was here /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint/plugins/check_resources/unquoted_file_mode.rb:6: warning: already initialized constant TOKEN_TYPES /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint/plugins/check_resources/unquoted_file_mode.rb:6: warning: previous definition of TOKEN_TYPES was here /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint.rb:255: warning: already initialized constant PuppetLint::CheckUnquotedFileMode /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint.rb:255: warning: previous definition of CheckUnquotedFileMode was here /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint.rb:255: warning: already initialized constant PuppetLint::CheckUnquotedResourceTitle /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint.rb:255: warning: previous definition of CheckUnquotedResourceTitle was here /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint/plugins/check_strings/double_quoted_strings.rb:6: warning: already initialized constant ESCAPE_CHAR_RE /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint/plugins/check_strings/double_quoted_strings.rb:6: warning: previous definition of ESCAPE_CHAR_RE was here /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint.rb:255: warning: already initialized constant PuppetLint::CheckDoubleQuotedStrings /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint.rb:255: warning: previous definition of CheckDoubleQuotedStrings was here /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint/plugins/check_strings/only_variable_string.rb:5: warning: already initialized constant VAR_TYPES /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint/plugins/check_strings/only_variable_string.rb:5: warning: previous definition of VAR_TYPES was here /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint.rb:255: warning: already initialized constant PuppetLint::CheckOnlyVariableString /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint.rb:255: warning: previous definition of CheckOnlyVariableString was here /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint.rb:255: warning: already initialized constant PuppetLint::CheckPuppetUrlWithoutModules /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint.rb:255: warning: previous definition of CheckPuppetUrlWithoutModules was here /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint/plugins/check_strings/quoted_booleans.rb:6: warning: already initialized constant STRING_TYPES /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint/plugins/check_strings/quoted_booleans.rb:6: warning: previous definition of STRING_TYPES was here /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint/plugins/check_strings/quoted_booleans.rb:7: warning: already initialized constant BOOLEANS /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint/plugins/check_strings/quoted_booleans.rb:7: warning: previous definition of BOOLEANS was here /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint.rb:255: warning: already initialized constant PuppetLint::CheckQuotedBooleans /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint.rb:255: warning: previous definition of CheckQuotedBooleans was here /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint.rb:255: warning: already initialized constant PuppetLint::CheckSingleQuoteStringWithVariables /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint.rb:255: warning: previous definition of CheckSingleQuoteStringWithVariables was here /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint/plugins/check_strings/variables_not_enclosed.rb:9: warning: already initialized constant STRING_TOKEN_TYPES /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint/plugins/check_strings/variables_not_enclosed.rb:9: warning: previous definition of STRING_TOKEN_TYPES was here /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint.rb:255: warning: already initialized constant PuppetLint::CheckVariablesNotEnclosed /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint.rb:255: warning: previous definition of CheckVariablesNotEnclosed was here /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint/plugins/check_variables/variable_contains_dash.rb:5: warning: already initialized constant VARIABLE_DASH_TYPES /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint/plugins/check_variables/variable_contains_dash.rb:5: warning: previous definition of VARIABLE_DASH_TYPES was here /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint.rb:255: warning: already initialized constant PuppetLint::CheckVariableContainsDash /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint.rb:255: warning: previous definition of CheckVariableContainsDash was here /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint/plugins/check_variables/variable_is_lowercase.rb:5: warning: already initialized constant VARIABLE_LOWERCASE_TYPES /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint/plugins/check_variables/variable_is_lowercase.rb:5: warning: previous definition of VARIABLE_LOWERCASE_TYPES was here /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint.rb:255: warning: already initialized constant PuppetLint::CheckVariableIsLowercase /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint.rb:255: warning: previous definition of CheckVariableIsLowercase was here /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint.rb:255: warning: already initialized constant PuppetLint::Check140chars /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint.rb:255: warning: previous definition of Check140chars was here /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint.rb:255: warning: already initialized constant PuppetLint::Check2spSoftTabs /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint.rb:255: warning: previous definition of Check2spSoftTabs was here /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint.rb:255: warning: already initialized constant PuppetLint::Check80chars /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint.rb:255: warning: previous definition of Check80chars was here /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint/plugins/check_whitespace/arrow_alignment.rb:5: warning: already initialized constant COMMENT_TYPES /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint/plugins/check_whitespace/arrow_alignment.rb:5: warning: previous definition of COMMENT_TYPES was here /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint.rb:255: warning: already initialized constant PuppetLint::CheckArrowAlignment /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint.rb:255: warning: previous definition of CheckArrowAlignment was here /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint/plugins/check_whitespace/hard_tabs.rb:5: warning: already initialized constant WHITESPACE_TYPES /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint/plugins/check_whitespace/hard_tabs.rb:5: warning: previous definition of WHITESPACE_TYPES was here /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint.rb:255: warning: already initialized constant PuppetLint::CheckHardTabs /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint.rb:255: warning: previous definition of CheckHardTabs was here /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint.rb:255: warning: already initialized constant PuppetLint::CheckTrailingWhitespace /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint.rb:255: warning: previous definition of CheckTrailingWhitespace was here /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint/plugins/legacy_facts/legacy_facts.rb:9: warning: already initialized constant LEGACY_FACTS_VAR_TYPES /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint/plugins/legacy_facts/legacy_facts.rb:9: warning: previous definition of LEGACY_FACTS_VAR_TYPES was here /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint/plugins/legacy_facts/legacy_facts.rb:12: warning: already initialized constant UNCONVERTIBLE_FACTS /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint/plugins/legacy_facts/legacy_facts.rb:12: warning: previous definition of UNCONVERTIBLE_FACTS was here /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint/plugins/legacy_facts/legacy_facts.rb:25: warning: already initialized constant REGEX_FACTS /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint/plugins/legacy_facts/legacy_facts.rb:25: warning: previous definition of REGEX_FACTS was here /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint/plugins/legacy_facts/legacy_facts.rb:35: warning: already initialized constant EASY_FACTS /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint/plugins/legacy_facts/legacy_facts.rb:35: warning: previous definition of EASY_FACTS was here /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint/plugins/legacy_facts/legacy_facts.rb:107: warning: already initialized constant HASH_KEY_TYPES /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint/plugins/legacy_facts/legacy_facts.rb:107: warning: previous definition of HASH_KEY_TYPES was here /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint.rb:255: warning: already initialized constant PuppetLint::CheckLegacyFacts /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint.rb:255: warning: previous definition of CheckLegacyFacts was here /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint/plugins/top_scope_facts/top_scope_facts.rb:16: warning: already initialized constant TOP_SCOPE_FACTS_VAR_TYPES /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint/plugins/top_scope_facts/top_scope_facts.rb:16: warning: previous definition of TOP_SCOPE_FACTS_VAR_TYPES was here /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint.rb:255: warning: already initialized constant PuppetLint::CheckTopScopeFacts /usr/share/gems/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint.rb:255: warning: previous definition of CheckTopScopeFacts was here

ekohl commented 8 months ago

This is because the gem was renamed but still occupies the same namespace as the old gem. If that's also present, this happens. As I hinted at in https://github.com/puppetlabs/puppet-lint/pull/158#discussion_r1350138839 (but could have been more explicit about).

GSPatton commented 8 months ago

hi @tuxmaster5000. Thanks for this! I think this is due to clashes with other dependencies in puppet-lint which use the puppet-lint gem which haven't been updated to use the new gem puppetlabs-puppet-lint. We're currently working on updating these dependencies

GSPatton commented 8 months ago

@ekohl am I right in saying this^^. I see you're talking about the old gem occupying the same namespace - by this do you mean that currently other dependencies are pulling in the old puppet-lint gem and are competing with the new gem for the puppet-lint namespace?

If not could you clarify what the issue is? We're currently troubleshooting

ekohl commented 8 months ago

I've seen this before. On Fedora Puppet is packaged without a puppet.gemspec while placing files in /usr/share/ruby/vendor_ruby/puppet, so bundler doesn't recognize it. So when I use bundle install on something that requires the puppet gem, it also installs to ~/.gem/ruby/gems/puppet-8.2.0/ (for example). Now you have 2 files that can match require 'puppet' and the Puppet namespace is ambiguous. This results in weird double loading as you see.

With this gem it's the same: PuppetLint is ambiguous as long as anything pulls in puppet-lint and puppetlabs-puppet-lint, you will have this problem. AFAIK Bundler doesn't allow you to specify conflicts.

The only safe thing I can think of is changing the namespace as well as the filenames. It may help to use require_relative everywhere instead of require, but I really doubt that's sufficient.

rismoney commented 8 months ago

I rolled back to an old spec helper like 5.0.3. I mentioned this issue in the chat and was directed here. I was sarcastically told to not be opportunistic about my gem handling... While I get changes need to be made, I think this has been a never ending struggle with puppet. I don't think that folks realize how this stuff resonates. I have been using puppet for over a decade, and think the ruby, gem handling, and flip-flopping on this topic has definitely alienated a fairly large percentage of the original user base. I personally know several people who switched tooling after the facter debacle.

People get fed up, and want real improvements without breakage and handling these exceptions out of the box, even if in the short term, extra code has to be written to handle dualities.

So I rolled back as a breakfix, created an internal issue, and now have to track properly getting off this old version to be on a 'modern' code path. If I am busy maintaining code bases for my linter, I am failing at the goals of devops.

markeganfuller commented 7 months ago

This seems to happen regardless of the existence of old versions.

In a clean Ubuntu 20.04 Docker container, installing only ruby/bundler and the gem version of puppetlabs-puppet-lint:

Debian Packages ```console root@puppet-lint:/# dpkg -l | grep puppet root@puppet-lint:/# dpkg -l | grep lint root@puppet-lint:/# dpkg -l | grep ruby ii libruby2.7:amd64 2.7.0-5ubuntu1.12 amd64 Libraries necessary to run Ruby 2.7 ii rake 13.0.1-4 all ruby make-like utility ii ruby 1:2.7+1 amd64 Interpreter of object-oriented scripting language Ruby (default version) ii ruby-bundler 2.1.4-1 all Manage Ruby application dependencies (runtime) ii ruby-minitest 5.13.0-1 all Ruby test tools supporting TDD, BDD, mocking, and benchmarking ii ruby-molinillo 0.6.4-1 all generic dependency resolution algorithm ii ruby-net-http-persistent 2.9.4-2 all Manages persistent connections using Net::HTTP ii ruby-net-telnet 0.1.1-2 all telnet client library ii ruby-power-assert 1.1.7-1 all library showing values of variables and method calls in an expression ii ruby-test-unit 3.3.5-1 all unit testing framework for Ruby ii ruby-thor 0.19.4-1 all Ruby scripting framework ii ruby-xmlrpc 0.3.0-2 all XMLRPC library for Ruby ii ruby2.7 2.7.0-5ubuntu1.12 amd64 Interpreter of object-oriented scripting language Ruby ii rubygems-integration 1.16 all integration of Debian Ruby packages with Rubygems ```
Gems ``` root@puppet-lint:/# gem list *** LOCAL GEMS *** benchmark (default: 0.1.0) bigdecimal (default: 2.0.0) bundler (2.1.4, default: 2.1.2) cgi (default: 0.1.0) csv (default: 3.1.2) date (default: 3.0.0) dbm (default: 1.1.0) delegate (default: 0.1.0) did_you_mean (default: 1.4.0) etc (default: 1.1.0) fcntl (default: 1.0.0) fiddle (default: 1.0.0) fileutils (default: 1.4.1) forwardable (default: 1.3.1) gdbm (default: 2.1.0) getoptlong (default: 0.1.0) io-console (default: 0.5.3) ipaddr (default: 1.2.2) irb (default: 1.2.1) json (default: 2.3.0) logger (default: 1.4.2) matrix (default: 0.2.0) minitest (5.13.0) molinillo (0.6.4) mutex_m (default: 0.1.0) net-http-persistent (2.9.4) net-pop (default: 0.1.0) net-smtp (default: 0.1.0) net-telnet (0.1.1) observer (default: 0.1.0) open3 (default: 0.1.0) openssl (default: 2.1.2) ostruct (default: 0.2.0) power_assert (1.1.7) prime (default: 0.1.1) pstore (default: 0.1.0) psych (default: 3.1.0) puppetlabs-puppet-lint (5.0.0) racc (default: 1.4.16) rake (13.0.1) rdoc (default: 6.2.1) readline (default: 0.0.2) readline-ext (default: 0.1.0) reline (default: 0.1.2) rexml (default: 3.2.3) rss (default: 0.2.8) sdbm (default: 1.0.0) singleton (default: 0.1.0) stringio (default: 0.1.0) strscan (default: 1.0.3) test-unit (3.3.5) thor (0.19.4) timeout (default: 0.1.0) tracer (default: 0.1.0) uri (default: 0.10.0) webrick (default: 1.6.0) xmlrpc (0.3.0) yaml (default: 0.1.0) zlib (default: 1.1.0) ```

The error still occurs:

root@puppet-lint:/# puppet-lint --version
/var/lib/gems/2.7.0/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint.rb:255: warning: already initialized constant PuppetLint::CheckSlashComments
/var/lib/gems/2.7.0/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint.rb:255: warning: previous definition of CheckSlashComments was here
/var/lib/gems/2.7.0/gems/puppetlabs-puppet-lint-5.0.0/lib/puppet-lint.rb:255: warning: already initialized constant PuppetLint::CheckStarComments
...

puppet-lint 5.0.0

In fact the errors appear in the Github Actions for this repository: https://github.com/puppetlabs/puppet-lint/actions/runs/6857416201/job/18646463943#step:7:8

Run bundle exec rake spec
  bundle exec rake spec
  shell: /usr/bin/bash -e {0}
  env:
    PUPPET_GEM_VERSION: ~> 7.0
/opt/hostedtoolcache/Ruby/2.7.8/x64/bin/ruby -I/home/runner/work/puppet-lint/puppet-lint/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.12.2/lib:/home/runner/work/puppet-lint/puppet-lint/vendor/bundle/ruby/2.7.0/gems/rspec-support-3.12.1/lib /home/runner/work/puppet-lint/puppet-lint/vendor/bundle/ruby/2.7.0/gems/rspec-core-3.12.2/exe/rspec --pattern spec/\*\*\{,/\*/\*\*\}/\*_spec.rb  --exclude-pattern spec/acceptance/\*\*/\*_spec.rb
/home/runner/work/puppet-lint/puppet-lint/lib/puppet-lint.rb:255: warning: already initialized constant PuppetLint::CheckStarComments
/home/runner/work/puppet-lint/puppet-lint/lib/puppet-lint.rb:255: warning: previous definition of CheckStarComments was here
/home/runner/work/puppet-lint/puppet-lint/lib/puppet-lint.rb:255: warning: already initialized constant PuppetLint::CheckSlashComments
/home/runner/work/puppet-lint/puppet-lint/lib/puppet-lint.rb:255: warning: previous definition of CheckSlashComments was here
ChrLau commented 7 months ago

We see this error too in our CI-Containers. We use onceover-codequality and apparently they released a new version (0.11.0 - see Issue 30: puppet-lint renamed to puppetlabs-puppet-lint ) with fixed dependencies.

Our Gemfile looks the following:

source 'https://internal-repository'
gem 'puppetlabs_spec_helper', '~>7.0.0'
gem 'puppet', '~>7.27.0'
gem 'onceover', '~>3.21'
gem 'onceover-codequality', '~>0.11'

When our container is build, I can see that only the puppetlabs-puppet-lint is installed:

Fetching gem metadata from https://internal-repository...........
Resolving dependencies...
Fetching rake 13.1.0
Installing rake 13.1.0
Fetching base64 0.2.0
Fetching blockenspiel 0.5.0
Fetching public_suffix 5.0.3
Fetching backticks 1.0.5
Installing base64 0.2.0
Installing backticks 1.0.5
Installing blockenspiel 0.5.0
Using bundler 2.2.24
Fetching colored 1.2
Installing public_suffix 5.0.3
Fetching colored2 3.1.2
Fetching concurrent-ruby 1.2.2
Fetching cri 2.15.11
Installing colored 1.2
Installing colored2 3.1.2
Installing cri 2.15.11
Installing concurrent-ruby 1.2.2
Fetching deep_merge 1.2.2
Installing deep_merge 1.2.2
Fetching diff-lcs 1.5.0
Fetching erubi 1.12.0
Fetching hocon 1.4.0
Fetching thor 1.3.0
Installing erubi 1.12.0
Installing diff-lcs 1.5.0
Fetching faraday-net_http 3.0.2
Fetching ruby2_keywords 0.0.5
Installing hocon 1.4.0
Installing thor 1.3.0
Fetching fast_gettext 2.3.0
Fetching forwardable 1.3.3
Installing faraday-net_http 3.0.2
Installing forwardable 1.3.3
Installing ruby2_keywords 0.0.5
Installing fast_gettext 2.3.0
Fetching locale 2.1.3
Fetching singleton 0.2.0
Fetching racc 1.7.3
Fetching text 1.3.1
Installing singleton 0.2.0
Installing racc 1.7.3 with native extensions
Installing locale 2.1.3
Installing text 1.3.1
Fetching rchardet 1.8.0
Installing rchardet 1.8.0
Fetching little-plugger 1.1.4
Fetching jwt 2.7.1
Fetching hiera 3.12.0
Fetching log4r 1.1.10
Installing little-plugger 1.1.4
Installing hiera 3.12.0
Installing jwt 2.7.1
Fetching multi_json 1.15.0
Fetching minitar 0.9
Fetching mocha 1.16.1
Installing log4r 1.1.10
Fetching parallel 1.23.0
Installing parallel 1.23.0
Installing multi_json 1.15.0
Installing minitar 0.9
Installing mocha 1.16.1
Fetching scanf 1.0.0
Fetching semantic_puppet 1.1.0
Installing scanf 1.0.0
Installing semantic_puppet 1.1.0
Fetching pathspec 1.1.3
Installing pathspec 1.1.3
Fetching puppetlabs-puppet-lint 5.0.0
Installing puppetlabs-puppet-lint 5.0.0
Fetching rspec-support 3.12.1
Fetching unicode-display_width 2.5.0
Installing rspec-support 3.12.1
Installing unicode-display_width 2.5.0
Fetching rgen 0.9.1
Fetching yard 0.9.34
Installing rgen 0.9.1
Fetching versionomy 0.5.0
Installing versionomy 0.5.0
Installing yard 0.9.34
Fetching addressable 2.8.5
Fetching facter 4.5.1
Installing addressable 2.8.5
Installing facter 4.5.1
Fetching puppet-resource_api 1.9.0
Installing puppet-resource_api 1.9.0
Fetching faraday 2.7.11
Installing faraday 2.7.11
Fetching prime 0.1.2
Installing prime 0.1.2
Fetching parallel_tests 4.3.0
Installing parallel_tests 4.3.0
Fetching logging 2.3.1
Fetching terminal-table 3.0.2
Installing terminal-table 3.0.2
Installing logging 2.3.1
Fetching rspec-core 3.12.2
Installing rspec-core 3.12.2
Fetching rspec-expectations 3.12.3
Installing rspec-expectations 3.12.3
Fetching rspec-mocks 3.12.6
Installing rspec-mocks 3.12.6
Fetching git 1.18.0
Installing git 1.18.0
Fetching gettext 3.4.9
Fetching faraday-follow_redirects 0.3.0
Fetching rspec-github 2.4.0
Installing faraday-follow_redirects 0.3.0
Installing rspec-github 2.4.0
Fetching rspec_junit_formatter 0.6.0
Fetching rspec 3.12.0
Installing rspec_junit_formatter 0.6.0
Installing gettext 3.4.9
Installing rspec 3.12.0
Fetching puppet-strings 4.1.0
Fetching puppet_forge 5.0.3
Installing puppet-strings 4.1.0
Installing puppet_forge 5.0.3
Fetching puppetlabs-rspec-puppet 5.0.0
Installing puppetlabs-rspec-puppet 5.0.0
Fetching rspec-puppet 4.0.0
Installing rspec-puppet 4.0.0
Fetching puppet 7.27.0
Installing puppet 7.27.0
Fetching gettext-setup 1.1.0
Installing gettext-setup 1.1.0
Fetching r10k 4.0.0
Installing r10k 4.0.0
Fetching puppet-syntax 3.3.0
Installing puppet-syntax 3.3.0
Fetching puppetlabs_spec_helper 7.0.0
Installing puppetlabs_spec_helper 7.0.0
Fetching onceover 3.21.0
Installing onceover 3.21.0
Fetching onceover-codequality 0.11.0
Installing onceover-codequality 0.11.0
Bundle complete! 4 Gemfile dependencies, 69 gems now installed.

Yet we receive the same errors and our CI-Pipelines fail.

kmille commented 7 months ago

I'm the maintainer of the Arch Linux AUR package. I also get the warnings running v5.0.0. Anything I can do? I'm not a ruby pro. Currently holding back the update.

ekohl commented 7 months ago

Right now I'd ignore version 5. There is work ongoing to research ways to make it less painful for the whole ecosystem

bastelfreak commented 7 months ago

@kmille hey, puppet package maintainer for Arch Linux here, please ignore the puppet-lint 5 release for now. You can also follow https://github.com/puppetlabs/puppet-lint/discussions/173

jordanbreen28 commented 7 months ago

Hi everyone, Apologies for the inconvenience all this caused. We have rolled back the v5.0.0 release of puppetlabs-puppet-lint, so removing this gem from your bundle environments should eliminate the conflicts and thus the warnings. It worths noting we will be sticking with puppet-lint from now on, so this should not happen again. If you're pulling the puppet-lint gem in through puppetlabs_spec_helper, v7.0.1 was released yesterday which should now pull in the correct gem. Thanks!