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

Exported resource collectors don't support standard puppet expression set

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Normal
    • Resolution: Won't Do
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Environment:

      This would effect all versions on all platforms.

    • Template:

      Description

      When trying to gather resources, it would be helpful to be able to gather resources by a regex using the regex match operator (=~).

      Example;

      I have some database servers running in one data center, with two replicated databases in two other datacenters. To allow replication traffic, I've created firewall rules which allow tcp traffic on port 3306. On the servers which are on a local network, they additionally need a firewall rule to allow traffic over a local ip address.

      class myapp::db::firewall {
        @@firewall { "180 INPUT allow mysql for $::hostname" :
            chain   => 'INPUT',
            source  => $::ipaddress_main,
            action  => accept,
            port    => 3306,
            state   => 'NEW',
        }
        Firewall <| port == 3306  and title =~ /^180 INPUT allow mysql/ |>
       
        if $::ipaddress_private != undef and $::datacenter == "digitalocean" {
          @@firewall { "190 INPUT allow mysql for $::hostname" :
              chain   => 'INPUT',
              source  => $::ipaddress_private,
              action  => accept,
              port    => 3306,
              state  => 'NEW,
          }
          Firewall <| port == 3306 and title =~ /^190 INPUT allow mysql for / |>
          }
        }
      }
      

      $::ipaddress_main, $::ipaddress_private, $::datacenter are custom facts which I've written. The code as it stands does not compile, and I've had to use a work-around that isn't very clean. Support for =~ in resource collectors would seriously streamline my puppet code, and make resource collection more straightforward.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned
              Reporter:
              r00sri James Loosli
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Zendesk Support