mirror of
https://github.com/nicolargo/glances.git
synced 2024-12-21 00:01:53 +03:00
Needed to handle case where no protocol was specified in configuration. So added in an if clause to check if the protocol was present
This commit is contained in:
parent
f162020eae
commit
3d5490b6c4
@ -44,7 +44,7 @@ class Export(GlancesExport):
|
|||||||
self.user = None
|
self.user = None
|
||||||
self.password = None
|
self.password = None
|
||||||
self.queue = None
|
self.queue = None
|
||||||
self.protocol = 'amqp'
|
self.protocol = None
|
||||||
|
|
||||||
# Optionals configuration keys
|
# Optionals configuration keys
|
||||||
# N/A
|
# N/A
|
||||||
@ -68,6 +68,14 @@ class Export(GlancesExport):
|
|||||||
"""Init the connection to the rabbitmq server."""
|
"""Init the connection to the rabbitmq server."""
|
||||||
if not self.export_enable:
|
if not self.export_enable:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
# Needed for when protocol is not specified and when protocol is upper case
|
||||||
|
# only amqp and amqps supported
|
||||||
|
if self.protocol is not None and (self.protocol.lower() == 'amqps'):
|
||||||
|
self.protocol = 'amqps'
|
||||||
|
else:
|
||||||
|
self.protocol = 'amqp'
|
||||||
|
|
||||||
try:
|
try:
|
||||||
parameters = pika.URLParameters(
|
parameters = pika.URLParameters(
|
||||||
self.protocol +
|
self.protocol +
|
||||||
|
Loading…
Reference in New Issue
Block a user