[PUP-5811] Puppet is unable replace ISO-8859 English text with ASCII English text sourced file post upgrade from FOSS Created: 2016/02/01  Updated: 2018/06/08

Status: Accepted
Project: Puppet
Component/s: Docs
Affects Version/s: None
Fix Version/s: PUP 5.y

Type: Bug Priority: Normal
Reporter: Zack Smith Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: i18n, utf-8
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Relates
relates to PUP-7063 Handle incompatible encodings in Pupp... Closed
Template:
Epic Link: Phase 2 Puppet Unicode User Facing Improvements
Team: Coremunity

 Description   

When upgrading from Puppet 3.6.2 and more importantly Ruby 1.8.7 to Puppet 4 and Ruby 2.1.6p336 (2015-04-13 revision 50298) [x86_64-linux], puppet is unable to replace a file that was previously laid down by the older version of puppet/ruby.

Error: /Stage[main]/Ssl::Cacerts/File[/etc/pki/tls/certs/ca-bundle.crt]/content: change from {md5}6b39ebed99eb4b724966e1bcab09eb6d to {md5}3dbe985e13d4d1a09ee41b11d4e7e296 failed: invalid byte sequence in UTF-8

This is a sourced file

puppet:///modules/ssl/cacerts/ca-bundle.crt

The file on disk

 file  /etc/pki/tls/certs/ca-bundle.crt
/etc/pki/tls/certs/ca-bundle.crt: ISO-8859 English text
md5sum /etc/pki/tls/certs/ca-bundle.crt
6b39ebed99eb4b724966e1bcab09eb6d  /etc/pki/tls/certs/ca-bundle.crt

the file on master

file ca-bundle.crt 
ca-bundle.crt: ASCII English text
md5sum ca-bundle.crt 
3dbe985e13d4d1a09ee41b11d4e7e296  ca-bundle.crt

the trace shows this is actually our display code

Notice: /Stage[main]/Main/Cron[pe-mcollective-metadata]/ensure: current_value present, should be absent (noop)
Error: invalid byte sequence in UTF-8
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/colors.rb:92:in `gsub'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/colors.rb:92:in `console_color'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/colors.rb:82:in `colorize'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/log/destinations.rb:170:in `handle'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/log.rb:174:in `block in newmessage'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/log.rb:173:in `each'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/log.rb:173:in `newmessage'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/log.rb:266:in `initialize'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/log.rb:85:in `new'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/log.rb:85:in `create'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/logging.rb:9:in `send_log'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/logging.rb:18:in `block (2 levels) in <module:Logging>'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/type/file/content.rb:104:in `block in insync?'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/type/file/content.rb:167:in `write_temporarily'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/type/file/content.rb:103:in `insync?'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/property.rb:259:in `safe_insync?'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction/resource_harness.rb:123:in `sync_if_needed'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction/resource_harness.rb:89:in `block in perform_changes'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction/resource_harness.rb:88:in `each'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction/resource_harness.rb:88:in `perform_changes'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction/resource_harness.rb:20:in `evaluate'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction.rb:204:in `apply'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction.rb:220:in `eval_resource'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction.rb:147:in `call'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction.rb:147:in `block (2 levels) in evaluate'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util.rb:292:in `block in thinmark'
/opt/puppetlabs/puppet/lib/ruby/2.1.0/benchmark.rb:294:in `realtime'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util.rb:291:in `thinmark'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction.rb:147:in `block in evaluate'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/graph/relationship_graph.rb:118:in `traverse'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction.rb:138:in `evaluate'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/resource/catalog.rb:178:in `block in apply'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/log.rb:153:in `with_destination'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction/report.rb:107:in `as_logging_destination'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/resource/catalog.rb:177:in `apply'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/configurer.rb:119:in `block in apply_catalog'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util.rb:129:in `block in benchmark'
/opt/puppetlabs/puppet/lib/ruby/2.1.0/benchmark.rb:294:in `realtime'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util.rb:128:in `benchmark'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/configurer.rb:118:in `apply_catalog'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/configurer.rb:228:in `run_internal'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/configurer.rb:134:in `block in run'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/context.rb:64:in `override'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet.rb:223:in `override'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/configurer.rb:133:in `run'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/agent.rb:48:in `block (4 levels) in run'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/agent/locker.rb:20:in `lock'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/agent.rb:48:in `block (3 levels) in run'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/agent.rb:98:in `with_client'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/agent.rb:45:in `block (2 levels) in run'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/agent.rb:65:in `run_in_fork'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/agent.rb:44:in `block in run'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application.rb:179:in `call'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application.rb:179:in `controlled_run'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/agent.rb:42:in `run'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application/agent.rb:351:in `onetime'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application/agent.rb:328:in `run_command'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application.rb:344:in `block in run'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util.rb:446:in `exit_on_fail'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application.rb:344:in `run'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/command_line.rb:128:in `run'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/command_line.rb:72:in `execute'
/opt/puppetlabs/puppet/bin/puppet:5:in `<main>'
Error: /Stage[main]/Ssl::Cacerts/File[/etc/pki/tls/certs/ca-bundle.crt]/content: change from {md5}6b39ebed99eb4b724966e1bcab09eb6d to {md5}3dbe985e13d4d1a09ee41b11d4e7e296 failed: invalid byte sequence in UTF-8

Adding --color false fixes the first trace

Error: invalid byte sequence in UTF-8
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/log/destinations.rb:36:in `split'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/log/destinations.rb:36:in `handle'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/log.rb:174:in `block in newmessage'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/log.rb:173:in `each'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/log.rb:173:in `newmessage'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/log.rb:266:in `initialize'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/log.rb:85:in `new'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/log.rb:85:in `create'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/logging.rb:9:in `send_log'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/logging.rb:18:in `block (2 levels) in <module:Logging>'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/type/file/content.rb:104:in `block in insync?'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/type/file/content.rb:167:in `write_temporarily'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/type/file/content.rb:103:in `insync?'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/property.rb:259:in `safe_insync?'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction/resource_harness.rb:123:in `sync_if_needed'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction/resource_harness.rb:89:in `block in perform_changes'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction/resource_harness.rb:88:in `each'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction/resource_harness.rb:88:in `perform_changes'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction/resource_harness.rb:20:in `evaluate'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction.rb:204:in `apply'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction.rb:220:in `eval_resource'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction.rb:147:in `call'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction.rb:147:in `block (2 levels) in evaluate'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util.rb:292:in `block in thinmark'
/opt/puppetlabs/puppet/lib/ruby/2.1.0/benchmark.rb:294:in `realtime'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util.rb:291:in `thinmark'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction.rb:147:in `block in evaluate'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/graph/relationship_graph.rb:118:in `traverse'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction.rb:138:in `evaluate'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/resource/catalog.rb:178:in `block in apply'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/log.rb:153:in `with_destination'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/transaction/report.rb:107:in `as_logging_destination'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/resource/catalog.rb:177:in `apply'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/configurer.rb:119:in `block in apply_catalog'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util.rb:129:in `block in benchmark'
/opt/puppetlabs/puppet/lib/ruby/2.1.0/benchmark.rb:294:in `realtime'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util.rb:128:in `benchmark'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/configurer.rb:118:in `apply_catalog'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/configurer.rb:228:in `run_internal'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/configurer.rb:134:in `block in run'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/context.rb:64:in `override'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet.rb:223:in `override'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/configurer.rb:133:in `run'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/agent.rb:48:in `block (4 levels) in run'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/agent/locker.rb:20:in `lock'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/agent.rb:48:in `block (3 levels) in run'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/agent.rb:98:in `with_client'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/agent.rb:45:in `block (2 levels) in run'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/agent.rb:65:in `run_in_fork'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/agent.rb:44:in `block in run'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application.rb:179:in `call'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application.rb:179:in `controlled_run'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/agent.rb:42:in `run'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application/agent.rb:351:in `onetime'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application/agent.rb:328:in `run_command'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application.rb:344:in `block in run'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util.rb:446:in `exit_on_fail'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application.rb:344:in `run'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/command_line.rb:128:in `run'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/command_line.rb:72:in `execute'
/opt/puppetlabs/puppet/bin/puppet:5:in `<main>'

Adding -diff /bin/true + original args bypasses the error

sudo puppet agent -t --no-show_diff --color false --diff /bin/true
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Info: Caching catalog for puppet-postgres2001.sv2.box.net
Info: Applying configuration version '1454364865'
Notice: /Stage[main]/Main/Cron[pe-mcollective-metadata]/ensure: current_value present, should be absent (noop)
Notice: /Stage[main]/Ssl::Cacerts/File[/etc/pki/tls/certs/ca-bundle.crt]/content: 
Notice: /Stage[main]/Ssl::Cacerts/File[/etc/pki/tls/certs/ca-bundle.crt]/content: content changed '{md5}6b39ebed99eb4b724966e1bcab09eb6d' to '{md5}3dbe985e13d4d1a09ee41b11d4e7e296'



 Comments   
Comment by Zack Smith [ 2016/02/01 ]

This might need to go under PUP , but it has customer paths so I threw it here for right now as I am not sure how to make the whole ticket private on a public project

Comment by Lindsey Smith [ 2016/02/02 ]

Joshua Partlow should this be tagged with the Integration team? I can't really tell where it belongs.

Comment by Joshua Partlow [ 2016/02/02 ]

Zack Smith Can you give us more details about what exactly you are upgrading from, what you are upgrading too and how you are doing it? I'm not clear if this is an agent, foss or pe, etc., what platform(s) as well.

Is this a FOSS PUP 3.6.2 agent node which are you upgrading to puppet-agent <version?>...using the puppet_agent module, or something different?

Comment by Zack Smith [ 2016/02/02 ]

So my guess this is a core ticket, if someone with access wants to move it there but keep it internal. This was upgradeing from FOSS 3.6.2 to 2015.2.2 , but the core of this is that ruby 1.8.7 didn't care about UTF-8 and ruby 1.9+ does , so if you managed a file like this, its not able to be pushed out post upgrade. IN this particular case, its a failing of our display code in core puppet, not that puppet itself is NOT actually able to replace the file.

Comment by Joshua Partlow [ 2016/02/02 ]

Zack Smith How were you performing this upgrade? I'm sorry, I just don't have a clear sense of reproduction steps, and I'm still not clear if the problem you're having is upgrading a puppet 3.6.2 agent node to using puppet-agent 1.2.7.

Comment by Chris Price [ 2016/02/03 ]

this came up in our triage today; I put it into the "great unicode epic", and have assigned it to the client scrum team for now. Kylo Ginsberg if you think this should have a different scrum team assigned, lmk or change it.

Comment by Ethan Brown [ 2016/09/30 ]

We're including this in the agent team Phase 1 unicode epic for evaluation.

Comment by Ethan Brown [ 2017/03/30 ]

The stack trace demonstrates a problem in the logging - which we have a ticket for at PUP-7063.

Current thinking is that this ticket will likely be resolved with a note about potential upgrade issues. It will be really hard if Puppet managed a file as one encoding on an earlier version, for it to behave sanely if it is now managing the file as UTF-8. FWIW, for system files, Puppet should always be using the default system encoding (i.e. Rubys Encoding.default_external) unless it otherwise knows a file should be UTF-8 or ASCII (as may be the case with some certificate files for instance). It would be helpful in this particular case to see the manifest here? Just laying down a copy of a file using source shouldn't be a problem, but for any resource that is mutating file contents (i.e. like inifile), that's another story.

Generated at Thu Nov 14 11:31:52 PST 2019 using JIRA 7.7.1#77002-sha1:e75ca93d5574d9409c0630b81c894d9065296414.