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

Install lsb-release on Ubuntu 16/18 docker images #244

Closed
wants to merge 1 commit into from

Conversation

root-expert
Copy link
Member

lsb_release tools is now missing from Ubuntu 16/18 docker images causing acceptance puppet 6 tests to fail.
Facter 3.x utilizes lsb_release tool for obtaining os.distro fact.

Some PRs that are failing due to this:

And probably all of the modules that use os.distro fact will fail on Ubuntu 16/18 platforms.

P.S it's the first time touching this utility so any help is appreciated it 😄

@codecov
Copy link

codecov bot commented Feb 14, 2022

Codecov Report

Merging #244 (f1fd541) into master (08f6074) will decrease coverage by 0.00%.
The diff coverage is 0.00%.

❗ Current head f1fd541 differs from pull request most recent head d4ef3d4. Consider uploading reports for the commit d4ef3d4 to get more accurate results

Impacted file tree graph

@@            Coverage Diff            @@
##           master    #244      +/-   ##
=========================================
- Coverage    0.52%   0.52%   -0.01%     
=========================================
  Files          14      14              
  Lines        2477    2486       +9     
=========================================
  Hits           13      13              
- Misses       2464    2473       +9     
Impacted Files Coverage Δ
lib/beaker-hostgenerator/data.rb 0.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 08f6074...d4ef3d4. Read the comment docs.

Copy link
Member

@ekohl ekohl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if this really works. It's not a deep merge so this part will overwrite it:

docker_commands << "apt-get install -y net-tools wget #{extra_packages_to_install.join(' ')}"
docker_commands << 'locale-gen en_US.UTF-8'
docker_commands << 'echo LANG=en_US.UTF-8 > /etc/default/locale'

Please change it there.

@root-expert
Copy link
Member Author

Copy link
Member

@ekohl ekohl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Taking a step back: doing so gives the impression you can always count on these facts. That can lead to subtle breakages. For example, I think in the case of Zabbix the solution is to use safer methods that don't fail as hard (voxpupuli/puppet-zabbix#813 (comment)). Nginx now passes so I no longer see why it failed. It may need a similar treatment.

I think I'm generally more in favor of that than pretending it's always present. For example, now it won't be in the README and users may run into it and find out the hard way.

@root-expert
Copy link
Member Author

IMO these facts on Puppet 7 are supposed to be always present like os.family because their value is based on /etc/os-release unlike with Puppet 6 which is based on lsb_release.

I agree, though, that accessing facts in a more secure way should become a coding guideline here in Voxpupuli. E.g we already have the "no topscope variables for facts" maybe we should enforce fact() or dig, as you said, as well.

I still believe this PR still has its value since multiple modules' PRs are failing due to this right now and migrating away from these facts or accessing them with fact() is time consuming.

@ekohl
Copy link
Member

ekohl commented Feb 14, 2022

IMHO if modules fail on this, that's legitimate. They should be dealing with it differently.

My reasoning is that you may have the following code:

package { 'lsb-release':
  ensure => installed,
}

Then you would eventually be consistent. However, because the catalog fails to compile when using $facts['os']['distro']['id'], it can never be executed. That means you need to solve this via provisioning or some other mechanism outside of Puppet.

Perhaps we should have a lint rule that says "Don't ever write $facts['os']['distro']['id'] if you want Facter < 4 compatibility"?

@root-expert
Copy link
Member Author

root-expert commented Feb 17, 2022

That's a good point actually. I believe that lsb-release should be a recommended package for puppet-agent (as bastelfreak state in IRC) since os.distro facts are not legacy and Facter 3 needs lsb-release to resolve them. But I don't think that's gonna happen.

Linting this is a good idea for Voxpupuli. Puppet Inc. uses these facts on some their modules as well:

So some our workflows will still fail because of external modules.

@baurmatt
Copy link

Soooooo, what's the recommended solution for this? :) puppet-prometheus is running into this as well.

For me it sounds totally valid that hostgenerator adds lsb-release for Ubuntu 16.04/18.04 as those Docker images contained it before.

@ekohl
Copy link
Member

ekohl commented Feb 25, 2022

I'm still 👎 on this. If a module needs lsb-release, it should clearly state this and deal with it. It's not something you can count on. I don't have lsb-release installed on my actual systems (VMs) either.

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

Successfully merging this pull request may close these issues.

3 participants