community.rabbitmq
community.rabbitmq copied to clipboard
Support headers in queue_declare function
SUMMARY
Add headers when running the declare queue function.
ISSUE TYPE
- Bugfix Pull Request
COMPONENT NAME
RabbitMQ Publish basic_publish
ADDITIONAL INFORMATION
When running the following Ansible task:
- name: Send reindex message to queue
community.rabbitmq.rabbitmq_publish:
url: "amqp://user:[email protected]:5672/%2F"
queue: "example"
body: '{ "type": "example" }'
content_type: "application/json"
durable: true
headers:
x-max-priority: 15
delegate_to: localhost
The task would fail adding the message to the queue, due to the headers not being passed in correctly. This pull request addresses that and adds the headers to the message.
Before:
fatal: [192.168.0.1 -> localhost]: FAILED! => changed=false
msg: 'Queue declare issue: (406, "PRECONDITION_FAILED - inequivalent arg ''x-max-priority'' for queue ''example'' in vhost ''/'': received none but current is the value ''15'' of type ''signedint''")'
After:
changed: [192.168.0.1-> localhost] => changed=true
result:
content_type: application/json
msg: Successfully published to queue example
queue: example
It has also been tested without passing in headers, and the play still functions as before.
@Andersson007 @csmart could I get a review of this please?
@V4UIDev hello, thanks for the PR!
- Could you please add a changelog fragment
- Is it possible to add a simple integration test somewhere under https://github.com/ansible-collections/community.rabbitmq/tree/main/tests/integration/targets ?
@V4UIDev thanks for the contribution and fixing up this missing component! I think some tests would be great, if you have the time. That will help us to keep on top of this in the future. Thanks!
@V4UIDev if you have any questions, please let us know
@csmart do you think if we can merge the PR w/o the requested integration tests as the author does not respond if i add the fragment in another PR? if you think it's dangerous, we could wait/close the PR, np
@Andersson007 @csmart Apologies for the delay. Changelog fragment and integration tests added, let me know if they need any further tweaking. Thanks!
will be happy to review the PR again once the integration tests are green, thanks!
will be happy to review the PR again once the integration tests are green, thanks!
Yes, I think there is a rate limit that cloudsmith impose on rabbitmq so will put in a commit next month :)
@V4UIDev @csmart are there maybe any other ways to securely install those packages? maybe something has changed on the packages provider site and now there are other URLs that are valid
closed-reopened to trigger CI, were fixed in https://github.com/ansible-collections/community.rabbitmq/pull/179, fyi
let's wait a bit and try again, looks strange, maybe GitHub issues..
it shows now:
fatal: couldn't find remote ref refs/pull/174/merge
##[warning]Git fetch failed with exit code 128, back off 8.918 seconds before retry.
git --config-env=http.extraheader=env_var_http.extraheader fetch --force --tags --prune --prune-tags --progress --no-recurse-submodules origin +refs/heads/*:refs/remotes/origin/* +refs/pull/174/merge:refs/remotes/pull/174/merge
fatal: couldn't find remote ref refs/pull/174/merge
##[warning]Git fetch failed with exit code 128, back off 2.425 seconds before retry.
git --config-env=http.extraheader=env_var_http.extraheader fetch --force --tags --prune --prune-tags --progress --no-recurse-submodules origin +refs/heads/*:refs/remotes/origin/* +refs/pull/174/merge:refs/remotes/pull/174/merge
fatal: couldn't find remote ref refs/pull/174/merge
##[error]Git fetch failed with exit code: 128
@V4UIDev there's something wrong with the PR
i now see you use main. please re-create the PR using another branch. Maybe there's a quicker way but for the sake of simplicity you could do:
- copy your current local repo somewhere
- remove your commits you added in this PR
- git remote add upstream https://github.com/ansible-collections/community.rabbitmq/
- git pull upstream main
- git push origin main
- git checkout -b new_branch
- copy the files you changed back
- submit another PR