# Omnibus 4.0 and Ohai question

**URL:** https://discourse.chef.io/t/omnibus-4-0-and-ohai-question/6554
**Category:** Chef Infra (archive)
**Created:** [April 8, 2015, 7:24pm UTC](https://discourse.chef.io/t/omnibus-4-0-and-ohai-question/6554 "2015-04-08T19:24:02Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Eric\_G\_Wolfe1](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/eric_g_wolfe1/32/90_2.png) [@Eric\_G\_Wolfe1](https://discourse.chef.io/u/Eric_G_Wolfe1)
#### Post date: [April 8, 2015, 7:24pm UTC](https://discourse.chef.io/t/omnibus-4-0-and-ohai-question/6554/1 "2015-04-08T19:24:02Z")

</div>

I am coming back to Omnibus and updating some software definitions  
having not used Omnibus in 6 months.

I used to be able to reference Ohai[‘platform’] but that returns a no  
method error on Omnibus 4.0

Error:

```
config/software/package.rb:20:in `evaluate': undefined method `[]'

```

for Ohai:Module (NoMethodError)

Line causing error:

```
version_name_string =

```

“#{Ohai[‘platform’]}-#{Ohai[‘platform\_version’]}-#{Ohai[‘kernel’][‘machine’]}-#{version\_string}”

So what do I need to do to reference Ohai data in an Omnibus 4.0  
software definition?

I do know in some cases there are chef-sugar helpers like `windows?`  
that can be used to switch on platform conditions. I couldn’t find  
relevant documentation, and if someone could point me at an example it  
would be kindly appreciated.

–  
Eric G. Wolfe  
email: [eric.wolfe@cyclecomputing.com](mailto:eric.wolfe@cyclecomputing.com)  
cell: 304.942.3970  
twitter: @atomic\_penguin

Cycle Computing  
Better Answers. Faster.

> **[Cycle Computing Cloud Solutions | Better Answers. Faster](https://cyclecomputing.com/)**
>
> Cycle Computing makes computation in the cloud productive at any scale, orchestrating workflows, managing data, and balancing cloud providers.

  
twitter: @cyclecomputing

---

<div class="post-metadata">

### Author: ![Christopher\_Hahn](https://avatars.discourse-cdn.com/v4/letter/c/71e660/32.png) [@Christopher\_Hahn](https://discourse.chef.io/u/Christopher_Hahn)
#### Post date: [April 18, 2015, 11:08pm UTC](https://discourse.chef.io/t/omnibus-4-0-and-ohai-question/6554/2 "2015-04-18T23:08:30Z")

</div>

Hello,

While I try to figure out how to get node to at least temporarily log it’s errors,  
I am hoping that there is a common issue with launching node instances  
from Chef.

The recipe is simple:

The script has eight lines, all just like this:

# [run.sh](http://run.sh):

# node script1.js & node script2.js & node script3.js & node script4.js & node script5.js & node script6.js & node script7.js &

# The entire recipe is:

# execute “execute [run.sh](http://run.sh)” do cwd "/opt/prodname/data" command "./run.sh" action :run end

At first I thought that it might not be running, but checking the process table  
for instances of node (or processes that contain the string “node” ;0) showed that  
the node instances were launched but that they dropped out of memory a few seconds  
late: (every – == one second)

## while (true) do ps -ef | grep node| grep -v grep; echo “–”; sleep 1; done

## –

## – – (at first, they all appeared) root 10983 1 5 20:49 ? 00:00:00 node script1.js root 10984 1 6 20:49 ? 00:00:00 node script2.js root 10985 1 6 20:49 ? 00:00:00 node script3.js root 10986 1 7 20:49 ? 00:00:00 node script4.js root 10987 1 5 20:49 ? 00:00:00 node script5.js root 10988 1 7 20:49 ? 00:00:00 node script6.js root 10989 1 6 20:49 ? 00:00:00 node script7.js

## root 10983 1 16 20:49 ? 00:00:00 node script1.js root 10984 1 16 20:49 ? 00:00:00 node script2.js root 10985 1 18 20:49 ? 00:00:00 node script3.js root 10986 1 18 20:49 ? 00:00:00 node script4.js root 10987 1 16 20:49 ? 00:00:00 node script5.js root 10988 1 17 20:49 ? 00:00:00 node script6.js root 10989 1 16 20:49 ? 00:00:00 node script7.js

## root 10985 1 20 20:49 ? 00:00:00 node script3.js \<—then only 5! root 10986 1 20 20:49 ? 00:00:00 node script4.js root 10987 1 21 20:49 ? 00:00:00 node script5.js root 10988 1 20 20:49 ? 00:00:00 node script6.js root 10989 1 20 20:49 ? 00:00:00 node script7.js

## – \<— at this point they have all terminated

–

I tried adding redirection to the lines in [run.sh](http://run.sh), to ensure that no output was uncultured  
but to no avail. (i.e. adding 2\>&1 \>/tmp/script#out resulted in no output to these logs)

This seems like more of a node question, and if you can confirm that this is the case,  
then I will turn to that, with appreciation.

Thank you for the time!

Christopher

---

<div class="post-metadata">

### Author: ![Christopher\_Hahn](https://avatars.discourse-cdn.com/v4/letter/c/71e660/32.png) [@Christopher\_Hahn](https://discourse.chef.io/u/Christopher_Hahn)
#### Post date: [April 18, 2015, 11:14pm UTC](https://discourse.chef.io/t/omnibus-4-0-and-ohai-question/6554/3 "2015-04-18T23:14:06Z")

</div>

Hello,

All apologies...I used an old message to get the address right, and left the old Subject there.

Take care,

Christopher

On Apr 18, 2015, at 4:08 PM, Christopher Hahn [chahn@cognitivemedicine.com](mailto:chahn@cognitivemedicine.com) wrote:

> Hello,
> 
> While I try to figure out how to get node to at least temporarily log it's errors,  
> I am hoping that there is a common issue with launching node instances  
> from Chef.
> 
> The recipe is simple:
> 
> The script has eight lines, all just like this:
> 
> # run.sh:
> 
> # node script1.js & node script2.js & node script3.js & node script4.js & node script5.js & node script6.js & node script7.js &
> 
> # The entire recipe is:
> 
> # execute "execute run.sh" do cwd "/opt/prodname/data" command "./run.sh" action :run end
> 
> At first I thought that it might not be running, but checking the process table  
> for instances of node (or processes that contain the string "node" ;0) showed that  
> the node instances were launched but that they dropped out of memory a few seconds  
> late: (every -- == one second)
> 
> ## while (true) do ps -ef | grep node| grep -v grep; echo "--"; sleep 1; done
> 
> ## --
> 
> ## -- -- (at first, they all appeared) root 10983 1 5 20:49 ? 00:00:00 node script1.js root 10984 1 6 20:49 ? 00:00:00 node script2.js root 10985 1 6 20:49 ? 00:00:00 node script3.js root 10986 1 7 20:49 ? 00:00:00 node script4.js root 10987 1 5 20:49 ? 00:00:00 node script5.js root 10988 1 7 20:49 ? 00:00:00 node script6.js root 10989 1 6 20:49 ? 00:00:00 node script7.js
> 
> ## root 10983 1 16 20:49 ? 00:00:00 node script1.js root 10984 1 16 20:49 ? 00:00:00 node script2.js root 10985 1 18 20:49 ? 00:00:00 node script3.js root 10986 1 18 20:49 ? 00:00:00 node script4.js root 10987 1 16 20:49 ? 00:00:00 node script5.js root 10988 1 17 20:49 ? 00:00:00 node script6.js root 10989 1 16 20:49 ? 00:00:00 node script7.js
> 
> ## root 10985 1 20 20:49 ? 00:00:00 node script3.js \<---then only 5! root 10986 1 20 20:49 ? 00:00:00 node script4.js root 10987 1 21 20:49 ? 00:00:00 node script5.js root 10988 1 20 20:49 ? 00:00:00 node script6.js root 10989 1 20 20:49 ? 00:00:00 node script7.js
> 
> ## -- \<--- at this point they have all terminated
> 
> --
> 
> I tried adding redirection to the lines in run.sh, to ensure that no output was uncultured  
> but to no avail. (i.e. adding 2\>&1 \>/tmp/script#out resulted in no output to these logs)
> 
> This seems like more of a node question, and if you can confirm that this is the case,  
> then I will turn to that, with appreciation.
> 
> Thank you for the time!
> 
> Christopher

---

<div class="post-metadata">

### Author: ![Christopher\_Hahn](https://avatars.discourse-cdn.com/v4/letter/c/71e660/32.png) [@Christopher\_Hahn](https://discourse.chef.io/u/Christopher_Hahn)
#### Post date: [April 20, 2015, 4:44pm UTC](https://discourse.chef.io/t/omnibus-4-0-and-ohai-question/6554/4 "2015-04-20T16:44:36Z")

</div>

It seems that I fixed my problem by adding "sh -c" to the command and by redirecting  
all output to /dev/null

Take care,

Christopher

On Apr 18, 2015, at 4:14 PM, Christopher Hahn [chahn@cognitivemedicine.com](mailto:chahn@cognitivemedicine.com) wrote:

> Hello,
> 
> All apologies...I used an old message to get the address right, and left the old Subject there.
> 
> Take care,
> 
> Christopher
> 
> On Apr 18, 2015, at 4:08 PM, Christopher Hahn [chahn@cognitivemedicine.com](mailto:chahn@cognitivemedicine.com) wrote:
> 
> > Hello,
> > 
> > While I try to figure out how to get node to at least temporarily log it's errors,  
> > I am hoping that there is a common issue with launching node instances  
> > from Chef.
> > 
> > The recipe is simple:
> > 
> > The script has eight lines, all just like this:
> > 
> > # run.sh:
> > 
> > # node script1.js & node script2.js & node script3.js & node script4.js & node script5.js & node script6.js & node script7.js &
> > 
> > # The entire recipe is:
> > 
> > # execute "execute run.sh" do cwd "/opt/prodname/data" command "./run.sh" action :run end
> > 
> > At first I thought that it might not be running, but checking the process table  
> > for instances of node (or processes that contain the string "node" ;0) showed that  
> > the node instances were launched but that they dropped out of memory a few seconds  
> > late: (every -- == one second)
> > 
> > ## while (true) do ps -ef | grep node| grep -v grep; echo "--"; sleep 1; done
> > 
> > ## --
> > 
> > ## -- -- (at first, they all appeared) root 10983 1 5 20:49 ? 00:00:00 node script1.js root 10984 1 6 20:49 ? 00:00:00 node script2.js root 10985 1 6 20:49 ? 00:00:00 node script3.js root 10986 1 7 20:49 ? 00:00:00 node script4.js root 10987 1 5 20:49 ? 00:00:00 node script5.js root 10988 1 7 20:49 ? 00:00:00 node script6.js root 10989 1 6 20:49 ? 00:00:00 node script7.js
> > 
> > ## root 10983 1 16 20:49 ? 00:00:00 node script1.js root 10984 1 16 20:49 ? 00:00:00 node script2.js root 10985 1 18 20:49 ? 00:00:00 node script3.js root 10986 1 18 20:49 ? 00:00:00 node script4.js root 10987 1 16 20:49 ? 00:00:00 node script5.js root 10988 1 17 20:49 ? 00:00:00 node script6.js root 10989 1 16 20:49 ? 00:00:00 node script7.js
> > 
> > ## root 10985 1 20 20:49 ? 00:00:00 node script3.js \<---then only 5! root 10986 1 20 20:49 ? 00:00:00 node script4.js root 10987 1 21 20:49 ? 00:00:00 node script5.js root 10988 1 20 20:49 ? 00:00:00 node script6.js root 10989 1 20 20:49 ? 00:00:00 node script7.js
> > 
> > ## -- \<--- at this point they have all terminated
> > 
> > --
> > 
> > I tried adding redirection to the lines in run.sh, to ensure that no output was uncultured  
> > but to no avail. (i.e. adding 2\>&1 \>/tmp/script#out resulted in no output to these logs)
> > 
> > This seems like more of a node question, and if you can confirm that this is the case,  
> > then I will turn to that, with appreciation.
> > 
> > Thank you for the time!
> > 
> > Christopher

---

<div class="post-metadata">

### Author: ![Yvonne\_Lam2](https://avatars.discourse-cdn.com/v4/letter/y/439d5e/32.png) [@Yvonne\_Lam2](https://discourse.chef.io/u/Yvonne_Lam2)
#### Post date: [April 8, 2015, 8:00pm UTC](https://discourse.chef.io/t/omnibus-4-0-and-ohai-question/6554/5 "2015-04-08T20:00:48Z")

</div>

Eric,

You can use "ohai['platform']" (with lowercase "o") in your software  
definition:

> <https://github.com/chef/omnibus/blob/main/lib/omnibus/project.rb#L681-692>

> <https://github.com/chef/omnibus-software/blob/main/config/software/ruby.rb#L77>

Yvonne

On Wed, Apr 8, 2015 at 12:24 PM, Eric G. Wolfe [eric.wolfe@gmail.com](mailto:eric.wolfe@gmail.com) wrote:

> I am coming back to Omnibus and updating some software definitions  
> having not used Omnibus in 6 months.
> 
> I used to be able to reference Ohai['platform'] but that returns a no  
> method error on Omnibus 4.0
> 
> Error:
> 
> ```
> config/software/package.rb:20:in `evaluate': undefined method `[]'
> 
> ```
> 
> for Ohai:Module (NoMethodError)
> 
> Line causing error:
> 
> ```
> version_name_string =
> 
> ```
> 
> "#{Ohai['platform']}-#{Ohai['platform\_version']}-#{Ohai['kernel']['machine']}-#{version\_string}"
> 
> So what do I need to do to reference Ohai data in an Omnibus 4.0  
> software definition?
> 
> I do know in some cases there are chef-sugar helpers like `windows?`  
> that can be used to switch on platform conditions. I couldn't find  
> relevant documentation, and if someone could point me at an example it  
> would be kindly appreciated.
> 
> --  
> Eric G. Wolfe  
> email: [eric.wolfe@cyclecomputing.com](mailto:eric.wolfe@cyclecomputing.com)  
> cell: 304.942.3970  
> twitter: @atomic\_penguin
> 
> Cycle Computing  
> Better Answers. Faster.
> 
> [http://www.cyclecomputing.com](http://www.cyclecomputing.com)  
> twitter: @cyclecomputing

---

<div class="post-metadata">

### Author: ![Eric\_G\_Wolfe1](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/eric_g_wolfe1/32/90_2.png) [@Eric\_G\_Wolfe1](https://discourse.chef.io/u/Eric_G_Wolfe1)
#### Post date: [April 8, 2015, 8:11pm UTC](https://discourse.chef.io/t/omnibus-4-0-and-ohai-question/6554/6 "2015-04-08T20:11:32Z")

</div>

Thank you, Yvonne!

Eric G. Wolfe  
email: [eric.wolfe@cyclecomputing.com](mailto:eric.wolfe@cyclecomputing.com)  
cell: 304.942.3970  
twitter: @atomic\_penguin

Cycle Computing  
Better Answers. Faster.

[http://www.cyclecomputing.com](http://www.cyclecomputing.com)  
twitter: @cyclecomputing

On 04/08/2015 04:00 PM, Yvonne Lam wrote:

> Eric,
> 
> You can use "ohai['platform']" (with lowercase "o") in your software  
> definition:
> 
> [https://github.com/chef/omnibus/blob/master/lib/omnibus/project.rb#L681-692](https://github.com/chef/omnibus/blob/master/lib/omnibus/project.rb#L681-692)  
> [https://github.com/chef/omnibus-software/blob/master/config/software/ruby.rb#L77](https://github.com/chef/omnibus-software/blob/master/config/software/ruby.rb#L77)
> 
> Yvonne
> 
> On Wed, Apr 8, 2015 at 12:24 PM, Eric G. Wolfe [eric.wolfe@gmail.com](mailto:eric.wolfe@gmail.com) wrote:
> 
> > I am coming back to Omnibus and updating some software definitions  
> > having not used Omnibus in 6 months.
> > 
> > I used to be able to reference Ohai['platform'] but that returns a no  
> > method error on Omnibus 4.0
> > 
> > Error:
> > 
> > ```
> > config/software/package.rb:20:in `evaluate': undefined method `[]'
> > 
> > ```
> > 
> > for Ohai:Module (NoMethodError)
> > 
> > Line causing error:
> > 
> > ```
> > version_name_string =
> > 
> > ```
> > 
> > "#{Ohai['platform']}-#{Ohai['platform\_version']}-#{Ohai['kernel']['machine']}-#{version\_string}"
> > 
> > So what do I need to do to reference Ohai data in an Omnibus 4.0  
> > software definition?
> > 
> > I do know in some cases there are chef-sugar helpers like `windows?`  
> > that can be used to switch on platform conditions. I couldn't find  
> > relevant documentation, and if someone could point me at an example it  
> > would be kindly appreciated.
> > 
> > --  
> > Eric G. Wolfe  
> > email: [eric.wolfe@cyclecomputing.com](mailto:eric.wolfe@cyclecomputing.com)  
> > cell: 304.942.3970  
> > twitter: @atomic\_penguin
> > 
> > Cycle Computing  
> > Better Answers. Faster.
> > 
> > [http://www.cyclecomputing.com](http://www.cyclecomputing.com)  
> > twitter: @cyclecomputing
