简体   繁体   中英

How do i access node['etc']['passwd']?

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM