Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

puppet profile imagePuppet Developer Experience
Puppet Developer Experience forpuppet

Posted on • Originally published atpuppetlabs.github.io on

puppet-lint: Already initialized constant warnings

For awhile now, thevoxpupuli-puppet-lint-plugins meta gem has provided the community with a number of amazing plugins forpuppet-lint.

With the latest release ofpuppet-lint and and Vox’s plugins gem, a few things have changed that might cause a bit of friction when updating.

I wanted to take a second to go over a few scenarios that might help you on your journey.

Problem

First of all, lets talk about the problem.

Inpuppet-lint v3.1.0 we adopted two plugins which are now included as default checks:

Prior to v4.0.0 ofvoxpupuli-puppet-lint-plugins, these plugins were included in the meta gem.

So now we have a scenario where it’s possible to updatepuppet-lint (>= 3.1.0) and end up with duplicate plugins installed.

In this case, users may see warnings like this:

warning: already initialized constant PuppetLint::CheckLegacyFactswarning: previous definition of CheckLegacyFacts was herewarning: already initialized constant LEGACY_FACTS_VAR_TYPES....warning: already initialized constant TOP_SCOPE_FACTS_VAR_TYPESwarning: previous definition of TOP_SCOPE_FACTS_VAR_TYPES was here
Enter fullscreen modeExit fullscreen mode

Not the end of the world, but it’s extra noise that you don’t want in your pipeline.

Help! This is happening to me!

So you are seeing these warnings? Read on…

What we are seeing here is a soft dependency conflict.

We have two identical plugins registering the same code inside puppet lint. That’s what is causing thealready initialized constant warning.

The best way forward is to clean up our environment and start again.

Remove voxpupuli-puppet-lint-plugins and it’s dependencies

We can start by removing dependencies ofvoxpupuli-puppet-lint-plugins.

The command below will do just that. We grab the dependencies of Vox’s meta gem and remove them one by one.

gem dependency voxpupuli-puppet-lint-plugins --pipe | grep "puppet-lint" | cut -d" " -f1 | xargs gem uninstall -aIx
Enter fullscreen modeExit fullscreen mode

Note: Take extra care when running commands like this! 👀

After the previous command has completed, we should be left with thevoxpupuli-puppet-lint-plugins meta gem.

Let’s remove it with the following command:

gem uninstall voxpupuli-puppet-lint-plugins
Enter fullscreen modeExit fullscreen mode

..and check to see if everything has really gone.

gem list | grep "puppet-lint"
Enter fullscreen modeExit fullscreen mode

Tldr; It should return nothing! Hurrah 🎉

Re-install the latest gems

Now we are free to re-install puppet-lint andvoxpupuli-puppet-lint-plugins

gem install puppet-lintgem install voxpupuli-puppet-lint-plugins
Enter fullscreen modeExit fullscreen mode

Once they have installed you can enjoy a warning freepuppet-lint experience with all of the joys fromvoxpupuli-puppet-lint-plugins!

… unless you have linting issues!

Top comments(0)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

Make infrastructure actionable, scalable and intelligent.

Puppet has a supportive, active community of thousands of people who are making Puppet better — and making IT a better place to work. We'd love to have you join us; you’ll learn a lot and we'll learn a lot from you.

More frompuppet

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp