bstopp / puppet-aem

Puppet module for managing AEM Installations.
https://forge.puppet.com/bstopp/aem
Apache License 2.0
30 stars 30 forks source link

Unable to manage replication agents with the same name - I.e. author flush & publish flush #91

Closed henrykuijpers closed 7 years ago

henrykuijpers commented 7 years ago

I'm trying to manage the replication agents; I.e. the flush agent for runmode author and the flush agent for publish. I'm managing them for 2 instances that are running on the machine.

When trying to remove the OOTB replication configurations: notice("AEM instance: ${aem_instance['name']}")

Remove the OOTB replication agents

  $aem_conf['ootb_replication_agents'].each | $agent | {
    notice("- Replication agent: ${agent['runmode']} - ${agent['name']} on ${aem_instance['home']}")
    aem::agent::replication { "${aem_instance['name']} Remove ${agent['runmode']} agent ${agent['name']}" :
      ensure => 'absent',
      runmode => $agent['runmode'],
      name => $agent['name'],
      home => $aem_instance['home']
    }
  }

I get the following output: Notice: Scope(Class[X::Server::Installation]): AEM instance: local-author Notice: Scope(Class[X::Server::Installation]): - Replication agent: author - publish on /data/aem/author Debug: importing '/vagrant/X/modules/X/manifests/server/installation/aem.pp' in environment production Debug: importing '/etc/puppet/modules/aem/manifests/init.pp' in environment production Debug: importing '/etc/puppet/modules/aem/manifests/agent/replication.pp' in environment production Debug: Automatically imported aem::agent::replication from aem/agent/replication into production Notice: Scope(Class[X::Server::Installation]): - Replication agent: author - flush on /data/aem/author Notice: Scope(Class[X::Server::Installation]): - Replication agent: author - publish_reverse on /data/aem/author Notice: Scope(Class[X::Server::Installation]): - Replication agent: author - static on /data/aem/author Notice: Scope(Class[X::Server::Installation]): - Replication agent: author - test_and_target on /data/aem/author Notice: Scope(Class[X::Server::Installation]): - Replication agent: author - youtube on /data/aem/author Notice: Scope(Class[X::Server::Installation]): - Replication agent: author - dynamic_media_replication on /data/aem/author Notice: Scope(Class[X::Server::Installation]): - Replication agent: author - s7delivery on /data/aem/author Notice: Scope(Class[X::Server::Installation]): - Replication agent: publish - flush on /data/aem/author Error: Evaluation Error: Error while evaluating a Resource Statement, Cannot alias Aem::Agent::Replication[local-author Remove publish agent flush] to ["flush"] at /vagrant/X/modules/X/manifests/server/installation.pp:34; resource ["Aem::Agent::Replication", "flush"] already declared at /vagrant/X/modules/X/manifests/server/installation.pp:34 at /vagrant/X/modules/X/manifests/server/installation.pp:34:6 on node X.localhost.com Error: Evaluation Error: Error while evaluating a Resource Statement, Cannot alias Aem::Agent::Replication[local-author Remove publish agent flush] to ["flush"] at /vagrant/X/modules/X/manifests/server/installation.pp:34; resource ["Aem::Agent::Replication", "flush"] already declared at /vagrant/X/modules/X/manifests/server/installation.pp:34 at /vagrant/X/modules/X/manifests/server/installation.pp:34:6 on node X.localhost.com

bstopp commented 7 years ago

This is not an issue with the module. Puppet requires all resources to be uniquely name. See: https://docs.puppet.com/puppet/5.2/lang_resources.html#title

henrykuijpers commented 7 years ago

Thanks, indeed, you're right! :) I'm pretty new with Puppet but in the meantime I indeed solved the problem