Chef recipe failing with a error no candidate version

hi,
i am trying to install jenkins on my node with help of a cookbook.
when i run chef-client on the node following error occurs all the time.
error:
- execute yum update -y

  • yum_package[jenkins] action install

    • No candidate version available for jenkins
      ================================================================================
      Error executing action install on resource ‘yum_package[jenkins]’
      ================================================================================

    Chef::Exceptions::Package

    No candidate version available for jenkins

    Resource Declaration:

    In /var/chef/cache/cookbooks/jenkins/recipes/default.rb

    11: package “jenkins” do
    12: action:install
    13: end
    14:

    Compiled Resource:

    Declared in /var/chef/cache/cookbooks/jenkins/recipes/default.rb:11:in `from_file’

    yum_package(“jenkins”) do
    package_name "jenkins"
    action [:install]
    retries 0
    retry_delay 2
    default_guard_interpreter :default
    declared_type :package
    cookbook_name "jenkins"
    recipe_name "default"
    flush_cache {:before=>false, :after=>false}
    end

    Platform:

    x86_64-linux

Running handlers:
[2016-09-12T11:10:47-05:00] ERROR: Running exception handlers
Running handlers complete
[2016-09-12T11:10:47-05:00] ERROR: Exception handlers complete
Chef Client failed. 2 resources updated in 28 seconds
[2016-09-12T11:10:47-05:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
[2016-09-12T11:10:47-05:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2016-09-12T11:10:47-05:00] ERROR: yum_package[jenkins] (jenkins::default line 11) had an error: Chef::Exceptions::package: No candidate version available for jenkins
[2016-09-12T11:10:47-05:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)

default.rb
execute 'yum update -y’
package “jenkins” do
action:install
end

service “jenkins” do
action:start
end

It sounds like it’s unable to find the version you’re trying to install from the repo here: http://pkg.jenkins-ci.org/redhat/

You probably want to switch to using a WAR install instead of package, honestly.

Nathan Clemons
DevOps Engineer
Moxie Cloud Services (MCS)

O +1.425.467.5075
M +1.360.861.6291
E nclemons@gomoxie.com
W www.gomoxie.comhttp://www.gomoxie.com/

thank you so much for responding.i am a beginner.
can you suggest me any books or websites where i can learn how to write recipes by following examples.i am tired with this kind of errors.

So https://learn.chef.io/ has a lot of good info the last time I checked. I believe there are some Chef books out there, but the last time I looked, many of them were outdated. I’m not sure I have any recommendations available to give at this time, the leanpub ebook that helped me the most is both outdated and I think no longer being published. Others might have some better recommendations.

Happy to help as much as I can, this mailing list has helped me incredibly through the years, along with the IRC/Slack channels. I definitely feel your pain, my Jenkins wrapper cookbook is somewhere around 0.1.110 or so (and only got created a few months back, previous job used Bamboo). Depending on your config, it can definitely get complicated fast. (My biggest issues have been around authentication, especially after I enable the LDAP auth plugin, since it seems to disable the local account I’d created, so I had the IT folks make a new service account in AD just so that it will continue to work after the integration.)

thank u so much for u r time. appreciate u for sharing u r experience.

I’ve found these two books to be pretty good:
o Learning Chef (http://shop.oreilly.com/product/0636920032397.do)
o Customizing Chef (http://shop.oreilly.com/product/0636920032984.do)

As the names imply, start with Learning Chef.

Paul

these books sounds interesting.i will start with it.thank you so much.

I am curious, if you have the yum repo setup prior to running this install command.

I am not seeing a version specified, so it leads me to believe you do not have the repo setup or setup correctly.

You can manually run:
yum search jenkins
or yum repolist

The first command will show whether jenkins is available and the second will show how many packages are available in the jenkins repo. (As well as other repos of course.)

I hope that helps.