Skip to content

service.pp incorrectly references static service name #877

@fnoop

Description

@fnoop

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: n/a
  • Ruby: n/a
  • Distribution: n/a
  • Module version: puppet-collectd (v10.1.0)

How to reproduce (e.g Puppet code you use)

class { "collectd":
        manage_service  => true,
        service_ensure  => $service_ensure,
        service_enable  => $service_enable,
        service_name    => 'maverick-collectd',
    } ->
    service_wrapper { "collectd":
        ensure          => stopped,
        enable          => false,
    }

What are you seeing

Error: Evaluation Error: Error while evaluating a Resource Statement, Evaluation Error: Error while evaluating a Resource Statement, Duplicate declaration: Service[collectd] is already declared at (file: /srv/maverick/software/maverick/manifests/puppet-modules/collectd/manifests/service.pp, line: 7); cannot redeclare (file: /srv/maverick/software/maverick/manifests/init.pp, line: 232) (file: /srv/maverick/software/maverick/manifests/init.pp, line: 232, column: 13) (file: /srv/maverick/software/maverick/manifests/maverick-modules/maverick_analysis/manifests/collect.pp, line: 122) on node maverick-ubuntuvm.lan

What behaviour did you expect instead

Not to have conflicting resource

Any additional information you'd like to impart

As per #688 and #771 , $collectd::service_name should be used instead of Service['collectd']. service.pp controls the service with a static name:
service { 'collectd':
This should be:
service { $collectd::service_name:

PR to follow

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions