-
Notifications
You must be signed in to change notification settings - Fork 580
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1417 from alexjfisher/deprecate_time
Deprecate `time` function
- Loading branch information
Showing
5 changed files
with
56 additions
and
109 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# @summary This function is deprecated. It implements the functionality of the original non-namespaced stdlib `time` function. | ||
# | ||
# It is provided for compatability, but users should use the native time related functions directly. | ||
# | ||
# @param _timezone | ||
# This parameter doesn't do anything, but exists for compatability reasons | ||
function stdlib::time(Optional[String] $_timezone = undef) >> Integer { | ||
# Note the `timezone` parameter doesn't do anything and didn't in the ruby implementation for _years_ (pre 1.8.7 perhaps ???) | ||
deprecation('time', 'The stdlib `time` function is deprecated. Please direcly use native Puppet functionality instead. eg. `Integer(Timestamp().strftime(\'%s\'))`', false) | ||
Integer(Timestamp().strftime('%s')) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# frozen_string_literal: true | ||
|
||
# @summary DEPRECATED. Use the native Puppet fuctionality instead of this function. eg `Integer(Timestamp().strftime('%s'))` | ||
Puppet::Functions.create_function(:time) do | ||
dispatch :call_puppet_function do | ||
repeated_param 'Any', :args | ||
end | ||
def call_puppet_function(*args) | ||
# Note, `stdlib::time` calls `deprecation`, so we don't also do that here. | ||
call_function('stdlib::time', *args) | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters