[chef] Re: CentOS specific version of kernel-devel install question


Chronological Thread 
  • From: Ivan Suftin < >
  • To: < >
  • Subject: [chef] Re: CentOS specific version of kernel-devel install question
  • Date: Mon, 16 Mar 2015 14:35:02 -0500

Thanks, Brandon. That works ;)
__________________________     (╯°□°)╯︵ ┻━┻
 Ivan Suftin - Applications Developer - " class="">
 Office: (608) 821-3825  - Cell : (608) 345-8963
 Center for Integrated Data Analytics - http://cida.usgs.gov/
 United States Geological Survey 
 8505 Research Way, Middleton, WI 53562 

On Mar 16, 2015, at 11:24 AM, Brandon Raabe < " class=""> > wrote:

You can use the following to remove the arch from the string:

ver = '2.6.32-504.el6.x86_64'
=> "2.6.32-504.el6.x86_64"
ver.sub(".#{node['arch']}", '')
=> "2.6.32-504.el6"



On Mon, Mar 16, 2015 at 6:30 AM, Ivan Suftin < " target="_blank" class=""> > wrote:
By the way,

This works:

package "kernel-devel" do
        version "2.6.32-504.el6"
        arch "x86_64"
end

But it is not ideal (for CentOS, anyway). There’s nowhere via ohai to get the version sans architecture. I have to play games with the string: "2.6.32-504.el6.x86_64” in order to separate the two, create variables from them and feed them into the package resource.

Something along the lines of:
ver = "2.6.32-504.el6.x86_64” # coming from “${node[‘os_version’]}"
arch = "”x86_64” # coming from “${node[‘arch’]}
ver = ver[0..ver.rindex(arch) - 2]

(Ruby people, does anyone have a better substringing function for this?)
__________________________     (╯°□°)╯︵ ┻━┻
 Ivan Suftin - Applications Developer - " class="">
 Office: (608) 821-3825  - Cell : (608) 345-8963
 Center for Integrated Data Analytics - http://cida.usgs.gov/
 United States Geological Survey
 8505 Research Way, Middleton, WI 53562

> On Mar 15, 2015, at 9:22 PM, Ivan Suftin < " class=""> > wrote:
>
> Ohai Chefs!
>
> CentOS package_resource question.
>
> In one of my recipes I have:
>
> package "kernel-devel-#{node['os_version']}”
>
> This fails with: ERROR: Converge failed with error message yum_package[kernel-devel-2.6.32-504.el6.x86_64] (chs_sep::install_sep line 22) had an error:
>                    Chef::Exceptions::Package: No candidate version available for kernel-devel-2.6.32-504.el6.x86_64
>
> However, yum info kernel-devel-2.6.32-504.el6.x86_64 shows it to be a valid package (and is already installed):
>
> # yum info kernel-devel-2.6.32-504.el6.x86_64
> Loaded plugins: fastestmirror
> Loading mirror speeds from cached hostfile
> * base: mirror.dattobackup.com
> * extras: mirrors.gigenet.com
> * updates: mirror.team-cymru.org
> Installed Packages
> Name        : kernel-devel
> Arch        : x86_64
> Version     : 2.6.32
> Release     : 504.el6
> Size        : 25 M
> Repo        : installed
> From repo   : base
> Summary     : Development package for building kernel modules to match the kernel
> URL         : http://www.kernel.org/
> License     : GPLv2
> Description : This package provides kernel headers and makefiles sufficient to build modules
>            : against the kernel package.
>
> So what gives??






Archive powered by MHonArc 2.6.16.

§