value_for_platform wildcard?


#1

Is there a wildcard for the value_for_platform function? Specifically, I’m interested in the version field; rather than specifying the specific CentOS version, I would like to specify “all Centos 7 versions”. Unfortunately, Ohai reports a very specific version number (in my case, 7.0.1406) which means that my code would break as soon as a new build comes out.

What I am trying to accomplish is something like this:

my values = value_for_platform(
%w{ centos redhat } => {
“7.x” =>[ values for Centos 7 ]
“default” => [ values for Centos 5 and 6 ]
},
“default” => { “default” => %w{} }
)

Thanks!

Kevin Keane

The NetTech

http://www.4nettech.com

Our values: Privacy, Liberty, Justice

See https://www.4nettech.com/corp/the-nettech-values.html


#2

That feature will be available in Chef Client 12. You can try the RC
now to see if it works for you.

docs.getchef.com/release/12-0/release_notes.html

===

value_for_platform

The value_for_platform helper may use version constraints, such as >=
and ~> to help resolve situations where version numbers look like
7.0.. For example:

value_for_platform(
“redhat” => {
"~> 7.0" => “version 7.x.y”
">= 8.0" => “version 8.0.0 and greater”
}
}

  • Julian

On Wed, Nov 5, 2014 at 11:39 PM, Kevin Keane Subscription
subscription@kkeane.com wrote:

Is there a wildcard for the value_for_platform function? Specifically, I’m
interested in the version field; rather than specifying the specific CentOS
version, I would like to specify “all Centos 7 versions”. Unfortunately,
Ohai reports a very specific version number (in my case, 7.0.1406) which
means that my code would break as soon as a new build comes out.

What I am trying to accomplish is something like this:

my values = value_for_platform(
%w{ centos redhat } => {
“7.x” =>[ values for Centos 7 ]
“default” => [ values for Centos 5 and 6 ]
},
“default” => { “default” => %w{} }
)

Thanks!

Kevin Keane

The NetTech

http://www.4nettech.com

Our values: Privacy, Liberty, Justice

See https://www.4nettech.com/corp/the-nettech-values.html


[ Julian C. Dunn jdunn@aquezada.com * Sorry, I’m ]
[ WWW: http://www.aquezada.com/staff/julian * only Web 1.0 ]
[ gopher://sdf.org/1/users/keymaker/ * compliant! ]
[ PGP: 91B3 7A9D 683C 7C16 715F 442C 6065 D533 FDC2 05B9 ]


#3

Thank you! Wonderful news!

Kevin Keane

The NetTech

760-721-8339

http://www.4nettech.com

Our values: Privacy, Liberty, Justice

See https://www.4nettech.com/corp/the-nettech-values.html

-----Original message-----
From: Julian C. Dunn jdunn@aquezada.com
Sent: Wednesday 5th November 2014 21:03
To: chef@lists.opscode.com
Subject: [chef] Re: value_for_platform wildcard?

That feature will be available in Chef Client 12. You can try the RC
now to see if it works for you.

docs.getchef.com/release/12-0/release_notes.html

===

value_for_platform

The value_for_platform helper may use version constraints, such as >=
and ˜> to help resolve situations where version numbers look like
7.0.. For example:

value_for_platform(
“redhat” => {
“˜> 7.0” => “version 7.x.y”
">= 8.0" => “version 8.0.0 and greater”
}
}

  • Julian

On Wed, Nov 5, 2014 at 11:39 PM, Kevin Keane Subscription
subscription@kkeane.com wrote:

Is there a wildcard for the value_for_platform function? Specifically, I’m
interested in the version field; rather than specifying the specific CentOS
version, I would like to specify “all Centos 7 versions”. Unfortunately,
Ohai reports a very specific version number (in my case, 7.0.1406) which
means that my code would break as soon as a new build comes out.

What I am trying to accomplish is something like this:

my values = value_for_platform(
%w{ centos redhat } => {
“7.x” =>[ values for Centos 7 ]
“default” => [ values for Centos 5 and 6 ]
},
“default” => { “default” => %w{} }
)

Thanks!

Kevin Keane

The NetTech

http://www.4nettech.com

Our values: Privacy, Liberty, Justice

See https://www.4nettech.com/corp/the-nettech-values.html


[ Julian C. Dunn jdunn@aquezada.com * Sorry, I’m ]
[ WWW: http://www.aquezada.com/staff/julian * only Web 1.0 ]
[ gopher://sdf.org/1/users/keymaker/ * compliant! ]
[ PGP: 91B3 7A9D 683C 7C16 715F 442C 6065 D533 FDC2 05B9 ]