Search code examples
puppet

Puppet Exec with no command attribute


I'm looking at some Puppet code to try and see how it works and the Exec and File statements below have me very confused as there is no command attribute declared, nor a file specified for the file closure.

Can someone explain how this works please?

 case $operatingsystem {
      CentOS, RedHat, OracleLinux, Ubuntu, Debian, SLES: {
        $execPath        = "/usr/java/${fullJDKName}/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:"
        $path            = $downloadDir
        $beaHome         = $mdwHome

        $oraInventory    = "${oracleHome}/oraInventory"
        $oraInstPath     = "/etc"
        $java_statement  = "java ${javaParameters}"

        Exec { path      => $execPath,
               user      => $user,
               group     => $group,
               logoutput => true,
             }
        File {
               ensure  => present,
               mode    => 0775,
               owner   => $user,
               group   => $group,
               backup  => false,
             }
      }

Solution

  • Resource types with an initial capital letter set defaults for later instances of that type.

    In your example, all execs in scope will use the path, user, group, and logoutput parameters set there. File resources will similarly use the parameters set there as well.

    See https://docs.puppetlabs.com/puppet/latest/reference/lang_defaults.html