代码之家  ›  专栏  ›  技术社区  ›  thinkingmonster

这个厨师食谱代码是什么意思

  •  0
  • thinkingmonster  · 技术社区  · 7 年前

    我有一个食谱里面有以下内容。

    execute 'disable-all-yum-repos-centos' do
      command 'yum-config-manager --disable "*"'
      action :run
      only_if { centos? }
    end
    

    现在,这是什么 {世纪?} 意思是,这里是一个被调用的变量吗?或者一些内置函数,如我所知,变量被称为node[variable name]或{node[variable name]}如果在字符串中,上述内容对我来说是新的,请帮助我理解。

    我知道它在检查操作系统是否是centos,但是,这是什么语法?以及如何评估。

    1 回复  |  直到 7 年前
        1
  •  2
  •   Szymon    7 年前

    它是一个包含在块中的函数调用。如果您删除块,厨师将调用系统命令,您可以看到 more examples in the documentation .

    看起来你的代码正在使用 chef-sugar cookbook , centos? 方法已定义 here .

    推荐文章