Jira (PUP-11763) Puppet resource can't load time object to YAML

2 views
Skip to first unread message

Michael Hashizume (Jira)

unread,
Feb 17, 2023, 2:40:04 PM2/17/23
to puppe...@googlegroups.com
Michael Hashizume created an issue
 
Puppet / Task PUP-11763
Puppet resource can't load time object to YAML
Issue Type: Task Task
Assignee: Unassigned
Created: 2023/02/17 11:39 AM
Priority: Normal Normal
Reporter: Michael Hashizume

In Puppet 8 (puppet-agent#727d2c8949953ea0c735ed570efbe2bf544d2180),  running puppet resource --to_yaml file generates an error:

[root@choice-homerun ~]# /opt/puppetlabs/puppet/bin/puppet resource -y file /root/test.pp --verbose --debug
Debug: Runtime environment: puppet_version=8.0.0, ruby_version=3.2.0, run_mode=user, default_encoding=UTF-8
Debug: Evicting cache entry for environment :production
Debug: Deleted text domain :production: false
Debug: Caching environment :production (ttl = 0 sec)
Debug: Evicting cache entry for environment :production
Debug: Deleted text domain :production: false
Debug: Facter: Resolving facts sequentially
Debug: Facter: resolving fact with user_query: os.name
Debug: Facter: Searching fact: os.name in file: os.name.rb
Debug: Facter: Searching fact: os.name in core facts and external facts
Debug: Facter: Loading all internal facts
Debug: Facter: List of resolvable facts: [#<Facter::SearchedFact:0x00007fcc8b2f8c08 @name="os.name", @fact_class=Facts::Rhel::Os::Name, @user_query="os.name", @type=:core, @file=nil>]
Debug: Facter: Loading external facts
Debug: Facter: fact "os.name" has resolved to: RedHat
Error: Could not run: Evaluation Error: File[/root/test.pp]['ctime'] contains a Time value. It will be converted to the String '2023-02-17 17:49:08 +0000'

I tried this on RHEL 7 with a few arbitrary files and got the same error each time.

I recall that there were some changes in Psych that caused time-related issues for Timecop that we stumbled upon last year, I wonder if this is the same issue or at least related: https://github.com/travisjeffery/timecop/issues/390

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v8.20.11#820011-sha1:0629dd8)
Atlassian logo

Josh Cooper (Jira)

unread,
Feb 21, 2023, 2:20:01 PM2/21/23
to puppe...@googlegroups.com
Josh Cooper commented on Task PUP-11763
 
Re: Puppet resource can't load time object to YAML

The issue is the file provider implements a "retrieve" method for all of its properties, like mtime & cmtime and the "retrieve" method is returning a Time object, instead of a String. So then we attempt to serialize the current state of the system using PCore and due to strict=error it now fails. See PUP-10105 and PUP-4608.

We probably need to change the ctime and mtime properties to return a either a String or pops Timestamp instead of Ruby Time object. Fortunately these properties are "read-only" so they can only be returned by the provider and never specified in a manifest (which reduces the likelihood of a regression).

Tony Vu (Jira)

unread,
Feb 21, 2023, 4:28:02 PM2/21/23
to puppe...@googlegroups.com
Tony Vu updated an issue
 
Change By: Tony Vu
Labels: needs-validation

Aria Li (Jira)

unread,
Feb 22, 2023, 1:41:02 PM2/22/23
to puppe...@googlegroups.com
Aria Li assigned an issue to Aria Li
Change By: Aria Li
Assignee: Aria Li

Aria Li (Jira)

unread,
Feb 22, 2023, 1:42:03 PM2/22/23
to puppe...@googlegroups.com
Aria Li assigned an issue to Unassigned

Michael Hashizume (Jira)

unread,
Feb 22, 2023, 6:02:02 PM2/22/23
to puppe...@googlegroups.com

Michael Hashizume (Jira)

unread,
Feb 22, 2023, 6:02:02 PM2/22/23
to puppe...@googlegroups.com

Michael Hashizume (Jira)

unread,
Feb 22, 2023, 6:03:02 PM2/22/23
to puppe...@googlegroups.com

Michael Hashizume (Jira)

unread,
Feb 22, 2023, 6:03:02 PM2/22/23
to puppe...@googlegroups.com
Michael Hashizume updated an issue
Change By: Michael Hashizume
Sprint: Phoenix 2023-03-01

Josh Cooper (Jira)

unread,
Feb 23, 2023, 12:52:02 PM2/23/23
to puppe...@googlegroups.com
Josh Cooper updated an issue
Change By: Josh Cooper
Fix Version/s: PUP 7.24.0

Josh Cooper (Jira)

unread,
Mar 21, 2023, 4:56:02 PM3/21/23
to puppe...@googlegroups.com
Josh Cooper updated an issue
Change By: Josh Cooper
Release Notes: Bug Fix
Release Notes Summary: The "file" resource now supports "puppet resource file <path> --to_yaml"

Parker Leach (Jira)

unread,
Apr 5, 2023, 5:55:01 PM4/5/23
to puppe...@googlegroups.com
Parker Leach updated an issue
Change By: Parker Leach
Labels: docs_reviewed
Reply all
Reply to author
Forward
0 new messages