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

Possible incorrect use of exported resource #44

Open
nick-fox opened this issue Apr 16, 2020 · 9 comments
Open

Possible incorrect use of exported resource #44

nick-fox opened this issue Apr 16, 2020 · 9 comments

Comments

@nick-fox
Copy link
Contributor

nick-fox commented Apr 16, 2020

An exported resource is causing duplicate resource.

Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: A duplicate resource was found while collecting exported resources, with the type and title Metricbeat::Modulesd[system]

An exported resource declaration specifies a desired state for a resource, and publishes the resource for use by other nodes. It does not manage the resource on the target system. Any node, including the node that exports it, can collect the exported resource and manage its own copy of it.
See

# Create modules.d files that exist in hiera then collect any created via exported resources
$module_templates_real = hiera_array('metricbeat::module_templates', $metricbeat::module_templates)
$module_templates_real.each |$module| {
@@metricbeat::modulesd { $module: }
}
Metricbeat::Modulesd <<||>>

I think you should be using create_resources
Converts a hash into a set of resources and adds them to the catalog.
See

@efoft
Copy link
Contributor

efoft commented May 3, 2020

Agree, I hit the same issue. If more than one node applies this manifest within the same puppetserver.

@braddeicide
Copy link

+1

@rogermartensson
Copy link

Is this fix planned to be included in a future version?
I noticed that the PR is failing.

@smoeding
Copy link

smoeding commented Nov 9, 2020

It's probably sufficient to turn the double @@ into a single @ here.

As already mentioned the double @@ creates exported resources that can be picked up by other nodes. I don't see any use for node2 to create a metricbeat config entry that node1 created.

Using a single @ will create virtual resources. These virtual resources must be collected (done here using <||>) to be realized. Now this could actually make sense here. A profile or role class could create virtual resources for items managed by the profile or role. These virtual resources would be ignored on servers that do not also include metricbeat. But if metricbeat is included then these resources would also be realized and added to the metricbeat config.

Obviously removing the @@ would directly create the resources and the collection would not be needed.

skrussell added a commit to skrussell/puppet-metricbeat that referenced this issue Feb 25, 2021
skrussell added a commit to skrussell/puppet-metricbeat that referenced this issue Feb 25, 2021
@couloum
Copy link

couloum commented Mar 2, 2021

Hi,

I had the same issue while trying to use this module on multiple nodes. I applied @smoeding fix and it worked like a charm.

Is the fix planned for a future release?

Thanks

@cdenneen
Copy link
Contributor

@corey-hammerton this is a pretty big issue. Any solution for fixing this?

@cdenneen
Copy link
Contributor

#59 added with @smoeding suggestion

@cdenneen
Copy link
Contributor

@corey-hammerton Either suggestion is fine #48 or @smoeding that I did in #59 (it doesn't collect and realize those virtual resources so this would be done outside this class)

@corey-hammerton
Copy link
Owner

I merged #59 but am unable to verify the fix. Travis CI integration is now broken, this was unverified because this project is not under active development.

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

8 participants