Skip to content
Snippets Groups Projects
Commit 91e16db4 authored by JORGE SASIAIN's avatar JORGE SASIAIN
Browse files

Address SonarQube duplicated lines in create_site.py

parent 12dbf6d4
No related branches found
No related tags found
1 merge request!112Address SonarQube code smells
...@@ -43,7 +43,6 @@ def initial_input_form_generator(product_name: str) -> FormGenerator: ...@@ -43,7 +43,6 @@ def initial_input_form_generator(product_name: str) -> FormGenerator:
@validator("site_ts_address", allow_reuse=True) @validator("site_ts_address", allow_reuse=True)
def validate_ts_address(cls, site_ts_address: str) -> str: def validate_ts_address(cls, site_ts_address: str) -> str:
"""Validate that a terminal server address is valid.""" """Validate that a terminal server address is valid."""
validate_site_fields_is_unique("site_ts_address", site_ts_address)
validate_ipv4_or_ipv6(site_ts_address) validate_ipv4_or_ipv6(site_ts_address)
return site_ts_address return site_ts_address
...@@ -53,7 +52,7 @@ def initial_input_form_generator(product_name: str) -> FormGenerator: ...@@ -53,7 +52,7 @@ def initial_input_form_generator(product_name: str) -> FormGenerator:
validate_country_code(country_code) validate_country_code(country_code)
return country_code return country_code
@validator("site_internal_id", "site_bgp_community_id", allow_reuse=True) @validator("site_ts_address", "site_internal_id", "site_bgp_community_id", "site_name", allow_reuse=True)
def validate_unique_fields(cls, value: str, field: ModelField) -> str | int: def validate_unique_fields(cls, value: str, field: ModelField) -> str | int:
"""Validate that the internal and :term:`BGP` community IDs are unique.""" """Validate that the internal and :term:`BGP` community IDs are unique."""
return validate_site_fields_is_unique(field.name, value) return validate_site_fields_is_unique(field.name, value)
...@@ -64,7 +63,6 @@ def initial_input_form_generator(product_name: str) -> FormGenerator: ...@@ -64,7 +63,6 @@ def initial_input_form_generator(product_name: str) -> FormGenerator:
The site name must consist of three uppercase letters, followed by an optional single digit. The site name must consist of three uppercase letters, followed by an optional single digit.
""" """
validate_site_fields_is_unique("site_name", site_name)
validate_site_name(site_name) validate_site_name(site_name)
return site_name return site_name
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment