Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

service.pp incorrectly references static service name #877

Open
fnoop opened this issue Apr 25, 2019 · 1 comment
Open

service.pp incorrectly references static service name #877

fnoop opened this issue Apr 25, 2019 · 1 comment
Labels
bug Something isn't working

Comments

@fnoop
Copy link

fnoop commented Apr 25, 2019

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

@juniorsysadmin juniorsysadmin added the bug Something isn't working label Apr 30, 2019
@fnoop
Copy link
Author

fnoop commented Aug 7, 2021

This still isn't fixed, it's because manifests/service.pp references:
service { 'collectd':

This then doesn't allow us to reference Service['collectd'] elsewhere:

Error: Evaluation Error: Error while evaluating a Resource Statement, Cannot alias Service[system-collectd] to ["collectd"] at (file: /srv/maverick/software/maverick/manifests/maverick-modules/maverick_analysis/manifests/collect.pp, line: 140); resource ["Service", "collectd"] already declared (file: /srv/maverick/software/maverick/manifests/puppet-modules/collectd/manifests/service.pp, line: 6) (file: /srv/maverick/software/maverick/manifests/maverick-modules/maverick_analysis/manifests/collect.pp, line: 140, column: 5) on node mvrk.org

If the code was changed to something like: service { 'managed_collectd':, then it wouldn't clash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants