Skip to content

Instantly share code, notes, and snippets.

@runejuhl
Created March 30, 2020 21:14
Show Gist options
  • Save runejuhl/1c70f756f03b405a3337d2b22d1b14e9 to your computer and use it in GitHub Desktop.
Save runejuhl/1c70f756f03b405a3337d2b22d1b14e9 to your computer and use it in GitHub Desktop.
function test() {
$a = notify { "hi it's me": }
{asd => 42,}
}
$b = test()
# Error: Could not parse for environment production: Expression is not valid as a resource, resource-default, or resource-override (file: /tmp/function_bug.pp, line: 2, column: 8) on node managua.lan
@runejuhl
Copy link
Author

Just as weird:

function test() {
  $b = 84

  {
    asd  => 42,
    text => $b,
  }
}

$b = test()
notify { "it's a bug! ${b}":}
# Error: Could not parse for environment production: Expression is not valid as a resource, resource-default, or resource-override (file: /tmp/function_bug.pp, line: 2, column: 8) on node managua.lan

@runejuhl
Copy link
Author

runejuhl commented Mar 30, 2020

Even worse!

With underscore:

function test() {
  $a = 84

  {
    asd  => 42,
    _text => $a,
  }
}
$b = test()
# Error: Could not parse for environment production: Syntax error at '_text' (file: /tmp/function_bug.pp, line: 6, column: 5) on node managua.lan

Without underscore:

function test() {
  $a = 84

  {
    asd  => 42,
    text => $a,
  }
}
$b = test()
# Error: Could not parse for environment production: Expression is not valid as a resource, resource-default, or resource-override (file: /tmp/function_bug.pp, line: 2, column: 8) on node managua.lan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment