Bug #2822

Unhelpful error message when an undefined variable is used in a resource title

Added by Alan Barrett about 2 years ago. Updated about 2 years ago.

Status:Closed Start date:11/16/2009
Priority:Normal Due date:
Assignee:Markus Roberts % Done:

0%

Category:error reporting
Target version:0.25.2
Affected Puppet version:0.25.1 Branch:http://github.com/MarkusQ/puppet/tree/ticket/0.25.x/2822
Keywords:
Votes: 0

Description

When a resource is defined using an undefined variable, the error message is unhelpful.

For example:

class myclass {
   $var = "/wherever/somefile"
   file { $wrong_var:
       ensure => file,
   }
}

gives an error message like

err: Could not retrieve catalog from remote server: Could not intern from pson: Could not convert from pson: Could not find relationship target ''

After applying the patch from issue #2770, the error messsage is slightly improved:

err: Could not retrieve catalog from remote server: Could not intern from pson: Could not convert from pson: Could not find relationship target "File[]"

but there’s still no indication of which line in which class in which manifest caused the problem.


Related issues

related to Puppet - Bug #2633: unhelpful error message -- incorrect values for file/recu... Closed 09/14/2009
related to Puppet - Bug #11623: Puppet should give useful debugging information Duplicate 12/29/2011

History

Updated by James Turnbull about 2 years ago

  • Category set to error reporting
  • Status changed from Unreviewed to Accepted
  • Assignee set to Markus Roberts
  • Target version set to 0.25.2

Updated by Thomas Uphill about 2 years ago

The error is not coming from the undefined variable, but rather the undefined file. The variable is undefined which means that the name of the file is undefined. file needs to have a name associated with it. This should be rewritten as:

file {“test file”:

  path => $wrong_var,
  ensure => file,

}

The errors returned should be more descriptive this way.

Updated by Markus Roberts about 2 years ago

When I try either version (Alan’s or Thomas’s) I get a

Parameter path failed: File paths must be fully qualified, not ''

error (which also does not include the file and line number). Likewise, there are other tickets reporting the same issue with other error messages; what we need is a more general solution.

Updated by Markus Roberts about 2 years ago

  • Status changed from Accepted to In Topic Branch Pending Review
  • Branch set to http://github.com/MarkusQ/puppet/tree/ticket/0.25.x/2822

I have a branch up at http://github.com/MarkusQ/puppet/tree/ticket/0.25.x/2822 that adds file and line information to the “Parameter path failed: File paths must be fully qualified, not ‘’” message.

Updated by James Turnbull about 2 years ago

  • Status changed from In Topic Branch Pending Review to Closed

Pushed in commit:53a980537a46117c94ba535bca818d7dc83c4931 in branch 0.25.x

Also available in: Atom PDF