# value\_for\_platform wildcard?

**URL:** <https://discourse.chef.io/t/value-for-platform-wildcard/6012>\
**Category:** Chef Infra (archive)\
**Created:** [November 6, 2014, 4:39am UTC](https://discourse.chef.io/t/value-for-platform-wildcard/6012 "2014-11-06T04:39:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kkeane](https://avatars.discourse-cdn.com/v4/letter/k/9fc29f/32.png) [@kkeane](https://discourse.chef.io/u/kkeane)\
**Post date:** [November 6, 2014, 4:39am UTC](https://discourse.chef.io/t/value-for-platform-wildcard/6012/1 "2014-11-06T04:39:57Z")

</div>

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](http://www.4nettech.com)

Our values: Privacy, Liberty, Justice

See [https://www.4nettech.com/corp/the-nettech-values.html](https://www.4nettech.com/corp/the-nettech-values.html)

---

<div class="post-metadata">

**Author:** ![jdunn](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/jdunn/32/1800_2.png) [@jdunn](https://discourse.chef.io/u/jdunn)\
**Post date:** [November 6, 2014, 4:59am UTC](https://discourse.chef.io/t/value-for-platform-wildcard/6012/2 "2014-11-06T04:59:23Z")

</div>

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](http://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](mailto: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](http://www.4nettech.com)
> 
> Our values: Privacy, Liberty, Justice
> 
> See [https://www.4nettech.com/corp/the-nettech-values.html](https://www.4nettech.com/corp/the-nettech-values.html)

--  
[Julian C. Dunn [jdunn@aquezada.com](mailto:jdunn@aquezada.com) \* Sorry, I'm ]  
[WWW: [Julian Dunn's Blog - Commentary on media, technology, and everything in between.](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]

---

<div class="post-metadata">

**Author:** ![kkeane](https://avatars.discourse-cdn.com/v4/letter/k/9fc29f/32.png) [@kkeane](https://discourse.chef.io/u/kkeane)\
**Post date:** [November 6, 2014, 7:17am UTC](https://discourse.chef.io/t/value-for-platform-wildcard/6012/3 "2014-11-06T07:17:43Z")

</div>

Thank you! Wonderful news!

Kevin Keane

The NetTech

760-721-8339

[http://www.4nettech.com](http://www.4nettech.com)

Our values: Privacy, Liberty, Justice

See [https://www.4nettech.com/corp/the-nettech-values.html](https://www.4nettech.com/corp/the-nettech-values.html)

-----Original message-----  
From: Julian C. Dunn [jdunn@aquezada.com](mailto:jdunn@aquezada.com)  
Sent: Wednesday 5th November 2014 21:03  
To: [chef@lists.opscode.com](mailto: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](http://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](mailto: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](http://www.4nettech.com)
> 
> Our values: Privacy, Liberty, Justice
> 
> See [https://www.4nettech.com/corp/the-nettech-values.html](https://www.4nettech.com/corp/the-nettech-values.html)

--  
[Julian C. Dunn [jdunn@aquezada.com](mailto:jdunn@aquezada.com) \* Sorry, I'm ]  
[WWW: [Julian Dunn's Blog - Commentary on media, technology, and everything in between.](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]
