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

execpipe raises method error if the command fails with no output


    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Duplicate
    • Affects Version/s: PUP 5.0.0
    • Fix Version/s: None
    • Component/s: Types and Providers
    • Labels:
    • Environment:

      Archlinux running on Raspberry Pi 3,
      Ruby 2.4.0
      Puppet 5.0.0

    • Template:
    • Method Found:
      Needs Assessment
    • QA Risk Assessment:
      Needs Assessment


      I'm trying to install a package as followed:

        package { 'unifi':
          ensure => latest

      The error I get with --debug:

      Debug: Prefetching pacman resources for package
      Debug: Executing '/usr/bin/pacman -Q'
      Debug: Executing '/usr/bin/pacman -Sgg'
      Debug: Executing '/usr/bin/pacman -Q'
      Debug: Executing '/usr/bin/pacman -Sgg unifi'
      Error: /Stage[main]/Unifi/Package[unifi]: Could not evaluate: undefined method `encoding' for #<IO:(closed)>
      Did you mean?  set_encoding
      Notice: /Stage[main]/Unifi/Service[unifi]: Dependency Package[unifi] has failures: true

      Did some digging, and the command it's failing on is where it checks for package groups: https://github.com/puppetlabs/puppet/blob/5.0.0/lib/puppet/provider/package/pacman.rb#L102

      So it calls execpipe with the command, and the command returns 1 because the group doesn't exist, but otherwise returns no output. This lands us here: https://github.com/puppetlabs/puppet/blob/5.0.0/lib/puppet/util/execution.rb#L86

      The act of returning "output" as part of the exception attempts to stringify it. It's a closed IO pipe, so that fails when trying to call ".encoding". I confirmed this by replacing "output" on the raise line with an empty string, which fixed the error.


          Issue Links



              • Assignee:
                akerl Les Aker
                akerl Les Aker
              • Votes:
                0 Vote for this issue
                3 Start watching this issue


                • Created:

                  Zendesk Support