puppetlabs / puppetlabs-puppet_agent

Module for managing Puppet-Agent
Apache License 2.0
41 stars 192 forks source link

(MODULES-11361) Updates legacy facts #637

Closed mhashizume closed 1 year ago

mhashizume commented 1 year ago

In preparation for the removal of legacy facts in Puppet 8, this commit updates all of the legacy facts in this module to modern, structured facts.

puppet-community-rangefinder[bot] commented 1 year ago

puppet_agent is a class

that may have no external impact to Forge modules.

puppet_agent::install is a class

that may have no external impact to Forge modules.

puppet_agent::install::solaris is a class

that may have no external impact to Forge modules.

puppet_agent::install::suse is a class

that may have no external impact to Forge modules.

puppet_agent::install::windows is a class

that may have no external impact to Forge modules.

puppet_agent::osfamily::aix is a class

that may have no external impact to Forge modules.

puppet_agent::osfamily::darwin is a class

that may have no external impact to Forge modules.

puppet_agent::osfamily::redhat is a class

that may have no external impact to Forge modules.

puppet_agent::osfamily::solaris is a class

that may have no external impact to Forge modules.

puppet_agent::osfamily::suse is a class

that may have no external impact to Forge modules.

puppet_agent::params is a class

that may have no external impact to Forge modules.

puppet_agent::prepare is a class

that may have no external impact to Forge modules.

puppet_agent::prepare::package is a class

that may have no external impact to Forge modules.

puppet_agent::service is a class

that may have no external impact to Forge modules.

This module is declared in 3 of 580 indexed public Puppetfiles.


These results were generated with Rangefinder, a tool that helps predict the downstream impact of breaking changes to elements used in Puppet modules. You can run this on the command line to get a full report.

Exact matches are those that we can positively identify via namespace and the declaring modules' metadata. Non-namespaced items, such as Puppet 3.x functions, will always be reported as near matches only.

mhashizume commented 1 year ago

I initially got the version wrong for the puppetlabs-apt bump, I've force-pushed a commit to correct this.

I had also forgotten about https://github.com/puppetlabs/puppetlabs-puppet_agent/pull/624, which also addresses the puppetlabs-apt bump. Not sure if it makes more sense to merge that PR and rebase or just merge this as-is

joshcooper commented 1 year ago

Seeing CI failures resulting in an undefined variable:

09:42:02       Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Operator '[]' is not applicable to an Undef Value. (file: /etc/puppetlabs/code/environments/puppet_agent_testing_8e5301734dc501f7cf12/modules/puppet_agent/manifests/osfamily/darwin.pp, line: 4, column: 6) on node novel-deterrent.delivery.puppetlabs.net

The legacy facts check defines this mapping https://github.com/puppetlabs/puppet-lint/blob/eb8922289a7c142d3e491c7467c97602ad83fe47/lib/puppet-lint/plugins/legacy_facts/legacy_facts.rb#L67-L69 but os.version doesn't exist, at least not with puppet7/facter4:

09:41:59       Debug: Facter: fact "os" has resolved to {
09:41:59         architecture => "x86_64",
09:41:59         family => "Darwin",
09:41:59         hardware => "x86_64",
09:41:59         macosx => {
09:41:59           build => "20D75",
09:41:59           product => "macOS",
09:41:59           version => {
09:41:59             full => "11.2.1",
09:41:59             major => "11.2",
09:41:59             minor => "1"
09:41:59           }
09:41:59         },
09:41:59         name => "Darwin",
09:41:59         release => {
09:41:59           full => "20.3.0",
09:41:59           major => "20",
09:41:59           minor => "3"
09:41:59         }
09:41:59       }.

Assuming it's not facter4, then I think the mapping needs to reference os.release.* instead.

mhashizume commented 1 year ago

@joshcooper I ran into this issue earlier today. I have a commit in my latest PR that should fix it in the module: https://github.com/puppetlabs/puppetlabs-puppet_agent/pull/639/commits/27350cd66ff23c7a9392f4ab436ae8899d38289a

I kicked off an experimental pipeline with that branch earlier tonight, I'll confirm that everything looks right tomorrow and we can hopefully get it merged.

I also have a PR open for puppet-lint to fix the mapping: https://github.com/puppetlabs/puppet-lint/pull/103

joshcooper commented 1 year ago

awesome thanks @mhashizume!