Uploaded image for project: 'Puppet'
  1. Puppet
  2. PUP-8368

Non-English windows puppet agent run fails with 'incompatible character encodings' when run against non-existent server

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Normal
    • Resolution: Fixed
    • PUP 5.3.3
    • PUP 5.3.4, PUP 5.4.0
    • None
    • None
      • enable test on Windows JA tests/i18n/modules/puppet_agent_cached_catalog.rb
    • Platform Core
    • Platform Core KANBAN
    • Automated Test
    • Bug Fix
    • Puppet agents on non-English Windows hosts would crash if they encountered a socket error, such as failing to connect to the default server named "puppet".
    • No Action

    Description

      On a Windows Japanese box if you run 'puppet agent -t --server no_such_host' the agent prints errors about incompatible encodings:

      $ puppet.bat agent -t --server no_such_host
      Warning: ノード定義を取得できませんが、agent実行を続行します:
      Warning: Failed to open TCP connection to no_such_host:8140 (getaddrinfo: そのようなホストは不明です。 )
      Info: pluginfactsを取得しています。
      Warning: detail.class: SocketError
      Warning: detail.to_s.encoding: ASCII-8BIT
      Error: カタログ適用に失敗しました: incompatible character encodings: UTF-8 and ASCII-8BIT
      Error: Puppet設定クライアントを実行できません: incompatible character encodings: UTF-8 and ASCII-8BIT
      

      The underlying issue appears to be when an error has be rescued, and as the error string is ASCII-8BIT and the formatting of the string blows up:

        def eval_generate(resource)
          return false unless resource.respond_to?(:eval_generate)
          raise Puppet::DevError, _("Depthfirst resources are not supported by eval_generate") if resource.depthfirst?
          begin
            generated = replace_duplicates_with_catalog_resources(resource.eval_generate)
            return false if generated.empty?
          rescue => detail
            @resources_failed_to_generate = true
            #TRANSLATORS eval_generate is a method name and should be left untranslated
            resource.log_exception(detail, _("Failed to generate additional resources using 'eval_generate': %{detail}") % { detail: detail })
      

      If you print out the class and string encoding value:

      Warning: detail.class: SocketError
      Warning: detail.to_s: Failed to open TCP connection to no_such_host:8140 (getaddrinfo: そのようなホストは不明です。 )
      Warning: detail.to_s.encoding: ASCII-8BIT
      

      Here is the stack trace:

      C:/Program Files/Puppet Labs/Puppet/sys/ruby/lib/ruby/gems/2.4.0/gems/fast_gettext-1.1.1/lib/fast_gettext/vendor/string.rb:70:in `%'
      C:/Program Files/Puppet Labs/Puppet/sys/ruby/lib/ruby/gems/2.4.0/gems/fast_gettext-1.1.1/lib/fast_gettext/vendor/string.rb:70:in `%'
      C:/Program Files/Puppet Labs/Puppet/sys/ruby/lib/ruby/vendor_ruby/puppet/transaction/additional_resource_generator.rb:64:in `rescue in eval_generate'
      C:/Program Files/Puppet Labs/Puppet/sys/ruby/lib/ruby/vendor_ruby/puppet/transaction/additional_resource_generator.rb:55:in `eval_generate'
      C:/Program Files/Puppet Labs/Puppet/sys/ruby/lib/ruby/vendor_ruby/puppet/transaction.rb:112:in `block in evaluate'
      C:/Program Files/Puppet Labs/Puppet/sys/ruby/lib/ruby/vendor_ruby/puppet/graph/relationship_graph.rb:119:in `traverse'
      C:/Program Files/Puppet Labs/Puppet/sys/ruby/lib/ruby/vendor_ruby/puppet/transaction.rb:169:in `evaluate'
      C:/Program Files/Puppet Labs/Puppet/sys/ruby/lib/ruby/vendor_ruby/puppet/resource/catalog.rb:231:in `block in apply'
      C:/Program Files/Puppet Labs/Puppet/sys/ruby/lib/ruby/vendor_ruby/puppet/util/log.rb:160:in `with_destination'
      C:/Program Files/Puppet Labs/Puppet/sys/ruby/lib/ruby/vendor_ruby/puppet/transaction/report.rb:144:in `as_logging_destination'
      C:/Program Files/Puppet Labs/Puppet/sys/ruby/lib/ruby/vendor_ruby/puppet/resource/catalog.rb:230:in `apply'
      C:/Program Files/Puppet Labs/Puppet/sys/ruby/lib/ruby/vendor_ruby/puppet/configurer/downloader.rb:13:in `evaluate'
      C:/Program Files/Puppet Labs/Puppet/sys/ruby/lib/ruby/vendor_ruby/puppet/configurer/plugin_handler.rb:19:in `download_plugins'
      C:/Program Files/Puppet Labs/Puppet/sys/ruby/lib/ruby/vendor_ruby/puppet/configurer.rb:450:in `download_plugins'
      C:/Program Files/Puppet Labs/Puppet/sys/ruby/lib/ruby/vendor_ruby/puppet/configurer.rb:118:in `get_facts'
      C:/Program Files/Puppet Labs/Puppet/sys/ruby/lib/ruby/vendor_ruby/puppet/configurer.rb:312:in `run_internal'
      C:/Program Files/Puppet Labs/Puppet/sys/ruby/lib/ruby/vendor_ruby/puppet/configurer.rb:225:in `block in run'
      C:/Program Files/Puppet Labs/Puppet/sys/ruby/lib/ruby/vendor_ruby/puppet/context.rb:65:in `override'
      C:/Program Files/Puppet Labs/Puppet/sys/ruby/lib/ruby/vendor_ruby/puppet.rb:260:in `override'
      C:/Program Files/Puppet Labs/Puppet/sys/ruby/lib/ruby/vendor_ruby/puppet/configurer.rb:199:in `run'
      C:/Program Files/Puppet Labs/Puppet/sys/ruby/lib/ruby/vendor_ruby/puppet/agent.rb:59:in `block (5 levels) in run'
      

      Attachments

        Issue Links

          Activity

            People

              josh Josh Cooper
              eric.delaney Eric Delaney
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Zendesk Support