voxpupuli / puppet-rabbitmq

RabbitMQ Puppet Module
http://forge.puppetlabs.com/puppet/rabbitmq
Apache License 2.0
171 stars 500 forks source link

RabbitMQ 3.8.2+ compatibility for rabbitmqctl list_users #939

Closed mika closed 1 year ago

mika commented 1 year ago

rabbitmq-server's rabbitmqctl as of v3.7.8-4 (as shipped with Debian/buster) used to behave as follows:

| % sudo rabbitmqctl -q list_users
| foo        [bar]

As of rabbitmq-server v3.8.2-1+deb10u1 (as present in buster-security, see https://packages.qa.debian.org/r/rabbitmq-server/news/20230711T122021Z.html), it instead behaves as follows:

| % sudo rabbitmqctl -q list_users
| user    tags
| foo        [bar]

This results in:

| Error: Could not prefetch rabbitmq_user provider 'rabbitmqctl': Cannot parse invalid user line: user    tags

There's a new --no-table-headers option available in more recent versions of RabbitMQ (which would also be available for rabbitmq-server v3.8.2-1+deb10u1), also see https://github.com/rabbitmq/rabbitmq-cli/issues/273.

But since don't want to rely on having this option available (and therefore breaking compatibility with e.g. v3.7.8-4), let's instead skip lines matching this header output, to remaing both backwards as well as forwards compatible.

Related to https://github.com/voxpupuli/puppet-rabbitmq/issues/740

FTR: tested/verified with rabbitmq-server v3.7.8-4 + v3.8.2-1+deb10u1

mika commented 1 year ago

Gna sorry, I missed that new rabbitmqctl_list as of 42d45ed1667 already checks for the according package version and uses --no-table-headers as needed, we used an older version yet. Sorry for the noise and unneeded PR.

wyardley commented 1 year ago

Thanks! Got it, yeah, thought I'd seen a PR for this, but hadn't come across it.

mika commented 1 year ago

Thanks! Got it, yeah, thought I'd seen a PR for this, but hadn't come across it.

Yeah sorry, while looking into adding a test case I noticed that we were missing latest changes of puppet-rabbitmq, latest master works perfectly fine for both v3.7.8-4 and v3.8.2-1+deb10u1. :partying_face:

Incredibly fast reply from your side, kudos! Thanks and sorry again :)