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

Fix catalog compilation failure when net/ftp is not available #491

Merged
merged 1 commit into from
Apr 13, 2023
Merged

Conversation

smortex
Copy link
Member

@smortex smortex commented Apr 10, 2023

When net/ftp is not available, the archive module fail to load and the
PuppetServer catalog compilation fail. While this gem is generally
available because part of the Ruby standard library, some flavors of
Ruby do noth ship with it by default, e.g. FreeBSD package of Ruby 3.2
or GitHub actions of Ruby 3.2.

Because the archive module has multiple ways to download files, the
absence of net/ftp is not necessarily an issue because when curl(1) is
available, it is preferred over net/ftp. The catalog compilation error
is therefore not required.

Lazy load net/ftp when the pure-ruby download-over-FTP code is run, so
that the absence of net/ftp cause a resource evaluation error on the
agent side and the rest of the catalog still apply.

Fixes #488

When net/ftp is not available, the archive module fail to load and the
PuppetServer catalog compilation fail.  While this gem is generally
available because part of the Ruby standard library, some flavors of
Ruby do noth ship with it by default, e.g. FreeBSD package of Ruby 3.2
or GitHub actions of Ruby 3.2.

Because the archive module has multiple ways to download files, the
absence of net/ftp is not necessarily an issue because when curl(1) is
available, it is preferred over net/ftp.  The catalog compilation error
is therefore not required.

Lazy load net/ftp when the pure-ruby download-over-FTP code is run, so
that the absence of net/ftp cause a resource evaluation error on the
agent side and the rest of the catalog still apply.

Fixes #488
@smortex smortex added the bug Something isn't working label Apr 10, 2023
@smortex smortex changed the title Lazy load net/ftp Fix catalog compilation failure when net/ftp is not available Apr 10, 2023
@david22swan
Copy link

Any word on this getting merged and released?

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.

some flavors of
Ruby do noth ship with it by default, e.g. FreeBSD package of Ruby 3.2
or GitHub actions of Ruby 3.2.

This isn't "flavors", it's just Ruby 3. In puppetlabs/puppetlabs-apt#1050 I did a similar thing and in puppetlabs/puppetlabs-apt#1050 (comment) it was suggested to move the require as close as possible to actual use, so I think this is correct.

@ekohl ekohl merged commit 9c0ac54 into master Apr 13, 2023
@ekohl ekohl deleted the fix-488 branch April 13, 2023 21:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing gem with ruby 3.1
4 participants