-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Top scope variable are rewritten into fact references #195
Comments
Seems correct to me. What top scope variables are you using? |
The vscode extension assumes that all top scope variables are facts, which is not true. You can have a variable defined in you "entrypoint" manifest that defines a variable to be used globally. I'm not meaning this is the right thing to do (and I would even advise against...), however the current behavior prevents you from doing something that is possible in the language. For example on one setup involving arm devices, I have the following piece of code because of repository naming;
Current VSCode behavior prevents me from referring to this variable, it keeps turning it into a facts, which it is not. Hope this makes sense |
In that case, shouldn't you be referring to it as |
The documentation is here: https://www.puppet.com/docs/puppet/8/lang_scope.html#top-scope Notably: Because the top scope’s name is the empty string, $::my_variable refers to the top-scope value of $my_variable, even if $my_variable has a different value in local scope. Which clearly states that we must be able to access top scope variables. |
OK I see. I don't use top scope variables from a |
Describe the Bug
The PR #190 introduces a bug that prevent reference to top scope variables by rewriting into a reference to a fact
$::example_var => save => $facts['example_var']
Expected Behavior
$::example_var => save => $::example_var
(nothing to change)
Steps to Reproduce
Open VScode and enable Puppet Vscode Extension
Write a manifests referencing a top scope variable.
It is rewritten into a reference to a fact.
Environment
Since Puppet VSCode extension 1.5.0
The text was updated successfully, but these errors were encountered: