Bug #2822

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

Added by Alan Barrett 9 months ago. Updated 8 months ago.

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

0%

Category:error reporting
Target version:0.25.2
Affected 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

History

Updated by James Turnbull 8 months ago

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

Updated by Thomas Uphill 8 months 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 8 months 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 8 months ago

  • Status changed from Accepted to Ready for Testing
  • 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 8 months ago

  • Status changed from Ready for Testing to Closed

Pushed in commit:“53a980537a46117c94ba535bca818d7dc83c4931” in branch 0.25.x

Also available in: Atom PDF