puppetlabs/puppet

exec resource: path param should default to the path fact

Offen

#9.440 geöffnet am 03.08.2024

 (3 Kommentare) (1 Reaktion) (0 zugewiesene Personen)Ruby (2.214 Forks)batch import
enhancementhelp wanted

Repository-Metriken

Stars
 (7.854 Sterne)
PR-Merge-Metriken
 (Keine gemergten PRs in 30 T)

Beschreibung

Use Case

For some operations, exec resources are still common. The majority of exec resources I see use hardcoded paths like:

exec { 'nftables_memory_state_check':
  command     => '/bin/echo "reloading nftables"',
  refreshonly => true,
}

This often leads to problems because some distributions use /bin or /usr/bin and others /usr/sbin/. That makes it hard to write the resources for multiple operating systems. because of that I now mostly see this:

exec { 'nftables_memory_state_check':
  command     => 'echo "reloading nftables"',
  refreshonly => true,
  path        => $facts['path'],
}

I think path => $facts['path'], is repeated a lot. Because of that I think the path attribute should default to $facts['path'] when the user does not overwrite it.

Describe the Solution You Would Like

Update path to default to $facts['path'].

Describe Alternatives You've Considered

Using absolute paths or always setting path => $facts['path'],.

Additional Context

Contributor Guide