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

Package type should support environment variables #9264

Open
baurmatt opened this issue Feb 26, 2024 · 4 comments
Open

Package type should support environment variables #9264

baurmatt opened this issue Feb 26, 2024 · 4 comments
Labels
accepted Valid issue that we intend to work on when we have the bandwidth enhancement New feature or request

Comments

@baurmatt
Copy link
Contributor

I will just link to the JIRA ticket as this is now a (almost) 10 years old feature request which I'm just mirroring over to the new Github issue tracking process.

https://puppet.atlassian.net/browse/PUP-1526

@baurmatt baurmatt added the enhancement New feature or request label Feb 26, 2024
@techsk8
Copy link

techsk8 commented Feb 26, 2024

Been dying to see this one implemented for soo looong.

@joshcooper
Copy link
Contributor

joshcooper commented Feb 27, 2024

The original request was to support situations like:

# This is needed for removing the sudo package since it won't uninstall
# when there is no root password set or $SUDO_FORCE_REMOVE != yes
exec { '/usr/bin/apt-get --force-yes --assume-yes install sudo-ldap':
    environment => 'SUDO_FORCE_REMOVE=yes',
    unless      => '/usr/bin/dpkg -l sudo-ldap|tail -1|grep "^ii"'
}

An earlier attempt was made in #4928, but that was closed due to inactivity.

To add this capability, an environment parameter needs to be added to Puppet::Type::Package, similar to how this is done for Puppet::Type::Exec

newparam(:environment) do

If an environment parameter is specified on a package resource, then the package providers should pass the parameter into the Puppet::Util::Execution.execute method as a custom_environment

:custom_environment => {},

Similarly for calls to execpipe like

Puppet::Util::Execution.execpipe(cmd, &block)

We also need to account for the has_command DSL method, which providers use to resolve commands like:

commands :cmd => "yum", :rpm => "rpm"

I started hacking on this here https://github.com/puppetlabs/puppet/compare/main...joshcooper:puppet:package_environment?expand=1

@techsk8
Copy link

techsk8 commented Feb 29, 2024

Do you estimate this will be released in the next minor puppet release?

@joshcooper
Copy link
Contributor

Do you estimate this will be released in the next minor puppet release?

Sorry no, no idea. The branch above is just to explore different options and see how this might be implemented.

@AriaXLi AriaXLi added the accepted Valid issue that we intend to work on when we have the bandwidth label Mar 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted Valid issue that we intend to work on when we have the bandwidth enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants