-2

I'm trying to use the ohai resource to make node['etc']['passwd'] available. My recipe looks like this:

ohai 'reload etc plugin' do
  plugin 'etc'
  action :reload
end

log "Was etc plugin reloaded? #{node.key?('etc')}"

According to this answer this should work. But:

  * log[Was etc plugin reloaded? false] action write

What am I doing wrong?

This is with

Chef Infra Client: 17.0.242
Ohai: 17.0.42
Sören
  • 1,803
  • 2
  • 16
  • 23
  • Does this answer your question? [How to enable Ohai Plugin to produce \['etc'\]\['passwd'\]?](https://stackoverflow.com/questions/57952305/how-to-enable-ohai-plugin-to-produce-etcpasswd) – Dog9w23 Apr 14 '22 at 17:08
  • @Dog9w23 I've even linked to the answer from that question and demonstrated that it didn't work for me. – Sören Apr 14 '22 at 17:12

1 Answers1

1

the following is noted on Reload Ohai after a new user is created in chef examples

ohai 'reload_passwd' do
  plugin 'etc'
end

and as you probably know, ohai does not load by the default](chef release notes) the Passwd plugin.

combining both with the ohai resource, and since the first snippet did not work for you, maybe the following will do the trick

ohai 'reload_passwd' do
  plugin 'passwd'
end

UPDATE: it seems that the version you specified had many issues. i suggest you will update chef version.

Mr.
  • 9,429
  • 13
  • 58
  • 82
  • Chef::Exceptions::ValidationFailed ---------------------------------- Property plugin must be one of: String! You passed :Passwd. After changing :Passwd to 'passwd': ERROR: Encountered error while running plugins: # – Sören May 29 '21 at 16:10
  • @Sören: i've update the answer with you fix, thanks. also, updating chef version solved many issues. – Mr. May 29 '21 at 17:19