There is a file declaration in the dolls manifest that duplicates itself in some way
Given the confusing error message:
err: Failed to get directory from remote server: Error 400 to SERVER: Duplicate declaration: File [/etc/logstash/conf.d] is already declared in file / var / lib / puppet / envs / SYS _15378 / modules / logstash / manifests /config.pp at line 54; cannot update when / var / lib / puppet / envs / SYS _15378 / modules / logstash / manifests / config.pp: 54 at node foo.bar.com
Questions:
- If this is indeed a duplicate file, how do I debug it (find the file)?
- If not ... what does it actually say?
Note:
- the duplicate declaration is on line 54
- the file it duplicates is defined on ... line 54
- line 54 is the same line as line 54
The line in question is the closing parenthesis:
file { "${logstash::params::config_dir}":
ensure => directory,
owner => root,
group => root,
mode => '0755',
purge => true,
}
Where
class logstash::params {
$config_dir = '/etc/logstash/conf.d'
...
}
source to share
Certain types must not declare shared resources, that is, those that are not derived from instances define
$name
.
In your example, a directory is a resource that many instances of yours require define
. It should move to a class (possibly highlighted).
class logstash::config_dir {
file { "${logstash::params::config_dir}":
ensure => directory,
owner => root,
group => root,
mode => '0755',
purge => true,
}
}
In define
you just
include logstash::config_dir
Including the class multiple times does not create problems and solves exactly this problem (among other things).
source to share