-
Notifications
You must be signed in to change notification settings - Fork 2.2k
(PUP-10854) allow apt to install local packages #8495
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
(PUP-10854) allow apt to install local packages #8495
Conversation
| cmd << :install | ||
|
|
||
| if should_use_source? | ||
| cmd << @resource[:source] | ||
| else | ||
| cmd << str | ||
| end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be better to provide some info if the manifest has ensure => 1.2.3, source => /path/to/packge. In this case i would assume the version is ignored.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added check to allow only :present and :installed for ensure when using source parameter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could not be good enough since we may need a way to handle package upgrades
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what if we pass through ensure value and in case source file was specified, we make sure the expected version was installed (this is what yum provider does in all cases):
puppet/lib/puppet/provider/package/apt.rb
Lines 165 to 174 in c0e007a
| # If a source file was specified, we must make sure the expected version was installed from specified file | |
| if source | |
| is = self.query | |
| raise Puppet::Error, _("Could not find package %{name}") % { name: self.name } unless is | |
| version = is[:ensure] | |
| raise Puppet::Error, _("Failed to update to version %{should}, got version %{version} instead") % { should: should, version: version } unless | |
| insync?(version) | |
| end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this could work and it would be consistent.
5b13c44 to
7c9b177
Compare
c0e007a to
1d573d5
Compare
lib/puppet/provider/package/apt.rb
Outdated
| end | ||
|
|
||
| # If a source file was specified, we must make sure the expected version was installed from specified file | ||
| if source && !should.is_a?(Symbol) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we need !should.is_a?(Symbol)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if the install command was successful, the package should have been installed, extra-check is not needed in case if :present or :installed values
we do extra-checks only in case specific version was requested
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than relying on object type, maybe we should check the actual values.
1d573d5 to
19f20d1
Compare
Before puppet-18.0, using an absolute path as package name allowed
users to install local packages using apt. While this was working,
the functionality was unintended and incomplete(eg. puppet will execute
package install command each run and will report changes).
This commit enables the usage of `source` parameter with `apt` provider
and now a user can install a local package using a manifest like bellow:
```
package { 'helloworld':
source => '/tmp/helloworld_1.0-1.deb'
ensure => installed,
}
```
19f20d1 to
3884b28
Compare
Before puppet-18.0, using an absolute path as package name allowed
users to install local packages using apt. While this was working,
the functionality was unintended and incomplete(eg. puppet will execute
package install command each run and will report changes).
This commit enables the usage of
sourceparameter withaptproviderand now a user can install a local package using a manifest like bellow: