metrics: don't fail if no argument is given to command

This commit is contained in:
Iain Learmonth 2022-11-02 14:24:18 +00:00
parent f92e713e98
commit 430ef0f86a

View file

@ -27,7 +27,11 @@ app.register_blueprint(portal, url_prefix="/portal")
app.register_blueprint(tfstate, url_prefix="/tfstate")
if 'nose' not in sys.modules.keys() and sys.argv[1] != "db":
def not_migrating() -> bool:
return len(sys.argv) < 2 or sys.argv[1] != "db"
if 'nose' not in sys.modules.keys() and not_migrating():
from app.metrics import DefinedProxiesCollector, BlockedProxiesCollector, AutomationCollector
REGISTRY.register(DefinedProxiesCollector(app))