octocalog-diff seems to resolve scope differently from puppet #145
Comments
|
his actually looks to me like maybe you're encountering a bug with Puppet 3.x that happens to be working the way you want. Unless From the 3.8 docs (link):
Fully qualifying your variables with the scope is probably the best idea here, definitely for forward compatibility. |
|
@markdanko I don't think octocatalog-diff resolves anything other than "puppet" - as it calls puppet to compile. There were bugs in Puppet 3 which allowed to resolve variables that actually shouldn't be available. Anyway I would recommend you to use the new EPP instead of the (deprecated and not well specified) ERB. https://puppet.com/docs/puppet/5.5/lang_template_epp.html (Available since Puppet 4) |
in puppet I have module (foo) which calls a template in another module (bar)
a var declared in module bar is not accessible to the template with @ in octocalog-diff but in puppet it is accessible.
in puppet this works fine but in octocatalog-diff
"cluster_name" : "<%= @cluster_name.downcase %>",
If I change it to scope['bar::cluster_name'].downcase it works in octocalog-diff
I have a module
foo:
which has:
define service_definition (
$service = $title,
$template = "${service}/${service}.json.erb",
$enabled = true,
$watch_config = '',
) {
$service_def_path = "/etc/somepath/servicedefs/${service}.json"
if $enabled and ($::foo::version != 'absent') {
file { $service_def_path:
ensure => present,
content => inline_template($template),
}
In puppet when I give it service bar it works fine,
but in your tool I get:
Error: Failed to compile catalog for node bas Evaluation Error: Error while evaluating a Resource Statement, Evaluation Error: Error while evaluating a Function Call, Failed to parse template bar/bar.json.erb:
Filepath: /var/folders/sp/r687p5j51y106yn0gb4vynwm0000gn/T/d20170811-19384-1ldupto/environments/production/modules/ibar/templates/bar.json.erb
Line: 7
Detail: undefined method `downcase' for nil:NilClass
at /var/folders/sp/r687p5j51y106yn0gb4vynwm0000gn/T/d20170811-19384-1ldupto/environments/production/modules/foo/manifests/init.pp:77:18 at /var/folders/sp/r687p5j51y106yn0gb4vynwm0000gn/T/d20170811-19384-1ldupto/environments/production/modules/bar/manifests/init.pp:59 on node bas
Line: 7 is
"cluster_name" : "<%= @cluster_name.downcase %>",
If I change it to scope['bar::cluster_name'].downcase it works fine for octocatalog--diff.
What happened?
octocalog-diff did not work like puppet
What did you expect to happen?
octocalog-diff should work like puppet
any time one module calls another modules, template, and that template uses vars define in the second module
mac 10.12.5 (16F73) for octocatalog-diff
16.6.0 Darwin puppet master
Your Ruby version: <!-- type
ruby --versionat the command prompt -->ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-darwin16] ( on octocatalog-diff host
Your version of Puppet:
puppet --version
3.8.6
ruby --version
ruby 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux ( on puppet master)
Your version of octocatalog-diff: <!-- type
octocatalog-diff --version-->yes
The text was updated successfully, but these errors were encountered: