Jira (PUP-11404) Timestamp.new function doesn't support ISO 8601 week-based year and week number

3 views
Skip to first unread message

Grégoire Menuel

unread,
Jan 4, 2022, 5:32:02 AM1/4/22
to puppe...@googlegroups.com
Grégoire Menuel created an issue
 
Puppet / Bug PUP-11404
Timestamp.new function doesn't support ISO 8601 week-based year and week number
Issue Type: Bug Bug
Affects Versions: PUP 7.12.1
Assignee: Unassigned
Components: Types and Providers
Created: 2022/01/04 2:31 AM
Priority: Normal Normal
Reporter: Grégoire Menuel

The following puppet code which used the ISO 8601 week-based year and week number parsing as indicated in the documentation fails

 

notice(Timestamp.new('2022011', '%G%V%w')) 

The error is the following:

Error: Evaluation Error: Error while evaluating a Method call, no implicit conversion of nil into Integer (file: /tmp/test.pp, line: 1, column: 21) on node 

Which is far from useful. This error seems to come from https://github.com/puppetlabs/puppet/blob/main/lib/puppet/pops/time/timestamp.rb#L106 where the code expect parsed datetime to have a :year entry, unfortunaly the hash doesn't have this key:

irb(main):002:0> DateTime._strptime('2022011', '%G%V%w')
=> {:cwyear=>2022, :cweek=>1, :wday=>1} 

 

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v8.20.2#820002-sha1:829506d)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages