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 resource fails to install local package specified with source attribute #3008

Closed
causton81 opened this issue Mar 3, 2015 · 8 comments · Fixed by #3013
Closed

package resource fails to install local package specified with source attribute #3008

causton81 opened this issue Mar 3, 2015 · 8 comments · Fixed by #3013
Assignees
Milestone

Comments

@causton81
Copy link

Trying to install a local package with package resource and source attribute fails with No candidate version available for ...

Version 12.0.3 works fine. 12.1.0 does not.

@jaym
Copy link
Contributor

jaym commented Mar 3, 2015

What OS?
Also, any stack trace that you have would be useful

@causton81
Copy link
Author

CentOS release 6.6 (Final)

On Tue, Mar 3, 2015 at 1:45 PM, Jay Mundrawala notifications@github.com
wrote:

What OS?


Reply to this email directly or view it on GitHub
#3008 (comment).

-ca

@causton81
Copy link
Author

The problem appears to be here, where :install was added in 12.1.0:
https://github.com/chef/chef/blob/master/lib/chef/provider/package.rb#L57-L60

@lamont-granquist
Copy link
Contributor

We're probably going to need the full stack trace, the -ldebug output and the RPM that you're trying to install and if a prior version of the RPM is installed or not.

@lamont-granquist
Copy link
Contributor

Can't replicate this one either. For apt_package I just get:

"apt package provider cannot handle source attribute. Use dpkg provider instead"

Changing to dpkg_package works fine:

#!/usr/bin/env chef-apply

dpkg_package "chef" do
  source "/home/lamont/chef.deb"
end

@causton81
Copy link
Author

I am installing an Oracle jdk7 rpm. If the package does not already exist
in yum metadata then you should see the issue.
On Mar 3, 2015 2:40 PM, "Lamont Granquist" notifications@github.com wrote:

Can't replicate this one either. For apt_package I just get:

"apt package provider cannot handle source attribute. Use dpkg provider
instead"

Changing to dpkg_package works fine:

#!/usr/bin/env chef-apply

dpkg_package "chef" do
source "/home/lamont/chef.deb"end


Reply to this email directly or view it on GitHub
#3008 (comment).

@jaymzh
Copy link
Collaborator

jaymzh commented Mar 3, 2015

@lamont-granquist yeah, it's because chef is in your apt metadata. If you do:

package 'balbal' do
  source "/home/lamont/chef.deb"
end

You'll repro this. I'm unclear how it broke though the old assertions seem to enforce the same thing.

@jaymzh
Copy link
Collaborator

jaymzh commented Mar 3, 2015

Something like this seems to to suffice:

--- a/lib/chef/provider/package.rb
+++ b/lib/chef/provider/package.rb
@@ -56,7 +56,7 @@ class Chef
         end

         requirements.assert(:upgrade, :install) do |a|
-          a.assertion  { candidates_exist_for_all_uninstalled? }
+          a.assertion  { candidates_exist_for_all_uninstalled? || new_resource.source }
           a.failure_message(Chef::Exceptions::Package, "No candidate version available for #{packages_missing_candidates.join(", ")}")
           a.whyrun("Assuming a repository that offers #{packages_missing_candidates.join(", ")} would have been configured")
         end

I'm not entirely certain I'm not missing something though.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants