voxpupuli / puppet-wildfly

Puppet module to install, configure and manage Wildfly (8/9/10+), JBoss EAP (6.1+/7.0+) and some Wildfly based products like apiman, Keycloak and Infinispan.
Apache License 2.0
29 stars 78 forks source link

Multiple calls to defined type wildfly::host::server_config cause "Duplicate resource" error #302

Closed EmersonPrado closed 8 months ago

EmersonPrado commented 10 months ago

Affected Puppet, Ruby, OS and module versions/distributions

How to reproduce

This happened when trying to replace the server groups with wildfly service active. This requires one call to wildfly::host::server_config to remove default groups, and another to create a replacement group. Simplified code excerpt:

  wildfly::host::server_config { ['server-one', 'server-two']:
    ensure   => absent,
  }
  if $configure_default_server {
    wildfly::host::server_config { $default_server_name:
      server_group => $default_server_group_name,
    }
  }

What are you seeing

First Puppet agent run fails with:

Error: Could not set 'present' on ensure: Failed with: {
  "host-failure-descriptions"=>{
    "master"=>"WFLYCTL0212: Duplicate resource [(\"host\" => \"master\"), (\"server-config\" => \"app\")]"
  }
} for {
  "address":[{"host":"master"},{"server-config":"app"}],
  "operation":"add",
  "auto-start":true,
  "group":"app-server-group",
  "socket-binding-port-offset":0,
  "operation-headers":null
}

What behaviour did you expect instead

Module should remove and add groups normally.

Any additional information you'd like to impart

All calls to wildfly_resource in wildfly::host::server_config use the same title: /host=${hostname}/server-config=${server_name} and wildfly_resource type uses this path as namevar. My suggested fix is to use title/name as namevar in wildfly_resource type and create unique titles in its calls in wildfly::host::server_config.

rwaffen commented 10 months ago

was this in before, or did i break it while migratin' it to vox?

EmersonPrado commented 10 months ago

was this in before, or did i break it while migratin' it to vox?

It already happened (long) before.

EmersonPrado commented 8 months ago

Several attempts to reproduce the issue, with CentOS/Rock/RHEL 7 to 9 and Puppet 5 to 7, in different overall situations, all failed miserably. I'll take it as a failure not related to the module itself, but some misuse in my environment, and close this. I'll reopen if ever I can find a setup which throws the error.