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

Deprecate time function #1417

Merged
merged 1 commit into from Feb 14, 2024
Merged

Conversation

alexjfisher
Copy link
Collaborator

time was both an old API ruby function, and not needed since Puppet 4.

In this commit, the parser function is removed and replaced by a non-namespaced APIv4 function. This is done to preserve compatibility before the function is removed completely in a later release.

The ruby function calls a Puppet language function which implements the existing behaviour using core Puppet functionality.

The original function did something weird with an optional timezone parameter. Nobody really remembers why. It appears that very early versions of Ruby may have been buggy and needed this as a workaround.

To be clear, seconds since the epoch are the same everywhere. Timezone is not relevant.

Additional Context

Also see ad4ca4c
This also relates to #1260 as it removes another function completely from lib/puppet/parser/functions.

`time` was both an old API ruby function, and not needed since Puppet 4.

In this commit, the `parser` function is removed and replaced by a
non-namespaced APIv4 function. This is done to preserve compatibility
before the function is removed completely in a later release.

The ruby function calls a Puppet language function which implements the
existing behaviour using core Puppet functionality.

The original function did something weird with an optional `timezone`
parameter. Nobody really remembers why. It appears that very early
versions of Ruby may have been buggy and needed this as a workaround.

To be clear, seconds since the epoch are the same _everywhere_. Timezone
is not relevant.
Copy link
Collaborator

@smortex smortex left a comment

Choose a reason for hiding this comment

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

LGTM!

@ekohl
Copy link
Collaborator

ekohl commented Feb 8, 2024

To be clear, seconds since the epoch are the same everywhere. Timezone is not relevant.

I'm not entirely sure this is true. I think epoch has a timezone, so the way it could work is that you set the local timezone (like Europe/Amsterdam). Then when you get the current time would convert it to Epoch's timezone. Then convert that time to seconds. That's the only way that I can think of that the timezone parameter makes sense, but it is confusing to say the least (as all timezones are).

Copy link
Collaborator

@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.

👍 to deprecating this.

@alexjfisher alexjfisher merged commit 802eb9a into puppetlabs:main Feb 14, 2024
48 of 50 checks passed
@alexjfisher alexjfisher deleted the deprecate_time branch February 14, 2024 10:22
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.

None yet

5 participants