Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cisco_aci/datadog_checks/cisco_aci/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ class InterfaceMetadata(BaseModel):
admin_status: Optional[AdminStatus] = Field(default=None)
oper_status: Optional[OperStatus] = Field(default=None)
integration: Optional[str] = Field(default='cisco-aci')
is_physical: Optional[bool] = Field(default=None)

model_config = ConfigDict(validate_assignment=True, use_enum_values=True)

Expand Down
1 change: 1 addition & 0 deletions cisco_aci/datadog_checks/cisco_aci/ndm.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ def create_interface_metadata(phys_if, address, namespace):
description=eth.attributes.desc,
mac_address=eth.attributes.router_mac,
admin_status=eth.attributes.admin_st,
is_physical=True,
)
if eth.ethpm_phys_if:
interface.oper_status = eth.ethpm_phys_if.attributes.oper_st
Expand Down
9 changes: 9 additions & 0 deletions cisco_aci/tests/fixtures/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@
'name': 'eth1/1',
'oper_status': 1,
'status': 'up',
'is_physical': True,
},
{
'admin_status': 1,
Expand All @@ -160,6 +161,7 @@
'name': 'eth1/2',
'oper_status': 1,
'status': 'up',
'is_physical': True,
},
{
'admin_status': 1,
Expand All @@ -175,6 +177,7 @@
'name': 'eth1/3',
'oper_status': 2,
'status': 'down',
'is_physical': True,
},
{
'admin_status': 1,
Expand All @@ -190,6 +193,7 @@
'name': 'eth1/1',
'oper_status': 1,
'status': 'up',
'is_physical': True,
},
{
'admin_status': 1,
Expand All @@ -205,6 +209,7 @@
'name': 'eth1/2',
'oper_status': 1,
'status': 'up',
'is_physical': True,
},
{
'admin_status': 1,
Expand All @@ -220,6 +225,7 @@
'name': 'eth1/3',
'oper_status': 2,
'status': 'down',
'is_physical': True,
},
{
'admin_status': 1,
Expand All @@ -235,6 +241,7 @@
'name': 'eth5/1',
'oper_status': 1,
'status': 'up',
'is_physical': True,
},
{
'admin_status': 1,
Expand All @@ -250,6 +257,7 @@
'name': 'eth5/2',
'oper_status': 1,
'status': 'up',
'is_physical': True,
},
{
'admin_status': 1,
Expand All @@ -265,6 +273,7 @@
'name': 'eth7/1',
'oper_status': 2,
'status': 'down',
'is_physical': True,
},
]

Expand Down
4 changes: 4 additions & 0 deletions coredns/assets/configuration/spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ files:
See documentation: https://docs.datadoghq.com/integrations/coredns

enabled: true
legacy: true
value:
type: string
example: "http://%%host%%:9153/metrics"
Expand All @@ -63,13 +64,15 @@ files:
- "dns-pod:%%host%%"
- name: send_histograms_buckets
description: (Legacy OpenMetricsBaseCheckV1) Set send_histograms_buckets to true to send the histograms bucket.
legacy: true
value:
type: boolean
example: True
- name: send_monotonic_counter
description: |
(Legacy OpenMetricsBaseCheckV1) To send counters as monotonic counter
see: https://github.com/DataDog/integrations-core/issues/1303
legacy: true
value:
type: boolean
example: True
Expand All @@ -79,6 +82,7 @@ files:
are enabled by default, however in order to scrape metrics for optional
plugins, enable the plugin in the CoreDNS corefile and then add the metric below.
As an example, the 'template' plugin's metrics are below
legacy: true
value:
type: array
items:
Expand Down
1 change: 1 addition & 0 deletions ddev/changelog.d/22559.fixed
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Improve license parsing in validation
44 changes: 37 additions & 7 deletions ddev/src/ddev/cli/validate/licenses.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,22 @@
# Licensed under a 3-clause BSD style license (see LICENSE)
from __future__ import annotations

import re
from typing import TYPE_CHECKING

import click

if TYPE_CHECKING:
from ddev.cli.application import Application

# Split license expressions on operators (AND, OR, and/or) and separators (/, +).
# Use negative lookbehind (?<!-) and lookahead (?!-) to avoid matching "-or-" or "-and-"
# inside SPDX identifiers like "GPL-2.0-or-later" or "LGPL-2.1-or-later".
_OP_SPLIT = re.compile(r'\s*(?:(?<!-)\b(?:AND|OR)\b(?!-)|/|\+|\band/or\b)\s*', re.IGNORECASE)
# SPDX ids are typically: letters/digits plus . + -
# and may appear as LicenseRef-* / DocumentRef-*:LicenseRef-*
_ID = re.compile(r"(DocumentRef-[A-Za-z0-9.+-]+:)?LicenseRef-[A-Za-z0-9.+-]+|[A-Za-z0-9.+-]+")


def format_attribution_line(package_name, license_id, package_copyright):
if ',' in package_copyright:
Expand Down Expand Up @@ -330,6 +339,33 @@ def read_file_lines(file, encoding='utf-8'):
return f.readlines()


def split_license_expression_simple(expr: str) -> list[str]:
# Normalize parens to spaces
expr = expr.replace("(", " ").replace(")", " ")

parts: list[str] = []
for chunk in _OP_SPLIT.split(expr):
chunk = chunk.strip()
if not chunk:
continue

# Handle "WITH" exceptions by taking the left side license id.
chunk = re.split(r"\s+\bWITH\b\s+", chunk, flags=re.IGNORECASE)[0].strip()

# Extract tokens; keep ones that look like SPDX-ish ids
chunk_start_len = len(parts)
for token in _ID.findall(chunk):
if token:
parts.append(token if isinstance(token, str) else token[0])
if len(parts) == chunk_start_len:
# If we couldn't extract any ID from this chunk, try to use the whole chunk
# as a fallback, stripping any remaining noise.
fallback = re.sub(r'\s+', ' ', chunk).strip()
if fallback:
parts.append(fallback)
return parts


@click.command(short_help='Validate third-party license list')
@click.option('--sync', '-s', is_flag=True, help='Generate the `LICENSE-3rdparty.csv` file')
@click.pass_obj
Expand Down Expand Up @@ -420,13 +456,7 @@ def licenses(app: Application, sync: bool):
for package_license in data['licenses']:
package_license = package_license.strip('"')

expanded_licenses = []
for separator in (' and/or ', '/', ' OR ', ' or '):
if separator in package_license:
expanded_licenses.extend(package_license.split(separator))
break
else:
expanded_licenses.append(package_license)
expanded_licenses = split_license_expression_simple(package_license)

for expanded_license in expanded_licenses:
normalized_license = expanded_license.lower()
Expand Down
1 change: 1 addition & 0 deletions etcd/assets/configuration/spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ files:
- template: instances
options:
- name: use_preview
legacy: true
description: |
Deprecated and unused. The Prometheus-based check is the default and only implementation.
hidden: true
Expand Down
2 changes: 2 additions & 0 deletions mongo/assets/configuration/spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ files:
type: object
properties: []
- name: dbnames
legacy: true
deprecation:
Agent version: "7.56.0"
Migration: |
Expand Down Expand Up @@ -637,6 +638,7 @@ files:
type: string
example: mydocdb
- name: server
legacy: true
deprecation:
Agent version: "8.0.0"
Migration: |
Expand Down
Loading