Skip to content
Snippets Groups Projects
Verified Commit 69a3114e authored by Karel van Klink's avatar Karel van Klink :smiley_cat:
Browse files

Only check Kentik licenses during router validation in production

parent 45657a7c
Branches
Tags
1 merge request!411Only check Kentik licenses during router validation in production
Pipeline #93666 passed
......@@ -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(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment