Created wrapper class for ip addresses

This commit is contained in:
Cian Hughes
2023-11-08 11:30:55 +00:00
parent 68d5711c34
commit 1afd812773
4 changed files with 51 additions and 14 deletions

View File

@@ -1,5 +1,4 @@
from fnmatch import fnmatch
import ipaddress
from typing import Annotated, Optional
from docker.types import Mount
@@ -9,14 +8,10 @@ from .cli import cli_spinner
from .config import config
from .create_img import create_img
from .debug import debug_guard
from .ip_interface import IPAddress
from .utils import ensure_build_dir
# When PEP695 is supported this line should be:
# type IPAddress = ipaddress.IPv4Address | ipaddress.IPv6Address
IPAddress = ipaddress._IPAddressBase
def filter_validation_response(response: str) -> str:
"""Filters out erroneous warnings from the validation response
@@ -136,7 +131,7 @@ def create_ignition_disk(
"-ip",
help="IP address of the switch to connect to",
prompt=True,
parser=ipaddress.ip_address,
parser=IPAddress,
),
] = None,
switch_port: Annotated[