diff --git a/inventory_provider/config.py b/inventory_provider/config.py index 93aaa3876744741023cba81cec4f8ab0b50a476b..486f7092177abea5bc38515092763ecbd16efbc3 100644 --- a/inventory_provider/config.py +++ b/inventory_provider/config.py @@ -2,7 +2,7 @@ import json import jsonschema CONFIG_SCHEMA = { - '$schema': 'http://json-schema.org/draft-07/schema#', + '$schema': 'https://json-schema.org/draft-07/schema#', 'definitions': { 'timeout': { diff --git a/inventory_provider/db/ims_data.py b/inventory_provider/db/ims_data.py index d4ef64ecf25928e8231642060993eef2e640418c..371e2f2cfc537d4509bc75d1f8a1222c4493bf9e 100644 --- a/inventory_provider/db/ims_data.py +++ b/inventory_provider/db/ims_data.py @@ -46,12 +46,12 @@ _POP_LOCATION_SCHEMA_STRUCT = { } POP_LOCATION_SCHEMA = { - '$schema': 'http://json-schema.org/draft-07/schema#', + '$schema': 'https://json-schema.org/draft-07/schema#', **_POP_LOCATION_SCHEMA_STRUCT } NODE_LOCATION_SCHEMA = { - '$schema': 'http://json-schema.org/draft-07/schema#', + '$schema': 'https://json-schema.org/draft-07/schema#', 'definitions': { 'pop-location': _POP_LOCATION_SCHEMA_STRUCT }, diff --git a/inventory_provider/routes/classifier.py b/inventory_provider/routes/classifier.py index b9fc8c4fbbf2e73c0334fcb5baa72861ba4efba8..700be8dc2a3d87c9f92e244c99217a94be8a5f62 100644 --- a/inventory_provider/routes/classifier.py +++ b/inventory_provider/routes/classifier.py @@ -531,6 +531,8 @@ def peer_info(address_str: str) -> Response: cache_key = f'classifier-cache:peer:{address_str}' result = _ignore_cache_or_retrieve(request, cache_key, r) + result = None + if not result: result = { diff --git a/inventory_provider/routes/classifier_schema.py b/inventory_provider/routes/classifier_schema.py index 4259d5fe39e925a7e79596c6991778867659c547..7bfd8219013027834071c75aebfd01b41b222d0f 100644 --- a/inventory_provider/routes/classifier_schema.py +++ b/inventory_provider/routes/classifier_schema.py @@ -271,7 +271,7 @@ _juniper_link_response_schema_definitions = { } JUNIPER_LINK_RESPONSE_SCHEMA = { - "$schema": "http://json-schema.org/draft-07/schema#", + "$schema": "https://json-schema.org/draft-07/schema#", "definitions": { **_juniper_link_response_schema_definitions, @@ -421,7 +421,7 @@ _peer_info_response_schema_definitions = { PEER_INFO_RESPONSE_SCHEMA = { - "$schema": "http://json-schema.org/draft-07/schema#", + "$schema": "https://json-schema.org/draft-07/schema#", "definitions": { **_peer_info_response_schema_definitions, @@ -545,7 +545,7 @@ _infinera_lambda_response_schema_definitions = { } INFINERA_LAMBDA_INFO_RESPONSE_SCHEMA = { - "$schema": "http://json-schema.org/draft-07/schema#", + "$schema": "https://json-schema.org/draft-07/schema#", "definitions": { **_infinera_lambda_response_schema_definitions, @@ -576,7 +576,7 @@ INFINERA_LAMBDA_INFO_RESPONSE_SCHEMA = { MTC_INTERFACE_INFO_RESPONSE_SCHEMA = INFINERA_LAMBDA_INFO_RESPONSE_SCHEMA INFINERA_FIBERLINK_INFO_RESPONSE_SCHEMA = { - "$schema": "http://json-schema.org/draft-07/schema#", + "$schema": "https://json-schema.org/draft-07/schema#", "definitions": { **_common_schema_definitions @@ -602,7 +602,7 @@ INFINERA_FIBERLINK_INFO_RESPONSE_SCHEMA = { } CORIANT_INFO_RESPONSE_SCHEMA = { - "$schema": "http://json-schema.org/draft-07/schema#", + "$schema": "https://json-schema.org/draft-07/schema#", "definitions": { @@ -668,7 +668,7 @@ CORIANT_INFO_RESPONSE_SCHEMA = { TNMS_FIBERLINK_INFO_RESPONSE_SCHEMA = { - "$schema": "http://json-schema.org/draft-07/schema#", + "$schema": "https://json-schema.org/draft-07/schema#", 'definitions': { diff --git a/inventory_provider/routes/data.py b/inventory_provider/routes/data.py index aa422918ac734e911a445f912d2ccaa0a78c6ad6..c0b4a31b4709f1864839f5bb46c109cb5d267f4e 100644 --- a/inventory_provider/routes/data.py +++ b/inventory_provider/routes/data.py @@ -37,13 +37,13 @@ logger = logging.getLogger(__name__) routes = Blueprint("inventory-data-query-routes", __name__) ROUTERS_RESPONSE_SCHEMA = { - "$schema": "http://json-schema.org/draft-07/schema#", + "$schema": "https://json-schema.org/draft-07/schema#", "type": "array", "items": {"type": "string"} } ROUTER_INTERFACES_SCHEMA = { - "$schema": "http://json-schema.org/draft-07/schema#", + "$schema": "https://json-schema.org/draft-07/schema#", "type": "array", "items": { "type": "object", @@ -72,7 +72,7 @@ ROUTER_INTERFACES_SCHEMA = { } POP_RESPONSE_SCHEMA = { - "$schema": "http://json-schema.org/draft-07/schema#", + "$schema": "https://json-schema.org/draft-07/schema#", "definitions": { "pop-info": { diff --git a/inventory_provider/routes/default.py b/inventory_provider/routes/default.py index ea82dd88bdccf786bbd5e514e2c3038c4b7591ee..08dcfd4a1e5d22c73fec11b2ba2fdaa0662a1fe6 100644 --- a/inventory_provider/routes/default.py +++ b/inventory_provider/routes/default.py @@ -29,7 +29,7 @@ routes = Blueprint('inventory-data-default-routes', __name__) API_VERSION = '0.1' VERSION_SCHEMA = { - '$schema': 'http://json-schema.org/draft-07/schema#', + '$schema': 'https://json-schema.org/draft-07/schema#', 'definitions': { 'latch': { diff --git a/inventory_provider/routes/jobs.py b/inventory_provider/routes/jobs.py index 1f76e4309ef0f436b6771434b064a82764687ee5..0fd0503051393a02d705ce79b0fc77c1f35427f9 100644 --- a/inventory_provider/routes/jobs.py +++ b/inventory_provider/routes/jobs.py @@ -40,7 +40,7 @@ logger = logging.getLogger(__name__) TASK_ID_RESPONSE_SCHEMA = { - "$schema": "http://json-schema.org/draft-07/schema#", + "$schema": "https://json-schema.org/draft-07/schema#", "type": "object", "properties": { "task id": {"type": "string"} @@ -50,7 +50,7 @@ TASK_ID_RESPONSE_SCHEMA = { } TASK_LOG_RESPONSE_SCHEMA = { - "$schema": "http://json-schema.org/draft-07/schema#", + "$schema": "https://json-schema.org/draft-07/schema#", "type": "object", "properties": { "pending": {"type": "array", "items": {"type": "string"}}, @@ -63,7 +63,7 @@ TASK_LOG_RESPONSE_SCHEMA = { } INDIVIDUAL_TASK_STATUS_RESPONSE_SCHEMA = { - "$schema": "http://json-schema.org/draft-07/schema#", + "$schema": "https://json-schema.org/draft-07/schema#", "definitions": { "task": { "type": "object", diff --git a/inventory_provider/routes/lg.py b/inventory_provider/routes/lg.py index e8231e86bdf04f558d662278692bc4790ddad59d..e886e3d367f094f28cff03326fa6e77fba3e201a 100644 --- a/inventory_provider/routes/lg.py +++ b/inventory_provider/routes/lg.py @@ -27,7 +27,7 @@ ACCESS_INTERNAL = 'all' LG_ROUTERS_SCHEMA = { - "$schema": "http://json-schema.org/draft-07/schema#", + "$schema": "https://json-schema.org/draft-07/schema#", "definitions": { "pop-info": { diff --git a/inventory_provider/routes/lnetd.py b/inventory_provider/routes/lnetd.py index 8402a0e061bcaa334e6e4391b08b88ffebb4f374..2cdaa3b5f96d6d04a252f2a9904b6d09e8d49aff 100644 --- a/inventory_provider/routes/lnetd.py +++ b/inventory_provider/routes/lnetd.py @@ -27,7 +27,7 @@ logger = logging.getLogger(__name__) routes = Blueprint('lnetd-support-routes', __name__) INTERFACE_LIST_SCHEMA = { - '$schema': 'http://json-schema.org/draft-07/schema#', + '$schema': 'https://json-schema.org/draft-07/schema#', 'definitions': { diff --git a/inventory_provider/routes/mic.py b/inventory_provider/routes/mic.py index 78379c914b38948fdf54b3270d71fc23ededdd3c..43484ef028e2053da82566e7d42fc9537586ea85 100644 --- a/inventory_provider/routes/mic.py +++ b/inventory_provider/routes/mic.py @@ -27,7 +27,7 @@ logger = logging.getLogger(__name__) routes = Blueprint('mic-support-routes', __name__) SITES_LIST_SCHEMA = { - "$schema": "http://json-schema.org/draft-07/schema#", + "$schema": "https://json-schema.org/draft-07/schema#", "type": "array", "items": { "type": "object", @@ -41,14 +41,14 @@ SITES_LIST_SCHEMA = { } NODES_LIST_SCHEMA = { - "$schema": "http://json-schema.org/draft-07/schema#", + "$schema": "https://json-schema.org/draft-07/schema#", "type": "array", "items": {"type": "string"}, "additionalProperties": False } INTERFACES_LIST_SCHEMA = { - "$schema": "http://json-schema.org/draft-07/schema#", + "$schema": "https://json-schema.org/draft-07/schema#", "type": "array", "items": {"type": "string"}, "additionalProperties": False diff --git a/inventory_provider/routes/msr.py b/inventory_provider/routes/msr.py index a3d470576555173ce8de729b55623da774b75f25..759319e9235f2df6aca48757482bf84fefdde515 100644 --- a/inventory_provider/routes/msr.py +++ b/inventory_provider/routes/msr.py @@ -124,14 +124,14 @@ logger = logging.getLogger(__name__) _subnet_lookup_semaphore = threading.Semaphore() PEERING_GROUP_LIST_SCHEMA = { - '$schema': 'http://json-schema.org/draft-07/schema#', + '$schema': 'https://json-schema.org/draft-07/schema#', 'type': 'array', 'items': {'type': 'string'} } PEERING_LIST_SCHEMA = { - '$schema': 'http://json-schema.org/draft-07/schema#', + '$schema': 'https://json-schema.org/draft-07/schema#', 'definitions': { 'peering-instance': { 'type': 'object', @@ -162,7 +162,7 @@ PEERING_LIST_SCHEMA = { IP_ADDRESS_LIST_SCHEMA = { - '$schema': 'http://json-schema.org/draft-07/schema#', + '$schema': 'https://json-schema.org/draft-07/schema#', 'definitions': { "ip-address": { "type": "string", @@ -179,7 +179,7 @@ IP_ADDRESS_LIST_SCHEMA = { } PEERING_ADDRESS_SERVICES_LIST = { - '$schema': 'http://json-schema.org/draft-07/schema#', + '$schema': 'https://json-schema.org/draft-07/schema#', 'definitions': { 'service': { 'properties': { @@ -210,7 +210,7 @@ PEERING_ADDRESS_SERVICES_LIST = { } SYSTEM_CORRELATION_SERVICES_LIST_SCHEMA = { - '$schema': 'http://json-schema.org/draft-07/schema#', + '$schema': 'https://json-schema.org/draft-07/schema#', 'definitions': { 'v4-network': {'type': 'string'}, # TODO: can this be better? @@ -281,7 +281,7 @@ SYSTEM_CORRELATION_SERVICES_LIST_SCHEMA = { } MDVPN_LIST_SCHEMA = { - '$schema': 'http://json-schema.org/draft-07/schema#', + '$schema': 'https://json-schema.org/draft-07/schema#', 'definitions': { 'mdvpn_group': { 'type': 'object', @@ -341,7 +341,7 @@ MDVPN_LIST_SCHEMA = { } VPN_PROXY_LIST_SCHEMA = { - '$schema': 'http://json-schema.org/draft-07/schema#', + '$schema': 'https://json-schema.org/draft-07/schema#', 'definitions': { 'vpn_proxy_peering': { 'type': 'object', @@ -369,7 +369,7 @@ DOMAIN_TO_POP_MAPPING = { } IP_SERVICES_LIST_SCHEMA = { - '$schema': 'http://json-schema.org/draft-07/schema#', + '$schema': 'https://json-schema.org/draft-07/schema#', 'definitions': { 'minimal-peering-schema': { # cf. PEERING_LIST_SCHEMA @@ -428,7 +428,7 @@ IP_SERVICES_LIST_SCHEMA = { # very similar to PEERING_LIST_SCHEMA but # with a field for NREN, which is required ASN_PEER_LIST_SCHEMA = { - '$schema': 'http://json-schema.org/draft-07/schema#', + '$schema': 'https://json-schema.org/draft-07/schema#', 'definitions': { 'peering-instance': { 'type': 'object', diff --git a/inventory_provider/routes/neteng.py b/inventory_provider/routes/neteng.py index dce7b2dc432e7caa6df58345441b14517603aa36..99d9f6b8709ad647cab6987be7d53c990856ed0e 100644 --- a/inventory_provider/routes/neteng.py +++ b/inventory_provider/routes/neteng.py @@ -37,7 +37,7 @@ logger = logging.getLogger(__name__) _subnet_lookup_semaphore = threading.Semaphore() STRING_LIST_SCHEMA = { - '$schema': 'http://json-schema.org/draft-07/schema#', + '$schema': 'https://json-schema.org/draft-07/schema#', 'type': 'array', 'items': {'type': 'string'} } diff --git a/inventory_provider/routes/poller.py b/inventory_provider/routes/poller.py index 77cf51410f4a19125518da92801f9ae11649e2f5..2bf7502b9cd57aaf7844bbb844b736c6e218dfcb 100644 --- a/inventory_provider/routes/poller.py +++ b/inventory_provider/routes/poller.py @@ -127,7 +127,7 @@ _DASHBOARD_IDS = [d.name for d in list(BRIAN_DASHBOARDS)] _INTERFACE_TYPES = [i.name for i in list(INTERFACE_TYPES)] INTERFACE_LIST_SCHEMA = { - '$schema': 'http://json-schema.org/draft-07/schema#', + '$schema': 'https://json-schema.org/draft-07/schema#', 'definitions': { 'service': { @@ -198,7 +198,7 @@ INTERFACE_LIST_SCHEMA = { INTERFACE_SPEED_LIST_SCHEMA = { - '$schema': 'http://json-schema.org/draft-07/schema#', + '$schema': 'https://json-schema.org/draft-07/schema#', 'definitions': { 'interface': { @@ -218,7 +218,7 @@ INTERFACE_SPEED_LIST_SCHEMA = { } MULTICAST_SUBSCRIPTION_LIST_SCHEMA = { - '$schema': 'http://json-schema.org/draft-07/schema#', + '$schema': 'https://json-schema.org/draft-07/schema#', 'definitions': { 'ipv4-address': { @@ -248,7 +248,7 @@ MULTICAST_SUBSCRIPTION_LIST_SCHEMA = { } GWS_DIRECT_DATA_SCHEMA = { - '$schema': 'http://json-schema.org/draft-07/schema#', + '$schema': 'https://json-schema.org/draft-07/schema#', 'definitions': { 'oid': { @@ -335,7 +335,7 @@ GWS_DIRECT_DATA_SCHEMA = { SERVICES_LIST_SCHEMA = { - '$schema': 'http://json-schema.org/draft-07/schema#', + '$schema': 'https://json-schema.org/draft-07/schema#', 'definitions': { 'oid': { @@ -396,7 +396,7 @@ SERVICES_LIST_SCHEMA = { STRING_LIST_SCHEMA = { - '$schema': 'http://json-schema.org/draft-07/schema#', + '$schema': 'https://json-schema.org/draft-07/schema#', 'type': 'array', 'items': {'type': 'string'} } diff --git a/inventory_provider/tasks/common.py b/inventory_provider/tasks/common.py index 82b7dd982078c88397b4d7ea5d6eb0d29bcb4035..3a5a854215ebbdaf3cb1f140e1ab716b835df370 100644 --- a/inventory_provider/tasks/common.py +++ b/inventory_provider/tasks/common.py @@ -13,7 +13,7 @@ DEFAULT_REDIS_SENTINEL_TIMEOUT = 0.1 DEFAULT_SENTINEL_SOCKET_TIMEOUT = 0.1 DB_LATCH_SCHEMA = { - '$schema': 'http://json-schema.org/draft-07/schema#', + '$schema': 'https://json-schema.org/draft-07/schema#', 'type': 'object', 'properties': { 'current': {'type': 'integer'}, @@ -29,7 +29,7 @@ DB_LATCH_SCHEMA = { } TASK_LOG_SCHEMA = { - '$schema': 'http://json-schema.org/draft-07/schema#', + '$schema': 'https://json-schema.org/draft-07/schema#', 'definitions': { 'meta': { diff --git a/inventory_provider/tasks/monitor.py b/inventory_provider/tasks/monitor.py index 7d8a1d568419b36655c22eba5f85c2ac9c4109fa..258c751197ccc4ad584a31aab6e4973e97c71c28 100644 --- a/inventory_provider/tasks/monitor.py +++ b/inventory_provider/tasks/monitor.py @@ -23,7 +23,7 @@ from inventory_provider.tasks.common import _get_redis, get_current_redis logger = logging.getLogger(__name__) INFO_EVENT_TYPES = ('task-info', 'task-warning', 'task-error') LOG_ENTRY_SCHEMA = { - "$schema": "http://json-schema.org/draft-07/schema#", + "$schema": "https://json-schema.org/draft-07/schema#", "type": "object", "properties": { "uuid": {"type": "string"},