Disamiguate Profiles::Logstash and Logstash

48 views
Skip to first unread message

Brian Wilkins

unread,
May 31, 2014, 8:17:34 AM5/31/14
to puppet...@googlegroups.com
I am using the puppet logstash module from Forge installed at /etc/puppet/modules/logstash

I am trying to setup my profile class as profiles::logstash. My manifest is at /etc/puppet/modules/profiles/manifests/logstash.pp

In my /etc/puppet/modules/profiles/manifests/logstash directory I have:

install.pp
config.pp
service.pp

In my install.pp:

class profiles::logstash::install() {
  $ensure = $profiles::logstash::enable ? {true => present, default => absent}

  class { 'logstash':
    ensure  => $ensure,
    version => $profiles::logstash::version
  }
}

Here, class refers to the /etc/puppet/modules/logstash  not /etc/puppet/modules/profiles/manifests/logstash

However, when I do a run, it tells me

Could not retrieve catalog from remote server: Error 400 on SERVER: Duplicate declaration: Class[Profiles::Logstash] is already declared; cannot redeclare at /etc/puppet/modules/profiles/manifests/logstash/install.pp:8

It is referring to the "class {'logstash'" line.

What's the proper way to disambiguate so I can still tell the puppet logstash module to install logstash and ensure the right version?

Brian Wilkins

unread,
May 31, 2014, 8:19:50 AM5/31/14
to puppet...@googlegroups.com
Here is my logstash.pp at /etc/puppet/modules/profiles/manifests/logstash.pp:

class profiles::logstash(
   $version = "1.4.1-1_bd507eb",
   $enable  = true,
   $start   = true
) {
   class{'profiles::logstash::install': } ->
   class{'profiles::logstash::config': } ~>
   class{'profiles::logstash::service': } ->
   Class["profiles::logstash"]

Robin Bowes

unread,
May 31, 2014, 8:26:54 AM5/31/14
to puppet...@googlegroups.com

Fully-qualify the class name, ie. use '::logstash'.

R.

--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/137a4a4d-46f9-4e1f-841a-cda87c7e8229%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Brian Wilkins

unread,
May 31, 2014, 8:29:41 AM5/31/14
to puppet...@googlegroups.com
Thanks! That worked. I am still learning. I have an additional error. Is there a way around this or just combine my service.pp and install.pp together?

Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Duplicate declaration: Class[Logstash] is already declared in file /etc/puppet/modules/profiles/manifests/logstash/install.pp:8; cannot redeclare at /etc/puppet/modules/profiles/manifests/logstash/service.pp:7

This is my service.pp:

class profiles::logstash::service() {
  $status = $profiles::logstash::start ? {true => enabled, default => disabled}

  class { '::logstash':
    status  => $status,
Reply all
Reply to author
Forward
0 new messages