小编JRE*_*EAM的帖子

Ruby/Chef include_recipe 并知道父文件中的变量?

我正在尝试在包含的文件中使用局部变量。我收到未定义的错误。我不确定有什么方法可以做到这一点,是吗?我有一个配方文件夹:

recipes/
    development.rb
    testing.rb
    config.rb
Run Code Online (Sandbox Code Playgroud)

发展.rb

username = "vagrant"
static = []
django = ["project1", "project2"]

include_recipe "server::config"   # <-- Trying to use static and django in there.
Run Code Online (Sandbox Code Playgroud)

配置文件

static.each do |vhost|  #  <-- How do I get the "static" var in here?
    ...
end

django.each do |vhost|  #  <-- How do I get the "django" var in here?
    ...
end
Run Code Online (Sandbox Code Playgroud)

ruby chef chef-solo

0
推荐指数
1
解决办法
1万
查看次数

标签 统计

chef ×1

chef-solo ×1

ruby ×1