Skip to content

Conversation

ekohl
Copy link
Collaborator

@ekohl ekohl commented May 30, 2024

Summary

Using File.open without closing it can leak file descriptors. It's actually not needed at all because File.foreach, File.readlines and File.write all accept a filename. This simplifies the code in the process.

Then it simplifies the code by passing an offset to with_index to calculate line numbers. Rather than starting from 0 and always adding 1, this tells with_index to start at 1.

It also fixes the spelling of PostgreSQL in a debug statement.

Checklist

At this point I haven't verified this yet, but submitting it so I can more easily test it on some system.

  • 🟢 Spec tests.
  • 🟢 Acceptance tests.
  • Manually verified. (For example puppet apply)

Copy link
Collaborator

@bastelfreak bastelfreak left a comment

Choose a reason for hiding this comment

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

I think this is fine to merge, we've acceptance tests that cover this

ekohl added 3 commits July 12, 2024 10:15
Using File.open without closing it can leak file descriptors. It's
actually not needed at all because File.foreach, File.readlines and
File.write all accept a filename. This simplifies the code in the
process.
Rather than starting from 0 and always adding 1, this tells with_index
to start at 1.
@bastelfreak bastelfreak force-pushed the fix-postgresql_conf branch from 67edd23 to f2b193d Compare July 12, 2024 08:22
@bastelfreak
Copy link
Collaborator

did a bit more testing locally to verify this works

@Ramesh7 Ramesh7 merged commit a72637b into puppetlabs:main Jul 12, 2024
@ekohl ekohl deleted the fix-postgresql_conf branch July 12, 2024 10:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants