How to fix Puppet fully-qualified parameter path error?

13,709

Solution 1

[Answering own question after getting around to prodding at the config for a while]

I've managed to track this down to one of the modules which I have written (of course), but it was due to a use of a variable which didn't work out how I expected.

What happened was:

$variable_dir = "/etc/puppet/bar"

class foo {
  file { $variable_dir:
    ensure => directory
  }
}

define some-define() {
   # Trimmed for brevity
   exec { "some-$name":
     # command, creates, timeout etc here
     require => File[$variable_dir],
   }
}

..which basically caused some confusion with the File[] using a variable. I've replaced these with the explicit value of the variable for now and it all works fine, but it was something of a surprise! I'm assuming that my understanding of scope and when variables can be defined/used is somewhat out of whack with Puppet, so I'm going to learn that a lot better...

It seems to have caused the same behaviour as using non-fully-qualified paths on file strings, by failing to find the variable or not obtaining the value? Quite odd, anyway.

Edit : It's quite possible that the variable wasn't found in scope, and so was empty and definitely not a fully-qualified path. Doesn't explain why this was not consistent, however...

Solution 2

When you test your puppet configuration, you can do it by running

puppetd --test

which will give you much more verbose output, and it should show you where it fails. If you are really desperate, you can tack on --debug to get even more output.

If you want to go looking in your .pp files you should search for a

file { "path/to/file":
    ...
}

which has a missing / (i.e. it should read /path/to/file instead)

Share:
13,709

Related videos on Youtube

David Gardner
Author by

David Gardner

Sysadmin, programmer, web developer, compiler developer. Attempted blogger (yet to succeed here).

Updated on September 18, 2022

Comments

  • David Gardner
    David Gardner over 1 year

    I regularly but randomly get the following error message when I run the puppet client on machines (non-daemonized):

    err: Could not create : Parameter path failed: File paths must be fully qualified
    warning: Not using cache on failed catalog
    warning: Configuration could not be instantiated: Parameter path failed: File paths must be fully qualified
    

    It seems moderately clear what it means -- that I don't have a fully-qualified path in a parameter. However, it doesn't tell me where I can find this to fix it, or even which parameter is wrong :(

    (If I use the debug option it consistently works, so it seems like a problem with the caching of the manifests... It would be nice to get rid of this for production use, still)

    Note : I cannot make this happen consistently :/

    • Admin
      Admin about 10 years
      putting $variable_dir = "/etc/puppet/bar" in the site.pp worked for me but putting it in the params.pp and adding require myclass::params in the init.pp did not work.
  • David Gardner
    David Gardner almost 15 years
    Unfortunately I've not ever had it do this when using the --debug switch to see if I can get any more hints out of it... I think I'll have to search through the .pp files and functions for any uses without full paths (although some are built up from chunks so that will be awkward too :)