import logging
import os
import sys
+import yaml
logging.basicConfig(stream=sys.stdout,
format='%(asctime)s %(message)s',
vrops_rcvr = plugin_receiver.PluginReceiver()
-def get_vim_type(message):
+def get_vim_type(msg):
"""Get the vim type that is required by the message."""
try:
- return json.loads(message.value)["vim_type"].lower()
+ vim_uuid = json.loads(msg.value)["vim_uuid"].lower()
+ credentials = database_manager.get_credentials(vim_uuid)
+ return credentials.type
except Exception as exc:
log.warn("vim_type is not configured correctly; %s", exc)
return None
for message in common_consumer:
log.info("Message arrived: %s", message)
try:
- values = json.loads(message.value)
+ try:
+ values = json.loads(message.value)
+ except:
+ values = yaml.safe_load(message.value)
# Check the message topic
if message.topic == "metric_request":
# Check the vim desired by the message