Questions tagged [ohai-gem]
41 questions
5
votes
4 answers
chef cookbook fails on ohai undefined method `[]' for nil:NilClass
I'm working on a chef cookbook to set up a vanilla ubuntu 12.04.2 with nginx postgresql and unicorn on my vagrant box, but I'm getting into troubles with nginx, there's an exception
undefined method `[]' for nil:NilClass
when installing it that…

Don Giulio
- 2,946
- 3
- 43
- 82
3
votes
1 answer
Chef bootstrapping on Azure doesn't populate the cloud_v2 attribute
Running Chef's knife bootstrap command successfully populates the cloud_v2 attribute via Ohai when I bootstrap VMs created on Google Cloud and Rackspace, but on Azure VMs bootstraping via knife leaves the cloud_v2 hash very empty -- it only gets…

Eternal Rubyist
- 3,445
- 4
- 34
- 51
3
votes
2 answers
How to handle different ruby version requirements between chef 10.28.0 and ohai 8.0.1
I'm trying to build a server on rackspace using chef 10.28.0, building the exact same configuration that I've built three times before without any changes. The only difference is that chef installed ohai 7.4.0 on the previous runs and this time it…

streetcornerlurker
- 501
- 1
- 7
- 14
3
votes
2 answers
Is this a Chef/ohai bug when dealing with FQDNs?
Let me walk you through my steps.
I have a node with a base RHEL 5.10 OS; the /etc/hosts file is empty
Running the CLI "hostname -f" gives server1-nodex.domain.com, which is correct
I bootstrap the node successfully; when I do a "knife node…

Chris F
- 14,337
- 30
- 94
- 192
2
votes
3 answers
How to enable specific Ohai plugin on a node in Test Kitchen
I wanted to enable Passwd ohai plugin in my node in test kitchen. On a regular node, I've done it by adding:
ohai.optional_plugins = [
:Passwd
]
to /etc/chef/client.rb.
I wanted to achieve the same in a test node, so I added to my…

Learner
- 162
- 11
2
votes
1 answer
Blacklist attributes sent to the Chef server
Due to the fact that i have a large volume of users and groups present on my chef nodes, running chef-client sends all that information to the chef server, causing performance issues.
I can whitelist attributes easily by adding something like this…

georgthebub
- 407
- 6
- 18
1
vote
1 answer
Berks: Unable to satisfy constraints on package , which does not exist,
I have a very small example. 1 cookbook with 1 recipe and 1 ohai plugin file but getting errors running berks/berks install or converging when running kitchen
I do have the ohai gems installed:
chefspec-ohai (0.2.0)
ohai (14.2.0)
the plugin is in…

KingAndrew
- 1,164
- 4
- 21
- 41
1
vote
1 answer
How can Chef detect an AWS ec2 instance type?
I need to have an arbitrary script ran if an instance is run on an ENA enabled ami (eg, c5.2xlarge) A shell command easily enough validates the type:
cat /sys/class/dmi/id/product_name
c5.2xlarge
...but I'm guessing there is something in ohai that…

TyMac
- 783
- 2
- 9
- 32
1
vote
1 answer
Chef shell_out just giving hex values
I'm creating the Chef recipe below. However, my shell_out calls are just returning hex values for the expanded variable. How to get the value of the find command in the variable, and not a junk hex value?
Here is the relevant code snipet from my…

Carl_Friedrich_Gauss
- 173
- 3
- 15
1
vote
1 answer
Setting and Accessing Custom Ohai attributes in Chef
I set a list of attributes to ohai as follows.
Ohai.plugin(:mycustom) do
provides "mycustom"
collect_data do
configs = ["sss=fdf", "tryet=werw"]
Ohai::Log.info("Adding #{configs.length} ohai…

chamilad
- 1,619
- 3
- 23
- 40
1
vote
2 answers
How to use ohai gem
In the OpsCode Wiki there is there following documentation:
require 'ohai'
# ...
# Profit! ;-)
How can I print the JSON data provided by the 'ohai' command but using IRB? I tried to see the code in application.rb but I get empty data.
require…

rtacconi
- 14,317
- 20
- 66
- 84
0
votes
0 answers
ohai sub-attribute plugin load confusion
(chef 14.15.6 since 15 has the trapdoor license and I haven't moved to cinc)
I have the following ohai module. It's my first, so don't expect it's perfect:
# cookbooks/satellite/ohai/default.rb
Ohai.plugin(:Satellite) do
provides 'satellite'
…

user2066657
- 444
- 1
- 4
- 23
0
votes
1 answer
chef ohai does not fetch any os attributes
I am running command ohai -l debug on Windows server 2016 which should output server attributes.
On one VM it returns empty arrays on most important attributes:
"kernel": {
},
"memory": {
"swap": {
}
},
"network": {
"interfaces": {
…

whyte624
- 312
- 1
- 15
0
votes
1 answer
order of cookbooks in run-list using a custom ohai plugin
I have a wapper cookbook that contains a custom ohai plugin. This plugin is used in my second cookbook. Is my config.rb file correct?
cookbook_path [
'/home/user/.chef/cookbooks', #<< ohai cookbook
'/home/user/cookbooks' #<<…

user5580578
- 1,134
- 1
- 12
- 28
0
votes
1 answer
How to specify a directory for custom ohai plugins?
The ohai-example helps a lot to package a ohai plugin
in a cookbook. In my default recipe I use
ohai_plugin 'ohai-example'
After a chef.run the custom ohai plugin is placed at
/home/user/cookbooks/ohai/plugins/ohai-example.rb
I use the…

user5580578
- 1,134
- 1
- 12
- 28