Bug #431

strange interaction between collecting and the file type 'path' parameter

Added by over 5 years ago. Updated over 5 years ago.

Status:Closed Start date:
Priority:Normal Due date:
Assignee:Luke Kanies % Done:

0%

Category:-
Target version:0.22.1
Affected Puppet version:0.25.4 Branch:
Keywords:
Votes: 0

Description

.pp snippet:

define munin_target ($host, $port)
{
   @@file { "munin_def_${host}_$port":
      path => "${NODESDIR}/$host",
      ensure => present,
      content => $port,
   }
}
define munin_host {
   File <<| |>>
}

This leads to this message on the

munin_host
:

err: Could not create munin_def_smtpscanner.black.co.at_4950: File paths must be fully qualified

After a bit debugging I could trace this to puppet/type/pfile.rb:26:

            validate do |value|
                unless value =~ /^#{File::SEPARATOR}/
                    raise Puppet::Error, "File paths must be fully qualified"
                end
            end

when the unless is executed, value is a array containing exactly the real value I would expect there.

DavidSchmitt

History

Updated by Redmine Admin over 5 years ago

As a workaround I have disabled the validate method of

:path
and added instead

            munge do |value|
                # I don't really know how this is happening.
                if value.is_a?(Array)
                    value = value.shift
                end
                value
            end

which I copied (including the comment!) from

:backup
in the same file.

Regards, DavidSchmitt

Updated by Redmine Admin over 5 years ago

I noticed that exporting files with the path in the namevar instead of using the ‘path’ parameter works as intended.

Hope that helps nailing this one, DavidS

Updated by Luke Kanies over 5 years ago

Hmm. I had this appear in a couple of other parameters, making me think that I did something to the framework that suddenly caused some parameters to get arrays when they used to get single values.

Updated by Luke Kanies over 5 years ago

  • Status changed from 1 to Closed
  • 7 set to fixed

Fixed in r2103. It was a problem with reconstructing objects from the database — an array was always returned.

This doesn’t fix the “real” problem, which is that you can send an array of values to parameters that can’t handle them, but it’s at least functional for most reasonable cases.

Also available in: Atom PDF