def get_status_icon(*args, **kwargs):
# Try selecting backend based on environment variable
if "STATUS_BACKEND" in os.environ:
kwargs["force"] = True
status_icon_backend_name = "StatusIcon%s" % (os.environ.get("STATUS_BACKEND"))
if status_icon_backend_name in globals():
try:
status_icon = globals()[status_icon_backend_name](*args, **kwargs)
log.info("StatusIcon: Using requested backend %s" % (status_icon_backend_name))
return status_icon
except NotImplementedError:
log.error("StatusIcon: Requested backend %s is not supported" % (status_icon_backend_name))
else:
log.error("StatusIcon: Requested backend %s does not exist" % (status_icon_backend_name))
return StatusIconDummy(*args, **kwargs)
# Use proxy backend to determine the correct backend while the application is running
return StatusIconProxy(*args, **kwargs)
评论列表
文章目录