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

(PUP-12029) Prepare for Ruby 3.3 #9398

Merged
merged 3 commits into from
Jun 21, 2024
Merged

Conversation

joshcooper
Copy link
Contributor

@joshcooper joshcooper commented Jun 18, 2024

Running puppet with Ruby 3.3.0 prints:

$ bundle exec puppet --version
/home/josh/work/puppet/lib/puppet/settings.rb:4: warning: getoptlong was loaded from the standard library, but will no longer be part of the default gems since Ruby 3.4.0. Add getoptlong to your Gemfile or gemspec.
/home/josh/work/puppet/lib/puppet/util/feature.rb:116: warning: syslog was loaded from the standard library, but will no longer be part of the default gems since Ruby 3.4.0. Add syslog to your Gemfile or gemspec.

Since getoptlong is necessary to parse the command line and is a pure ruby gem,
it's safe to add it as a runtime dependency in puppet.gemspec.

Since syslog is a feature and requires native extensions, add it to the features
group in the Gemfile. It will also need to be added to the runtime on
non-Windows platforms.

The versions were chosen to match what is currently shipped in ruby 3.2.4, but
updates to the patch component are allowed.

Fixes #9209

Running puppet with Ruby 3.3.0 prints:

    $ bundle exec puppet --version
    /home/josh/work/puppet/lib/puppet/settings.rb:4: warning: getoptlong was loaded from the standard library, but will no longer be part of the default gems since Ruby 3.4.0. Add getoptlong to your Gemfile or gemspec.
    /home/josh/work/puppet/lib/puppet/util/feature.rb:116: warning: syslog was loaded from the standard library, but will no longer be part of the default gems since Ruby 3.4.0. Add syslog to your Gemfile or gemspec.

Since getoptlong is necessary to parse the command line and is a pure ruby gem,
it's safe to add it as a runtime dependency in puppet.gemspec.

Since syslog is a feature and requires native extensions, add it to the features
group in the Gemfile (excluding Windows and JRuby). It will also need to be
added to the runtime on non-Windows platforms.

The versions were chosen to match what is currently shipped in ruby 3.2.4, but
updates to the patch component are allowed.
Ruby 3.3 changed NoMethodError message format so it no longer calls to_s on our
Interface, see ruby commit 1fd181b453a
Single quote dependency names and sort them for maintainability.
@joshcooper joshcooper changed the title (PUP-12029) Add syslog and getoptlong dependencie (PUP-12029) Prepare for Ruby 3.3 Jun 18, 2024
@joshcooper joshcooper marked this pull request as ready for review June 18, 2024 01:29
@joshcooper joshcooper requested a review from a team as a code owner June 18, 2024 01:29
@joshcooper joshcooper added the enhancement New feature or request label Jun 18, 2024
Copy link
Contributor

@mhashizume mhashizume left a comment

Choose a reason for hiding this comment

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

LGTM. Do we have a follow up ticket to add syslog to the runtime?

@mhashizume mhashizume merged commit fa0e42a into puppetlabs:main Jun 21, 2024
10 checks passed
@joshcooper joshcooper deleted the ruby33 branch June 21, 2024 20:18
@techsk8
Copy link

techsk8 commented Sep 10, 2024

LGTM. Do we have a follow up ticket to add syslog to the runtime?

Related to the comment above, I'm getting this warning while running puppet 8.8.1 with ruby 3.3.0, on every spec test:

$ bundle exec rake parallel_spec
I, [2024-09-10T08:39:40.654531 #30846]  INFO -- : Creating symlink from spec/fixtures/modules/blackhole to /Users/myuser/source/puppet/control/site/blackhole
I, [2024-09-10T08:39:40.654661 #30846]  INFO -- : Creating symlink from spec/fixtures/modules/stdlib to /Users/myuser/source/puppet/control/site/blackhole/../../modules/external/stdlib
2 processes for 2 specs, ~ 1 spec per process
/Users/myuser/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/gems/puppet-8.8.1-universal-darwin/lib/puppet/util/feature.rb:116: warning: syslog was loaded from the standard library, but will no longer be part of the default gems since Ruby 3.4.0. Add syslog to your Gemfile or gemspec. Also contact author of puppet-8.8.1-universal-darwin to add syslog into its gemspec.
No facts were found in the FacterDB for Facter v4.8.0 on {"os.name"=>"Ubuntu", "os.release.full"=>"/^22\\.04/", "os.hardware"=>"x86_64"}, using v4.7.0 instead
No facts were found in the FacterDB for Facter v4.8.0 on {"os.name"=>"Ubuntu", "os.release.full"=>"/^22\\.04/", "os.hardware"=>"x86_64"}, using v4.7.0 instead
..

Finished in 0.07776 seconds (files took 2.16 seconds to load)
2 examples, 0 failures

...

Coverage Report:

Total resources:   2
Touched resources: 0

I thought I'd drop a comment here and not open a new issue just for this, as it's not a big deal.

@joshcooper
Copy link
Contributor Author

[syslog] will also need to be added to the runtime on non-Windows platforms.

Turns out this is not true. syslog is still a bundled gem in 3.4 (see https://github.com/ruby/ruby/blob/9d69619623ec6b86c464b7cac911b7201f74dab7/gems/bundled_gems#L35), so we can be certain that the gem can be required. It's only when a gem is no longer default or bundled (like scanf) that it needs to be added to the runtime.

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

Successfully merging this pull request may close these issues.

puppet doesn't run with Ruby 3.3.0
3 participants