-
-
Notifications
You must be signed in to change notification settings - Fork 500
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
Support policy format change in v3.7.0 - #671 (Replaces #674) #676
Conversation
RMQ < 3.7.0 shows policies as: `/ ha-all all .* {"ha-mode":"all","ha-sync-mode":"automatic"} 0` V3.7.0 returns this: `/ ha-all .* all {"ha-mode":"all","ha-sync-mode":"automatic"} 0` ```.*``` and ```all``` are swapped and regex needs to be updated. Also corrected a typo when (vhost, name) was swapped, accidentally, I suppose.
and corresponding applyto/pattern indexes outside of policy_line.each. Fixed tests to handle additional 'rabbitmqctl -p status' call, and add explicit testing for >=3.7.0
it 'matches policies from list' do | ||
provider.class.expects(:rabbitmqctl).with('-q', 'status').returns '{rabbit,"RabbitMQ","3.7.0"}' | ||
provider.class.expects(:rabbitmqctl).with('list_policies', '-q', '-p', '/').returns <<-EOT | ||
/ ha-all .* all {"ha-mode":"all","ha-sync-mode":"automatic"} 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This mostly makes sense to me, just curious why there's a literal .*
in the heredoc in these various examples (including in the existing code)... shouldn't the result be the literal output of running rabbitmqctl list_policies
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe .*
can be the output from rabbitmqctl list_polices
, as it's a regex pattern that can be used within the rabbitmq policy to control what resources the policy affects.
Unless I'm missing your point :)
More details here: https://www.rabbitmq.com/parameters.html#policies
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it, that makes sense then. I didn't have a rabbitmq instance handy so couldn't check the actual output, and a quick Google search failed me.
Thanks for this @fatmcgav, and thanks for preserving attribution. I'm +1 on this, with just the open question above (maybe I'm misunderstanding how the mock works here?) My only other question is on how reliable |
Yeh, I'm confused by the TravisCI failures, as those tests all pass for me locally :s |
@fatmcgav did you try with |
I'm also not seeing the error locally, even with I think the following should resolve the rubocop failures?
|
Proposed a possible fix in
It's basically an issue with that same instance being reused in combination with the parallel tests, I think? I think voxpupuli/puppet-nodejs@6b7acb5 was a similar problem (similar error and similar cause) |
Resolve test failures
@wyardley it looks like ure fix has got all the tests passing, so thanks for that... 😀 |
@@ -7,11 +7,10 @@ | |||
pattern: '.*', | |||
definition: { | |||
'ha-mode' => 'all' | |||
}, | |||
provider: described_class.name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wasn't 100% sure about this, but seems to work without it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeh, it does :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, but since I've got some changes in here, hoping someone else can merge. After merge, we should cut a release.
@wyardley A new release sounds good to me :) |
Thanks @fatmcgav! |
Support policy format change in v3.7.0 - voxpupuli#671 (Replaces voxpupuli#674)
RabbitMQ 3.7.0 seems to have changed the ordering of fields in the policies output.
Credit to @alexizmailov for the original work in #674, I just tweaked it a bit and added some tests :)
Fixes #671