Node Graph: "There are no resources created ..." error message
Describe the Bug
When I selected "Puppet Node Graph" in VS Code on my clone of https://github.com/puppetlabs/puppetlabs-ntp/blob/main/manifests/service.pp, I get this error message:
"There were no resources created in the node graph. Is there an include statement missing?"
Expected Behavior
I expect to see resources being recognized and a node graph of the resources drawn.
Steps to Reproduce
Steps to reproduce the behavior:
- clone of https://github.com/puppetlabs/puppetlabs-ntp/blob/main/manifests/service.pp
- Open VS Code and open the Node Graph
- You will see the error message
- Try another file: I have tried another file : https://github.com/RARYates/ourapp/blob/master/manifests/init.pp and you will get the same error.
Environment
- VS Code 1.54.3
- Platform : Windows 10
- pdk 2.0.0.0
- Ruby 2.5.8
- Puppet 6.17.0
Additional Context
@rajeshr264 The (admittingly minimal) error message is pointing you to the problem. Both of the example files don't include the class you're trying to graph. You will need to add a temporary include <NAME> in the manifest, then run Open Node Graph for it to parse successfully.
@rajeshr264 think about it this way. If you wrote a bash script like this, what would it do when you ran it?
#! /bin/bash
function do_a_thing {
echo "did a thing"
}
It would do nothing, because it just defines a function and never invokes it. Same thing with a Puppet class. Unless you declare it, it doesn't add anything to the catalog.
ah ok. user needs to "instantiate" the class into the catalog. I thought there was an embedded parser inside the puppet-plugin, that creates the graph on the fly.
The error message was not useful as I have other 'include' statements in my example so got confused.
In the README for the Node Graph in VS Code feature, can we add: "The class that needs to be instantiated in the catalog by creating a temporary 'include <NAME>' in the manifest and then running 'Open Node Graph'. "?
ah ok. user needs to "instantiate" the class into the catalog. I thought there was an embedded parser inside the puppet-plugin, that creates the graph on the fly.
The parser absolutely parses the code. But like the bash script I showed, parsing the code results in an empty catalog since you don't do anything with the class that you define.
The manifests in the examples directory are what does something with the class.