Open MvRiegen opened 1 year ago
Ok, got it working as a workaround by defining a custom function 'bacula::enforce_utf8' that only overrides the encoding:
Puppet::Functions.create_function(:'bacula::enforce_utf8') do
dispatch :enforce_utf8 do
param 'String', :value
return_type 'String'
end
def enforce_utf8(value)
Puppet::Util::CharacterEncoding.override_encoding_to_utf_8(value)
end
end
and then use the function in manifest/job.pp when collecting the job ressources:
@@bacula::director::job { $name:
content => bacula::enforce_utf8(epp($template, $epp_job_variables)),
tag => $resource_tags,
}
Not sure if this is the valid fix, I need a bit more testing before submitting a pull request. But at least it works again here with Puppet 8.1.0.
Interesting, I have not switched my infra with backups to Puppet 8 yet so not faced it. This look like a regression that better be fixed in the PuppetDB / PuppetServer code rather than in each module that consume exported epp resources.
All templates in the module are "ASCII text", do your $epp_job_variables
introduce non-ASCII chars? Can you show what file /etc/bacula/conf.d/job.conf
report on the system where you workaround the issue?
I could reproduce the issue, the base64 encoded string once decoded is really "ASCII text" so no surprise here. The exported bacula::director::fileset
which do not use epp()
for the parameter value is not affected, so it looks like the epp()
method provided by Puppet should be fixed.
Adding a .force_encoding('UTF-8')
at the end of the epp()
function fix this issue, but maybe this is not the proper solution. Will do more test tomorrow.
All templates in the module are "ASCII text", do your
$epp_job_variables
introduce non-ASCII chars? Can you show whatfile /etc/bacula/conf.d/job.conf
report on the system where you workaround the issue?
As far as i can see, there are no non-ASCII chars in my config - and I just realized you were already able to reproduce it, cool 👍
Anything I can do more for help? I assume a pull request with my workaround would only fix the symptom but not the root cause in this case.
After upgrading to Puppet 8.1.0 (server and agent), the bacula job description (i.e. /etc/bacula/conf.d/job.conf) collects the exported resources on the director node as before, although all fragments are now base64 encoded in the file and the director can not start due to this.
Not sure if it's related to something similar mentioned here: PuppetDB gets base64 encoded string on exported ressources
Tried several things like up/downgrading the concat module, but so far it simply does not work as expected.
Affected Puppet, Ruby, OS and module versions/distributions