[BUG] TOML serializer error when merging a file which contains datetime value #62528
Labels
Bug
broken, incorrect, or confusing behavior
needs-triage
Upstream-Bug
is a result of an upstream issue, not in salt
Description
salt.states.file.serializer
for toml triggers an exception if the file (usingmerge_if_exists: True
) contains a datetime value (eg. token_obtained_at = 2022-08-24T16:32:01Z) such as used by gitlab runner configs/etc/gitlab-runner/config.toml
.If the file contains no datetime as values, everything works as expected.
If the file contains any datetime as values, the following error is returned.
Setup
Master and minions are deployed in local Proxmox VMs running Debian 10/11.
Writing a state to manage part of gitlab-runner config.toml while allowing
gitlab-runner --register
to still make changes to the config file.Using
salt.states.file.serializer
withserializer: toml
.Currently just testing with some values in defaults.yaml. This part contains no timestamps
Steps to Reproduce the behavior
Attempt to use file.serialize state with
merge_if_exist: True
set when existing declarations in the file contain datetime values.Expected behavior
Expect
/etc/gitlab-runner/config.toml
file to be updated with the supplied dataset while keeping the rest of the file intact.In this case, the only change should be changing
check_interval = 0
tocheck_interval = 5
Versions Report
salt --versions-report
(Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)Additional context
I suspect this may be similar to an issue I found in another project while researching this - uiri/toml#308 - which suggests it may be an issue with using deepcopy, which does appear in the error message included above.
The text was updated successfully, but these errors were encountered: