edelight / chef-mongodb

MongoDB Chef cookbook
https://community.opscode.com/cookbooks/mongodb
Apache License 2.0
363 stars 3 forks source link

Cannot select package version #321

Open ghost opened 10 years ago

ghost commented 10 years ago

I'm trying to install mongo version 2.4.9. Any time I put a version number in default['mongodb']['package_version'] = '2.4.9' I get an error. I even get an error when I try 2.4.10. Both 2.4.10 and 2.4.9 are versions in the repo. The versions were verified using 'yum list mongo-10gen-2.4.9'. I have tried mongo-10gen and mongo-10gen-server for the package name. I'm not sure if I am doing something wrong or if this is a bug. Any help would be greatly appreciated.

   Error executing action `install` on resource 'package[mongo-10gen-server]'

   Chef::Exceptions::Package
   -------------------------
   Version 2.4.9 of mongo-10gen-server not found. Did you specify both version and release? (version-release, e.g. 1.84-10.fc6)

   Resource Declaration:
   ---------------------
   # In /tmp/kitchen/cookbooks/mongodb/recipes/install.rb

    65: package node[:mongodb][:package_name] do
    66:   options packager_opts
    67:   action :install
    68:   version node[:mongodb][:package_version]
    69: end
    70: 

   Compiled Resource:
   ------------------
   # Declared in /tmp/kitchen/cookbooks/mongodb/recipes/install.rb:65:in `from_file'

   package("mongo-10gen-server") do
     action [:install]
     retries 0
     retry_delay 2
     options "--nogpgcheck"
     package_name "mongo-10gen-server"
     version "2.4.9"
     cookbook_name :mongodb
     recipe_name "install"
   end
ghost commented 10 years ago

hmmm... on further digging I notice after I force_override the package-name:

force_override[:mongodb][:package_name] = 'mongo-10gen'

and I watch the logs I see:

but when I login into my vagrant system and do an rpm -qa | grep mongo I see:

[root@default-centos-65 ~]# rpm -qa | grep mongo mongodb-org-mongos-2.6.3-1.x86_64 mongodb-org-server-2.6.3-1.x86_64 mongodb-org-tools-2.6.3-1.x86_64 mongodb-org-shell-2.6.3-1.x86_64 mongodb-org-2.6.3-1.x86_64

jamesonjlee commented 10 years ago

are you on the latest github? (I have not pushed out latest version to supermarket yet).

the package should be mongodb-org not 10gen because 10gen changed their name.

ghost commented 10 years ago

I was on version 0.16.1 but couldn't figure out the issue so I thought I would try and older version 0.15.2. I switched to 10gen vs mongodb-org because I was trying to install 2.4.9 and another post talked about doing that with a force_override. That didn't seem to help because it appears to continue to use mongodb-org regardless. I can set the 10gen back to mongodb-org and see if that helps any.

ghost commented 10 years ago

so I went back to the defaults with the only change being:

default[:mongodb][:package_version] = '2.4.10-mongodb_1'

The issue with this is that 2.4.10 is under the 10gen name. yum list mongo* shows:

Available Packages mongo-10gen.x86_64 2.4.10-mongodb_1 mongodb

I'm assuming because the package is mongo-10gen I will not be able to install using mongodb-org? Or am I thoroughly lost and confused. It wouldn't be the first time.

BTW, thanks for responding and helping me out.

ghost commented 10 years ago

so a yum install mongo-10gen.x86_64 installs 2.6.3-1 so this appears to have nothing to do with the cookbook at all. Very annoying that the repo will not allow you to install an older version of mongo. Seems a bit silly that you are forced into 2.6.3.

jamesonjlee commented 10 years ago

mongodb-org man mongodb-org

ghost commented 10 years ago

Not sure what you are getting at with "mongodb-org man mongodb-org".

From what I can tell it does not seem like I will have the ability to install 2.4.9 using this cookbook. Does that sound right to you or am I missing something?

khobbits commented 10 years ago

I fixed my package version using: package_version: 2.4.10-mongodb_1

That bit and the chef recipe basically gets that done all correct, but yum won't let it do its job properly.

It basically runs: yum install mongo-10gen-server-2.4.10

And it returns: Package mongo-10gen-server is obsoleted by mongodb-org-server, trying to install mongodb-org-server-2.6.3-1.x86_64 instead Resolving Dependencies --> Running transaction check ---> Package mongodb-org-server.x86_64 0:2.6.3-1 will be installed

Without excluding packages from yum, I can't seem to find a way to install an older version, really odd.

ghost commented 10 years ago

I've been able to do the install outside of this cookbook. I use kitchen and berkself. If I set yum to obsolete = false and just run the following it works. I'm trying to figure out how to make that work inside the complete cookbook. I'm pretty new to chef and ruby so it has been slow going.

default['yum']['main']['obsoletes'] = false

[ "mongo-10gen", "mongo-10gen-server" ].each do |rpm| package rpm do version "2.4.9-mongodb_1" action :install end end

sclausson commented 10 years ago

Ran into the same issues. I was able to get it working with these attributes:

"package_name": "mongo-10gen-server" "package_version": "2.4.10-mongodb_1"

ghost commented 10 years ago

well the cookbook completes but my experience is that after the cookbook completes and I login to my VM and do an rpm -qa | grep mongo I see the following installed.

mongodb-org-server-2.6.3-1.x86_64