Jira (PDB-4548) Exporting and importing resources with binary data in parameters encodes the data base64

1 view
Skip to first unread message

Reinhard Vicinus (JIRA)

unread,
Oct 10, 2019, 11:25:03 AM10/10/19
to puppe...@googlegroups.com
Reinhard Vicinus created an issue
 
PuppetDB / Bug PDB-4548
Exporting and importing resources with binary data in parameters encodes the data base64
Issue Type: Bug Bug
Affects Versions: PDB 6.7.0
Assignee: Unassigned
Created: 2019/10/10 8:24 AM
Priority: Normal Normal
Reporter: Reinhard Vicinus

With puppet 6 the agent can now store binary data in the catalog, but the puppetdb can not. Because the catalog needs to be UTF-8 encoded, binary data gets base64 encoded in the catalog. The value gets stored base64 encoded in the puppetdb database but the information that it is base64 encoded is not stored. That results in that binary values of exported resources are base64 encoded on importing. Here is an example:

$x = { 'y' => 'test'}
# This is a really ugly hack to create ASCII-8BIT encoded data:
inline_template('<% @x["y"] = "test".force_encoding("ASCII-8BIT")  %>')
$v = $x['y']
 
case $::fqdn {
  'node1': {
    @@file { '/tmp/test_export.txt':
      content => $v,
    }
  }
  'node2': {
    File <<| title == '/tmp/test_export.txt' |>>
  }
}
 
file { '/tmp/test_local.txt':
  content => $v,
}   

Running puppet on node2 results in:

> puppet agent --test --environment=rvlocal
Info: Using configured environment 'rvlocal'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Retrieving locales
Info: Loading facts
Info: Caching catalog for node2
Info: Applying configuration version 'rvlocal heads/production-0-gee541e2af'
Notice: /Stage[main]/Main/File[/tmp/test_local.txt]/content: 
--- /tmp/test_local.txt 2019-10-10 17:14:19.736052885 +0200
+++ /tmp/puppet-file20191010-23720-m5tcm0       2019-10-10 17:14:30.928307399 +0200
@@ -0,0 +1 @@
+test
\ No newline at end of file
[..]
Notice: /Stage[main]/Main/File[/tmp/test_export.txt]/content: 
--- /tmp/test_export.txt        2019-10-10 17:14:14.895942817 +0200
+++ /tmp/puppet-file20191010-23720-g3yyt1       2019-10-10 17:14:30.988308764 +0200
@@ -0,0 +1 @@
+dGVzdA==
\ No newline at end of file
[..]

The content of the /tmp/test_export.txt Resource should also be "test" and not test base64 encoded.

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.7.1#77002-sha1:e75ca93)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages