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

haproxy : groups array in userlist can not be undef

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Normal
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: haproxy
    • Labels:
    • Environment:

      version v6.1.0 of haproxy module

    • Template:
      MODULES Bug Template
    • Team:
      Modules

      Description

      Basic Info
      Module Version: v6.1.0
      Puppet Version: 6.23.0
      OS Name/Version: ubuntu 20.04

      commit 4287df8549421baf15716ddc7ea7540fe9e1bd93 from Fri Jun 18 14:11:59 2021 +0200 now renders an epp for haproxy userlist

      groups is optional and can be undef in manifests/userlist.pp: 

      Optional[Array[String]] $groups = undef

      but in templates/haproxy_userlist_block.epp the group array is rendered regardless and fails if groups is undef:

      <%-
      $epp_groups.each |String $group| {
      unless $group.empty {
      -%>
      group <%= $group %>

      IMHO a simple if wrapped around this would fix it:

      <%-
      if $epp_groups {
      $epp_groups.each |String $group| {
      unless $group.empty {
      -%>
      group <%= $group %>

       

      Desired Behavior:

      templates/haproxy_userlist_block.epp should render even if epp_groups is undef.

      Actual Behavior:

      if one just supplies a usergroup array with users but no groups, eg:

      haproxy::userlists:
      example.com:
      users:

      • myuser insecure-password xXxXxXxXxXxXxXxXxXxXxXxXxXxXxXxX

      then puppet fails:

      Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Resource Statement, Evaluation Error: Error while evaluating a Method call, 'each' expects one of:
      (Hash hash, Callable[2, 2] block)
      rejected: parameter 'hash' expects a Hash value, got Undef
      (Hash hash, Callable[1, 1] block)
      rejected: parameter 'hash' expects a Hash value, got Undef
      (Iterable enumerable, Callable[2, 2] block)
      rejected: parameter 'enumerable' expects an Iterable value, got Undef
      (Iterable enumerable, Callable[1, 1] block)
      rejected: parameter 'enumerable' expects an Iterable value, got Undef (file: /etc/puppetlabs/code/environments/production/modules/haproxy/templates/haproxy_userlist_block.epp, line: 9, column: 14) ...

       

       

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            pvargason Robert Vargason
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:

                Zendesk Support