Skip to content
Snippets Groups Projects

Only check Kentik licenses during router validation in production

Merged Karel van Klink requested to merge feature/fix-kentik-license-check into develop
1 file
+ 9
3
Compare changes
  • Side-by-side
  • Inline
@@ -17,7 +17,7 @@ from gso.services.librenms_client import LibreNMSClient
from gso.services.lso_client import LSOState, anonymous_lso_interaction
from gso.services.netbox_client import NetboxClient
from gso.services.subscriptions import get_active_layer_3_services_on_router, get_active_vrfs_linked_to_router
from gso.settings import load_oss_params
from gso.settings import EnvironmentEnum, load_oss_params
from gso.utils.helpers import generate_inventory_for_routers
from gso.utils.shared_enums import Vendor
@@ -159,9 +159,15 @@ def check_kentik_entry_exists(subscription: Router) -> None:
message="Device not found in Kentik", details={"device": subscription.router.router_fqdn}
)
oss_params = load_oss_params()
# If there are active layer 3 services, check the license type. It may not be the placeholder or archiving license.
if bool(get_active_layer_3_services_on_router(subscription.subscription_id)):
kentik_params = load_oss_params().KENTIK
# This check is only performed in a production environment
if (
bool(get_active_layer_3_services_on_router(subscription.subscription_id))
and oss_params.GENERAL.environment == EnvironmentEnum.PRODUCTION
):
kentik_params = oss_params.KENTIK
archive_plan = client.get_plan_by_name(kentik_params.archive_license_key)
if any(device["device_name"] == subscription.router.router_fqdn for device in archive_plan["devices"]):
raise ProcessFailureError(
Loading