Skip to content

wip: rabbitmqdadmin-ng - #1105

Open
d1nuc0m wants to merge 1 commit into
voxpupuli:masterfrom
d1nuc0m:rabbitmqadmin-ng
Open

d1nuc0m wants to merge 1 commit into
voxpupuli:masterfrom
d1nuc0m:rabbitmqadmin-ng

Conversation

@d1nuc0m

@d1nuc0m d1nuc0m commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Pull Request (PR) description

Install rabbitmqadmin-ng for RabbitMQ >= 4.0

This Pull Request (PR) fixes the following issues

n/a.

@d1nuc0m d1nuc0m added the enhancement New feature or request label Nov 25, 2026
@d1nuc0m
d1nuc0m force-pushed the rabbitmqadmin-ng branch 5 times, most recently from e275a43 to 7e105ba Compare November 25, 2026 13:53

@miharp miharp left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I saw your slack question about using GH urls so I ran the Debian and RedHat branches of rabbitmq::install::rabbitmqadmin_ng on their own in Debian 12 and AlmaLinux 9 containers (OpenVox 8.34.0, puppet-archive 8.1.0), using rabbitmqadmin 2.34.0 and 2.35.0. Fresh installs work on both.

The inline comments cover what I found: changing rabbitmqadmin_ng_version doesn't upgrade an installed package, and the Debian download fails on arm64. Both suggestions are tested. I didn't run the module's spec suites against them.

FYI: the unit specs default to RabbitMQ 3.13, so this class doesn't look like it's compiled there. A 4.x context that checks the package's ensure and source would cover both issues.

Comment thread manifests/install/rabbitmqadmin_ng.pp Outdated
Comment on lines +11 to +24
$rabbitmqadmin_url = "https://github.com/rabbitmq/rabbitmqadmin-ng/releases/download/v${$rabbitmqadmin_ng_version}/rabbitmqadmin_${$rabbitmqadmin_ng_version}_${facts['os']['architecture']}.deb"
$rabbitmqadmin_checksum_url = "${rabbitmqadmin_url}.sha512"

archive::download { "/var/lib/rabbitmq/rabbitmqadmin_${$rabbitmqadmin_ng_version}_${facts['os']['architecture']}.deb":
ensure => present,
url => $rabbitmqadmin_url,
digest_type => 'sha512',
digest_url => $rabbitmqadmin_checksum_url,
}

package { 'rabbitmqadmin':
source => "/var/lib/rabbitmq/rabbitmqadmin_${$rabbitmqadmin_ng_version}_${facts['os']['architecture']}.deb",
require => Archive::Download["/var/lib/rabbitmq/rabbitmqadmin_${$rabbitmqadmin_ng_version}_${facts['os']['architecture']}.deb"],
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two things from running this branch in Debian 12 containers (OpenVox 8.34.0, puppet-archive 8.1.0):

  • Changing rabbitmqadmin_ng_version downloads the new .deb but the old version stays installed, because the package has no version in ensure.
  • On arm64 the download returns a 404. $facts['os']['architecture'] is aarch64 there, but the asset is named rabbitmqadmin_2.35.0_arm64.deb.

This fixes both. I tested it on amd64 and arm64 between 2.34.0 and 2.35.0:

Suggested change
$rabbitmqadmin_url = "https://github.com/rabbitmq/rabbitmqadmin-ng/releases/download/v${$rabbitmqadmin_ng_version}/rabbitmqadmin_${$rabbitmqadmin_ng_version}_${facts['os']['architecture']}.deb"
$rabbitmqadmin_checksum_url = "${rabbitmqadmin_url}.sha512"
archive::download { "/var/lib/rabbitmq/rabbitmqadmin_${$rabbitmqadmin_ng_version}_${facts['os']['architecture']}.deb":
ensure => present,
url => $rabbitmqadmin_url,
digest_type => 'sha512',
digest_url => $rabbitmqadmin_checksum_url,
}
package { 'rabbitmqadmin':
source => "/var/lib/rabbitmq/rabbitmqadmin_${$rabbitmqadmin_ng_version}_${facts['os']['architecture']}.deb",
require => Archive::Download["/var/lib/rabbitmq/rabbitmqadmin_${$rabbitmqadmin_ng_version}_${facts['os']['architecture']}.deb"],
}
$deb_arch = $facts['os']['architecture'] ? {
'aarch64' => 'arm64',
default => $facts['os']['architecture'],
}
$rabbitmqadmin_url = "https://github.com/rabbitmq/rabbitmqadmin-ng/releases/download/v${$rabbitmqadmin_ng_version}/rabbitmqadmin_${$rabbitmqadmin_ng_version}_${deb_arch}.deb"
$rabbitmqadmin_checksum_url = "${rabbitmqadmin_url}.sha512"
$rabbitmqadmin_deb = "/var/lib/rabbitmq/rabbitmqadmin_${$rabbitmqadmin_ng_version}_${deb_arch}.deb"
archive::download { $rabbitmqadmin_deb:
ensure => present,
url => $rabbitmqadmin_url,
digest_type => 'sha512',
digest_url => $rabbitmqadmin_checksum_url,
}
package { 'rabbitmqadmin':
ensure => $rabbitmqadmin_ng_version,
source => $rabbitmqadmin_deb,
require => Archive::Download[$rabbitmqadmin_deb],
}

Comment thread manifests/install/rabbitmqadmin_ng.pp Outdated
Comment on lines +29 to +31
package { 'rabbitmqadmin':
source => $rabbitmqadmin_url,
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same upgrade problem here: on AlmaLinux 9, changing rabbitmqadmin_ng_version does nothing once the package is installed. With the version in ensure, install, upgrade and downgrade all follow the parameter:

Suggested change
package { 'rabbitmqadmin':
source => $rabbitmqadmin_url,
}
package { 'rabbitmqadmin':
ensure => "${rabbitmqadmin_ng_version}-1",
source => $rabbitmqadmin_url,
}

@d1nuc0m

d1nuc0m commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

@miharp thank you very much, I added your suggestions (and you as co-author)

FYI: the unit specs default to RabbitMQ 3.13, so this class doesn't look like it's compiled there. A 4.x context that checks the package's ensure and source would cover both issues.

If you're speaking of spec/acceptance/rabbitmqadmin_ng_spec.rb it should still work as on GitHub beaker iterates over RabbitMQ version as custom fact, changed it to 4.0 anyway

Comment thread manifests/install/rabbitmqadmin_ng.pp Resolved
@miharp

miharp commented Nov 25, 2026

Copy link
Copy Markdown

On the FYI, I meant the unit spec, spec/classes/rabbitmq_spec.rb, not the acceptance one. It defaults to 3.13 and the unit jobs don't set a RabbitMQ version, so nothing there compiles rabbitmq::install::rabbitmqadmin_ng. The acceptance spec is fine as it is.

@d1nuc0m

d1nuc0m commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

I meant the unit spec, spec/classes/rabbitmq_spec.rb

rabbitmq_version = ENV.fetch('BEAKER_FACTER_rabbitmq_version', '3.13')

Uses 3.13 as a default, but CI/CD creates different jobs with different values of rabbitmq_version (see .github/workflows/ci.yml), on a local system it can be tested passing manually the variable to beaker (eg. with BEAKER_SETFILE="almalinux9-64" BEAKER_FACTER_rabbitmq_version=4.3 bundle exec rake spec SPEC=spec/classes/rabbitmq_spec.rb)

Or I am misunderstanding again 😅

@miharp

miharp commented Nov 25, 2026

Copy link
Copy Markdown

Easier to show than explain, so I opened a do-not-merge PR on my fork with an example: miharp#1

Its base is your current head, so the diff is only the tests: one context in spec/classes/rabbitmq_spec.rb that sets rabbitmq_version: '4.3' in its own params. That way it runs in the unit jobs no matter what the env var is. In gha-puppet's beaker.yml, the beaker_facter matrix only reaches the acceptance job; the unit job runs rake parallel_spec without BEAKER_FACTER_rabbitmq_version, so the rest of that file runs with the 3.13 default there.

Both unit jobs are green on the fork (Puppet / 8 (Ruby 3.2) and Puppet / 9 (Ruby 4.0)), with 99 new examples covering the install class, the Debian and RedHat packages, the arm64 name, a non-default rabbitmqadmin_ng_version, and admin_enable/service_manage set to false. Cherry-pick the two commits or take whatever is useful.

@miharp

miharp commented Nov 25, 2026

Copy link
Copy Markdown

I ran this on real VMs to cover what the container tests can't: AlmaLinux 9.9 and Ubuntu 24.04, RabbitMQ 4.3.8, OpenVox 8.34.0 and 9.5.0, puppet apply on nodes that had never had RabbitMQ. Tested at 5d66fac; the current head only differs in the arm64 URL.

Works: rabbitmqadmin_ng_version moved down to 2.34.0 and back, queues with arguments, a quorum queue, the default vhost, ensure => absent, and a non-default management_port. All idempotent on the second run.

In this PR

  1. FreeBSD fails with default parameters. rabbitmq_version defaults to 'latest', which takes the 4.x path, so the install class is now in every default catalog. On FreeBSD 13/14 the default: branch manages /usr/bin/rabbitmqadmin from rabbitmqadmin-2.35.0-amd64-unknown-linux-gnu, which returns a 404 (and is a Linux binary). I checked the compiled catalog and the URL, not a FreeBSD host. OpenBSD, Arch and SLES take the same branch.
  2. The first apply on a fresh node fails. Rabbitmq_queue errors with Command rabbitmqadmin is missing (exit 6); the second apply creates the queue. The two providers are confined on Facter.value(:rabbitmq_version) when they load, and that fact is empty before RabbitMQ is installed, so the legacy provider is picked. CI doesn't hit this because earlier specs have already installed RabbitMQ in the same container. Same result on all four OS and OpenVox combinations.
  3. Nothing orders the install before queues. On Ubuntu the queue was attempted before the rabbitmqadmin package was installed. init.pp only orders the install class before Rabbitmq_exchange.
  4. Debian family needs GitHub on every run. archive::download re-fetches the .sha512 each time. With github.com unreachable, a steady-state run fails. AlmaLinux is not affected.
  5. rabbitmqadmin.conf is only valid TOML in the default case. With management_hostname => 'localhost' queue creation fails, because the template writes the hostname unquoted. The template's ssl = True fails the same parse when I feed it to the CLI; I didn't set up management SSL end to end.

Beyond this PR, for the 4.x work

  • rabbitmq_exchange and rabbitmq_binding fail on 4.3 with the same Command rabbitmqadmin is missing. They only have the legacy provider.
  • rabbitmq_policy works on 4.3 with settings 4.x accepts. The policy spec uses ha-mode, which 4.x rejects.
  • An in-place 3.13 to 4.3 upgrade through the module (rabbitmq_version plus package_ensure => 'latest') completes in one run, but a persistent message in a classic queue was lost. That is RabbitMQ's doing: 4.3 only supports upgrades from 4.2 and dropped the v1 queue storage 3.13 uses by default. The module doesn't warn about it, though. Afterwards the old /usr/local/bin/rabbitmqadmin is still first on the PATH, and the new feature flags are left disabled.
  • metadata.json allows stdlib below 11 but puppet-archive below 9, and archive 8.x needs stdlib below 10. With stdlib 10.x installed, puppet module install can't resolve archive.

I haven't tested fixes for any of these. Happy to rerun the same checks on a later commit.

@d1nuc0m

d1nuc0m commented Nov 30, 2026

Copy link
Copy Markdown
Contributor Author

Ok, I'll try to split this in multiple PRs: first rabbitmqadmin-ng install, then providers.

PR

FreeBSD fails with default parameters

Install should be now limited to Linux OSes. It will be a problem with providers, but I don't see how to install rabbitmqadmin-ng on *BSD, should probably be left to users?

The first apply on a fresh node fails
Nothing orders the install before queues

Noted, will be a problem for subsequent PRs for providers

Debian family needs GitHub on every run

Removed checksum check from URL, although I don't really like the idea

Beyond this PR

  • Providers will be updated in subsequent PRs
  • In place-upgrade will probably not be supported - lot of work and up to recently the module only supported up to RMQ 3.8
  • metadata.json - there are other ongoing PRs for that

(still working on the feedback)

@d1nuc0m

d1nuc0m commented Nov 30, 2026

Copy link
Copy Markdown
Contributor Author

Its base is your current head, so the diff is only the tests: one context in spec/classes/rabbitmq_spec.rb that sets rabbitmq_version: '4.3' in its own params. That way it runs in the unit jobs no matter what the env var is. In gha-puppet's beaker.yml, the beaker_facter matrix only reaches the acceptance job; the unit job runs rake parallel_spec without BEAKER_FACTER_rabbitmq_version, so the rest of that file runs with the 3.13 default there.

I'll try to merge it with 3.13 tests using conditions based on the version, so that the test run when relevant.

For the unit specs it'll be a problem for the future PRs :D

Install rabbitmqadmin-ng, will be used for providers

Co-authored-by: miharp <miharp@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants