When you run the agent or apply code, you get the following error:Error: Evaluation Error: Empty string title at 0\. Title strings must have a length greater than zero.
Version and installation information
Puppet version: 5.0, 6.0
Installation type: All
You get an error message similar to:
Warning: Unknown variable: 'servicename'. (file: /mypath/myclass.pp, line: 2, column: 12)
Error: Evaluation Error: Empty string title at 0\. Title strings must have a length greater than
zero. (file: /mypath/myclass.pp, line: 2, column: 11) on node puppet.example.com
Solution
If you have code with a typo in a variable name similar to this:
$service_name = "httpd"
service { "$servicename":
ensure => running
}
When you do a puppet apply
or a puppet agent -t
with the code in the catalog, you may get a Warning: Unknown variable
error.
In earlier versions of Puppet, errors for this type of issue were difficult to troubleshoot. However, the error message here tells you that servicename
is an unknown variable and gives you locations to check: myclass.pp
line: 2, column: 11
and line: 2, column: 12
. When you look at the variable name at those locations and check it against the variable declaration, there is a mismatch.
Make sure that your variable names match when defining and declaring the variable. If the names match, and you’re still getting an error, make sure that the variable is defined and being used within the same scope.
Comments
0 comments
Please sign in to leave a comment.