Задний план
я бы хотел применить этот идея иметь common
класс, который включает всю конкретную информацию о моей настройке.
Итак, я создал /etc/puppet/modules/common/manifests/init.pp
с участием
class common { include common::data }
class common::data { $ntpServerList = [ 'ntp51.ex.com','ntp3.ex.com' ] }
и установлен этот ntp и создали такой узел
node testip {
include myconfig::ntpp
}
Проблема
/etc/puppet/modules/myconfig/manifests/init.pp
содержит
class myconfig::ntpp {
include common
class {'ntp':
server_list => $ntpServerList
# server_list => ['ntp.ex.com'] # this works
}
}
и я ожидал, что $ntpServerList
будет доступно, но это не так. Ошибка
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Failed to parse template ntp/ntp.conf.erb:
Filepath: /usr/lib/ruby/site_ruby/1.8/puppet/parser/templatewrapper.rb
Line: 64
Detail: Could not find value for 'server_list' at /etc/puppet/modules/ntp/templates/ntp.conf.erb:25
at /etc/puppet/modules/ntp/manifests/init.pp:183 on node testip
Вопрос
Кто-нибудь может понять, что не так с моим myconfig::ntpp
класс?
Вам необходимо полностью квалифицировать свои переменные; $common::data::ntpServerList
.
Как бы то ни было, ваш код ищет переменную с именем ntpServerList
в локальном масштабе ($myconfig::ntpp::ntpServerList
), которого не существует, поэтому он возвращается к верхней области видимости ($::ntpServerList
), где его тоже нет.
Видеть Вот Больше подробностей.