Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jenkins_plugins fact is locale-dependent which can cause a plugin installation loop #993

Open
aptituz opened this issue Oct 14, 2020 · 2 comments

Comments

@aptituz
Copy link

aptituz commented Oct 14, 2020

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: 5.5.21
  • Ruby:
  • Distribution: Ubuntu Xenial
  • Module version: 2.0.0

How to reproduce (e.g Puppet code you use)

The problem is triggered when installing plugins, for which the manifest contains UTF-8 sequences. This is the case, for example, when jenkins::plugins_hash contains the ws-cleanup plugin in version 0.38.

The problem can then be reproduced in two ways:

  1. Invoking puppet agent with a non utf8 locale, like C.
  2. Invoking facter without any modifications to the locale configuration.
LANG=C puppet agent -t

When invoking facter directly, the problem seems to be independent from the locale, so just running

facter -p jenkins_plugins

should be enough to reproduce it.

What are you seeing

When running puppet it will try to install some plugins again and again. In the facter output the plugins will be missing.

What behaviour did you expect instead

I would expect the plugin to install modules only once and the jenkins_plugins fact to return all facts.

Any additional information you'd like to impart

We are running puppet as part of bootstrapping machines via cloud-init. In this constellation puppet runs with a very minimal environment and in this case this means that no LANG variable is set.

The problem can be traced down to the code that reads the manifest file (https://github.com/voxpupuli/puppet-jenkins/blob/master/lib/puppet/jenkins/plugins.rb#L57). In files that contain UTF-8 sequences this would trigger an exception which leads to the plugin being excluded from the output.

A possible fix is to to change the File.read invocation like this:

File.read(manifest, :encoding => 'UTF-8')
@ekohl
Copy link
Member

ekohl commented Oct 14, 2020

I wonder if this explains the EL7 acceptance test failure in docker. Could you come up with a patch?

@ekohl ekohl linked a pull request Nov 5, 2020 that will close this issue
@ekohl
Copy link
Member

ekohl commented Nov 5, 2020

I opened #996 with your suggestion to see if it fixes the EL7 Docker install test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants