- logger.debug('callback data: {}'.format(callback_data))
- o = urlparse(conf.DEFAULT.smo_register_url)
- if o.scheme == 'https':
- conn = get_https_conn_default(o.netloc)
- else:
- conn = get_http_conn(o.netloc)
-
- try:
- return post_data(conn, o.path, callback_data)
- except ssl.SSLCertVerificationError as e:
- logger.debug('Try to register to smo with \
- trusted ca failed: {}'.format(e))
- if 'self signed' in str(e):
- conn = get_https_conn_selfsigned(o.netloc)
- try:
- return post_data(conn, o.path, callback_data)
- except Exception as e:
- logger.info(
- 'Register to smo with self-signed ca failed: {}'.format(e))
- # TODO: write the status to extension db table.
- return False, None
- return False, None
- except Exception as e:
- logger.critical('Register to smo except: {}'.format(e))
- return False, None
+ logger.debug('callback data: {}'.format(json.dumps(callback)))
+ return notifications.send(conf.DEFAULT.smo_register_url, callback)