Puppet-lint: Soft dependency conflicts after updating
Tags: puppet, linting, puppetlint
Published: 2023-03-17 11:54:37

---
title: Puppet-lint: Soft dependency conflicts after updating
published: true
description: 
tags:
- puppet
- linting
- puppetlint

# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
# published_at: 2023-03-17 11:49 +0000
---

For a [while now](https://github.com/voxpupuli/voxpupuli-puppet-lint-plugins/commit/04879bddcd1d2f52bcb8806140cf666bd94120cb), the [`voxpupuli-puppet-lint-plugins`](https://github.com/voxpupuli/voxpupuli-puppet-lint-plugins) meta gem has provided the community with a number of amazing plugins for `puppet-lint`.

With the latest release of `puppet-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.

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

* [puppet-lint-legacy_facts-check](https://github.com/mmckinst/puppet-lint-legacy_facts-check)
* [puppet-lint-top_scope_facts-check](https://github.com/mmckinst/puppet-lint-top_scope_facts-check)

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

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

In this case, users may see warnings like this:

```shell!
warning: already initialized constant PuppetLint::CheckLegacyFacts
warning: previous definition of CheckLegacyFacts was here
warning: already initialized constant LEGACY_FACTS_VAR_TYPES
....
warning: already initialized constant TOP_SCOPE_FACTS_VAR_TYPES
warning: previous definition of TOP_SCOPE_FACTS_VAR_TYPES was here
```

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 the `already 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 of `voxpupuli-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.

```bash
gem dependency voxpupuli-puppet-lint-plugins --pipe | grep "puppet-lint" | cut -d" " -f1 | xargs gem uninstall -aIx
```

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

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

Let's remove it with the following command:

```bash
gem uninstall voxpupuli-puppet-lint-plugins
```

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

```bash
gem list | grep "puppet-lint"
``` 

Tldr; It should return nothing! Hurrah 🎉 

#### Re-install the latest gems

Now we are free to re-install puppet-lint and `voxpupuli-puppet-lint-plugins`

```
gem install puppet-lint
gem install voxpupuli-puppet-lint-plugins
```

Once they have installed you can enjoy a warning free `puppet-lint` experience with all of the joys from `voxpupuli-puppet-lint-plugins`!

... unless you have linting issues!