Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

exec resource: path param should default to the path fact #9440

Open
bastelfreak opened this issue Aug 3, 2024 · 3 comments
Open

exec resource: path param should default to the path fact #9440

bastelfreak opened this issue Aug 3, 2024 · 3 comments
Labels
enhancement New feature or request help wanted Issue has been reviewed & PRs are welcome

Comments

@bastelfreak
Copy link
Contributor

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

@bastelfreak bastelfreak added the enhancement New feature or request label Aug 3, 2024
@joshcooper
Copy link
Contributor

Ah yeah, this is a common problem on Windows too, because you can't be sure where Windows installed.

@AriaXLi AriaXLi added the help wanted Issue has been reviewed & PRs are welcome label Aug 6, 2024
@AriaXLi
Copy link
Contributor

AriaXLi commented Aug 6, 2024

Hi @bastelfreak, thank you for reporting this issue. While we agree this is likely an improvement, we do not anticipate addressing this any time soon due to other issues demanding precedence. We may revisit this at a later time.

If you are interested in submitting a patch to implement this issue, please open a pull request and link this issue. I've added the help wanted label in case any contributors could submit a patch.

bastelfreak added a commit to bastelfreak/puppet-1 that referenced this issue Aug 7, 2024
bastelfreak added a commit to bastelfreak/puppet-1 that referenced this issue Aug 7, 2024
bastelfreak added a commit to bastelfreak/puppet-1 that referenced this issue Aug 7, 2024
bastelfreak added a commit to bastelfreak/puppet-1 that referenced this issue Aug 7, 2024
bastelfreak added a commit to bastelfreak/puppet-1 that referenced this issue Aug 7, 2024
bastelfreak added a commit to bastelfreak/puppet-1 that referenced this issue Aug 7, 2024
bastelfreak added a commit to bastelfreak/puppet-1 that referenced this issue Aug 7, 2024
bastelfreak added a commit to bastelfreak/puppet-1 that referenced this issue Aug 7, 2024
@bastelfreak
Copy link
Contributor Author

I implemented it in #9445

bastelfreak added a commit to bastelfreak/puppet-1 that referenced this issue Aug 26, 2024
bastelfreak added a commit to bastelfreak/puppet-1 that referenced this issue Aug 26, 2024
bastelfreak added a commit to bastelfreak/puppet-1 that referenced this issue Aug 26, 2024
bastelfreak added a commit to bastelfreak/puppet-1 that referenced this issue Aug 26, 2024
bastelfreak added a commit to bastelfreak/puppet-1 that referenced this issue Aug 26, 2024
bastelfreak added a commit to bastelfreak/puppet-1 that referenced this issue Aug 26, 2024
bastelfreak added a commit to bastelfreak/puppet-1 that referenced this issue Aug 26, 2024
bastelfreak added a commit to bastelfreak/puppet-1 that referenced this issue Sep 13, 2024
bastelfreak added a commit to bastelfreak/puppet-1 that referenced this issue Sep 26, 2024
bastelfreak added a commit to bastelfreak/puppet-1 that referenced this issue Sep 26, 2024
bastelfreak added a commit to bastelfreak/puppet-1 that referenced this issue Sep 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Issue has been reviewed & PRs are welcome
Projects
None yet
Development

No branches or pull requests

3 participants