Uploaded image for project: 'Modules'
  1. Modules
  2. MODULES-11102

haproxy: Error: Facter: error while resolving custom fact "haproxy_version": undefined method `strip' for nil:NilClass

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: haproxy
    • Labels:
    • Environment:

      Distributor ID: Debian
      Description: Debian GNU/Linux 10 (buster)
      Release: 10
      Codename: buster

      Puppet: 6.22.1
      puppetlabs-haproxy: 6.0.1

    • Template:
      MODULES Bug Template
    • Team:
      Modules
    • Method Found:
      Manual Test

      Description

      When using newer haproxy 2.4 from https://haproxy.debian.net/#?distribution=Debian&release=buster&version=2.4 the following error is shown:

      Error: Facter: error while resolving custom fact "haproxy_version": undefined method `strip' for nil:NilClass

       

      haproxy -v now shows HAProxy and not HA-Proxy:

      $ haproxy -v
      HAProxy version 2.4.0-1~bpo10+1 2021/05/21 - https://haproxy.org/
      Status: long-term supported branch - will stop receiving fixes around Q2 2026.
      Known bugs: http://www.haproxy.org/bugs/bugs-2.4.0.html
      Running on: Linux 5.4.72-microsoft-standard-WSL2 #1 SMP Wed Oct 28 23:40:43 UTC 2020 x86_64

       old version shows:

      $ haproxy -v
      HA-Proxy version 1.8.19-1+deb10u3 2020/08/01
      Copyright 2000-2019 Willy Tarreau <willy@haproxy.org>

       

      I think this can be fixed with changing haproxy/lib/facter/haproxy_version.rb (adding a '*' after 'HA-').

      --- /opt/puppetlabs/puppet/cache/lib/facter/haproxy_version.rb  2021-05-05 16:29:51.740000000 +0200
      +++ /tmp/puppet-file20210611-62386-1dq4r24      2021-06-11 16:31:03.550000000 +0200
      @@ -18,7 +18,7 @@
           haproxy_version_cmd = 'haproxy -v 2>&1'
           haproxy_version_result = Facter::Util::Resolution.exec(haproxy_version_cmd)
           setcode do
      -      haproxy_version_result.to_s.lines.first.strip.split(%r{HA-Proxy})[1].strip.split(%r{version})[1].strip.split(%r{((\d+\.){2,}\d+).*})[1]
      +      haproxy_version_result.to_s.lines.first.strip.split(%r{HA-*Proxy})[1].strip.split(%r{version})[1].strip.split(%r{((\d+\.){2,}\d+).*})[1]
           end
         end
       end
      

        Attachments

          Activity

            People

            Assignee:
            adrian.iurca Adrian Iurca
            Reporter:
            reini Reini
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Zendesk Support