简体   繁体   English

我如何访问节点['etc']['passwd']?

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

I'm trying to use the ohai resource to make node['etc']['passwd'] available.我正在尝试使用ohai资源使node['etc']['passwd']可用。 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以下是在厨师示例中创建新用户后在 Reload Ohai上的注释

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 .您可能知道,ohai 默认不加载](主厨发行说明) Passwd插件

combining both with the ohai resource , and since the first snippet did not work for you, maybe the following will do the trick将两者与ohai 资源相结合,并且由于第一个片段对您不起作用,也许以下内容可以解决问题

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.我建议你更新厨师版本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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