github / github/octocatalog-diff

octocalog-diff seems to resolve scope differently from puppet

Offen
#145 2 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Operational
Vorherrschende Sprache
Ruby
Sterne
252
Forks
95
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

> Description of problem
tl;dr
puppet and octocatalog diff don't read things the same way.

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

- What did you do?
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),
content => template($template),
owner => 'root',
group => 'root',
mode => '0644',
require => Package['foo'],
}

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
- How can someone reproduce the problem?
any time one module calls another modules, template, and that template uses vars define in the second module
> Command used and debugging output
If you feel this will help I will add it.

> Platform and version information

- Your OS:
mac 10.12.5 (16F73) for octocatalog-diff

16.6.0 Darwin puppet master
- Your Ruby version:
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:

> Do the tests pass from a clean checkout?

yes
> Anything else to add that you think will be helpful?
is this expected/etc ?

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Beginne damit, den foo/bar-Modulfall mit bar/bar.json.erb und dem im Issue gezeigten Template-Aufruf zu reproduzieren, und untersuche dann, wie der Template-Scope gehandhabt wird, wenn octocatalog-diff den Katalog kompiliert. Vergleiche das Ergebnis mit Puppet unter Verwendung von @cluster_name; als erledigt gilt es, wenn dieselbe Template-Variable aufgelöst wird, ohne scope['bar::cluster_name'] zu benötigen.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
ruby
Bereich
tooling
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.