Skip to content
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

[RabbitMQ] add a protocol if there isn't one #909

Merged
merged 3 commits into from
Nov 28, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions rabbitmq/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,14 @@ def _get_config(self, instance):
password = instance.get('rabbitmq_pass', 'guest')
custom_tags = instance.get('tags', [])
parsed_url = urlparse.urlparse(base_url)
if not parsed_url.scheme:
self.log.warning('The rabbit url did not include a protocol, assuming http')
# urlparse.urljoin cannot add a protocol to the rest of the url for some reason.
# This still leaves the potential for errors, but such urls would never have been valid, either
# and it's not likely to be useful to attempt to catch all possible mistakes people could make
base_url = 'http://' + base_url
Copy link
Contributor

Choose a reason for hiding this comment

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

How does this play with kubernetes/autoconfig? See #838

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually http://rabbitmq-management.default:443 would work, so we're good.

parsed_url = urlparse.urlparse(base_url)

ssl_verify = _is_affirmative(instance.get('ssl_verify', True))
if not ssl_verify and parsed_url.scheme == 'https':
self.log.warning('Skipping SSL cert validation for %s based on configuration.' % (base_url))
Expand Down