1 Reply Latest reply on Sep 17, 2018 4:41 PM by yairi

    puppet resource command


      I've created a puppet resource for interfaces. Most of the interface names on my switch are lowercase with the exception of Ethernet interfaces, so I munged the interface name to hopefully reduce errors in the manifest; e.g.:


        cisco_interface { 'Ethernet1/1': description => 'foo' } 


        newparam(:name) do munge { |value| value.downcase } end 

      My provider code also downcases the interface names when I collect the list of interfaces with self.instances.

      So this works great when I test with the manifest, but not so great with the puppet resource command which only works when I call it with the name already downcased:

      switch# puppet resource cisco_interface 'Ethernet1/1' cisco_interface { 'Ethernet1/1': ensure => 'absent', }  switch# puppet resource cisco_interface 'ethernet1/1' cisco_interface { 'ethernet1/1': ensure                       => 'present', description                  => 'foo', } 

      The puppet resource command name field seems to just be a simple filter so I think I'm stuck, but I thought I'd seen other resource types munging title values like this.

      Is it possible to munge the title values in a way that works for both scenarios? If not then I'm not sure whether it would be better to leave it case-sensitive since that is what users will see in the switch config, or to "help" them avoid errors in the manifest.