puppetlabs / puppet-vscode

Puppet Editing. Redefined.
https://puppet-vscode.github.io
Apache License 2.0
81 stars 40 forks source link

Puppet Debugger Issue #204

Closed dotanspector closed 6 years ago

dotanspector commented 6 years ago

What Versions are you running?

OS Version: Mac OSX Sierra VSCode Version: 1.18.1 Puppet Extension Version: 0.8.0 Puppet Agent Version: 4.10.1 PDK Version (if applicable):1.2.1

What You Are Seeing?

Im Trying to run the debugger and encounter this message: "Err: Evaluation Error: Error while evaluating an Object, undefined method `file' for Puppet::Pops::Model::HostClassDefinition:Puppet::Pops::Model::HostClassDefinition on node

puppet exited with 1" ### What is Expected? successful run ### How Did You Get This To Happen? (Steps to Reproduce) debugger configuration: "configurations": [ { "type": "Puppet", "request": "launch", "name": "Puppet Apply current file", "manifest": "${file}", "args": [], "noop": true, "cwd": "${file}" } ] } ### Output Log
glennsarti commented 6 years ago

@dotanspector Hi. Thanks for the bug report. Are you able to copy the manifest which caused the issue?

And could you also add '--trace' to the debugger configuration so;

"args": ["--trace"],

That should give much more output when it fails.

Thanks.

dotanspector commented 6 years ago

Hi @glennsarti , Thanks in advance for your support This is the manifest (dummy manifest)

# dotantest
#
# A description of what this class does
#
# @summary A short summary of the purpose of this class
#
# @example
#   include dotantest
class dotantest {
  user { 'title':
    ensure => 'present'
  }

}

Debugger output

**************************************************
* The Puppet debugger is an experimental feature *
* Debug Server v0.0.1                            *
**************************************************
puppet apply /Users/dotan.spector/<path_to_manifest>/dotantest/manifests/init.pp --detailed-exitcodes --logdest debugserver --noop --trace
Warning: Facter: effective gid 1371015622 does not have a group entry.
Err: Evaluation Error: Error while evaluating an Object, undefined method `file' for Puppet::Pops::Model::HostClassDefinition:Puppet::Pops::Model::HostClassDefinition on node dspector-mc.local
/Users/dotan.spector/.vscode/extensions/jpogran.puppet-vscode-0.8.0/vendor/languageserver/lib/puppet-debugserver/debug_hook_handlers.rb:31:in `hook_before_pops_evaluate'
/Users/dotan.spector/.vscode/extensions/jpogran.puppet-vscode-0.8.0/vendor/languageserver/lib/puppet-debugserver/debug_hook_handlers.rb:17:in `block in hooks'
/Users/dotan.spector/.vscode/extensions/jpogran.puppet-vscode-0.8.0/vendor/languageserver/lib/puppet-debugserver/hooks.rb:119:in `call'
/Users/dotan.spector/.vscode/extensions/jpogran.puppet-vscode-0.8.0/vendor/languageserver/lib/puppet-debugserver/hooks.rb:119:in `block in exec_hook'
/Users/dotan.spector/.vscode/extensions/jpogran.puppet-vscode-0.8.0/vendor/languageserver/lib/puppet-debugserver/hooks.rb:117:in `map'
/Users/dotan.spector/.vscode/extensions/jpogran.puppet-vscode-0.8.0/vendor/languageserver/lib/puppet-debugserver/hooks.rb:117:in `exec_hook'
/Users/dotan.spector/.vscode/extensions/jpogran.puppet-vscode-0.8.0/vendor/languageserver/lib/puppet-debugserver/puppet_monkey_patches.rb:86:in `evaluate'
/Users/dotan.spector/<path_to_manifest>/dotantest/manifests/init.pp:in `stack'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/puppet_stack.rb:30:in `eval'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/puppet_stack.rb:30:in `stack'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/evaluator/evaluator_impl.rb:715:in `eval_Program'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/visitor.rb:48:in `block in visit_this'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/visitor.rb:42:in `each'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/visitor.rb:42:in `visit_this'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/visitor.rb:71:in `visit_this_1'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/evaluator/evaluator_impl.rb:82:in `evaluate'
/Users/dotan.spector/.vscode/extensions/jpogran.puppet-vscode-0.8.0/vendor/languageserver/lib/puppet-debugserver/puppet_monkey_patches.rb:88:in `evaluate'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/parser/evaluating_parser.rb:63:in `evaluate'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/parser/ast/pops_bridge.rb:132:in `evaluate'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/parser/ast.rb:31:in `safeevaluate'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/resource/type.rb:184:in `evaluate_code'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/parser/resource.rb:81:in `block in evaluate'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/profiler/around_profiler.rb:58:in `profile'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/profiler.rb:51:in `profile'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/parser/resource.rb:73:in `evaluate'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/parser/compiler.rb:635:in `evaluate_main'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/parser/compiler.rb:174:in `block (2 levels) in compile'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/profiler/around_profiler.rb:58:in `profile'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/profiler.rb:51:in `profile'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/parser/compiler.rb:174:in `block in compile'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/context.rb:65:in `override'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet.rb:294:in `override'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/parser/compiler.rb:162:in `compile'
/Users/dotan.spector/.vscode/extensions/jpogran.puppet-vscode-0.8.0/vendor/languageserver/lib/puppet-debugserver/puppet_monkey_patches.rb:39:in `compile'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/indirector/catalog/compiler.rb:268:in `block (2 levels) in compile'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/profiler/around_profiler.rb:58:in `profile'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/profiler.rb:51:in `profile'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/indirector/catalog/compiler.rb:266:in `block in compile'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util.rb:224:in `block in benchmark'
/opt/puppetlabs/puppet/lib/ruby/2.1.0/benchmark.rb:294:in `realtime'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util.rb:223:in `benchmark'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/indirector/catalog/compiler.rb:264:in `compile'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/indirector/catalog/compiler.rb:55:in `find'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/indirector/indirection.rb:194:in `find'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application/apply.rb:256:in `block in main'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/context.rb:65:in `override'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet.rb:294:in `override'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application/apply.rb:225:in `main'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application/apply.rb:170:in `run_command'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application.rb:358:in `block in run'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util.rb:542:in `exit_on_fail'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application.rb:358:in `run'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/command_line.rb:132:in `run'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/command_line.rb:72:in `execute'
/Users/dotan.spector/.vscode/extensions/jpogran.puppet-vscode-0.8.0/vendor/languageserver/lib/puppet-debugserver/puppet_debug_session.rb:429:in `start_puppet'
/Users/dotan.spector/.vscode/extensions/jpogran.puppet-vscode-0.8.0/vendor/languageserver/lib/puppet-debugserver/puppet_debug_session.rb:182:in `block in start'
puppet exited with 1
glennsarti commented 6 years ago

Huh interesting. Not where I thought it was failing. This is great information and I should be able to fix this. Thanks again.

glennsarti commented 6 years ago

@dotanspector Found the problem. The parsing used in Puppet has changed dramatically between 4.x and 5.x. This can definitely be fixed! thanks again.

glennsarti commented 6 years ago

Fix PR is up #205

dotanspector commented 6 years ago

Hi @glennsarti , Thank you very much for your help and support. waiting for the merge of this fix.

glennsarti commented 6 years ago

Merged. Will be released in the next release