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

Duplicate package resource when manage_install is false and package is declared outside of module #776

Open
jmcnatt opened this issue Mar 23, 2023 · 0 comments

Comments

@jmcnatt
Copy link

jmcnatt commented Mar 23, 2023

Scenario

For module users that use resource-style declarations, integration classes become unusable due to the require datadog_agent declaration in each integration class.

Consider the following snippet:

  $package_name = 'datadog-agent'

  # Install the package
  package { $package_name:
    ensure          => present,
    provider        => $package_provider,
    install_options => $install_options,
  }

  # Implement the module
  class { 'datadog_agent':
    dd_user        => $dd_user,
    dd_group       => $dd_group,
    manage_install => false,
    require        => Package[$package_name],
  }

  class { 'datadog_agent::integrations::disk':
    use_mount          => 'no',
    filesystem_exclude => [
      'none',
      'tmpfs',
      'tracefs',
      'squashfs',
    ],
  }

This implementation results in

Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Resource Statement, Evaluation Error: Error while evaluating a Resource Statement, Duplicate declaration: Package[datadog-agent] is already declared at (file: /etc/puppetlabs/code/environments/test/modules/datadog_agent/manifests/init.pp, line: 491); cannot redeclare...

Proposal

The require datadog_agent statement in each module is not necessary, especially given many of the resources already contain statements to require datadog_agent::params::package_name.

Additional Background

My org must implement additional logic to install the datadog-agent package outside of this module, mainly due to limitations of the module (See #742 and #747) and would like to utilize the integration classes as well.

@jmcnatt jmcnatt changed the title require datadog_agent on each integration breaks module functionality Duplicate package resource when manage_install is false and package is declared outside of module Mar 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant