Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
GÉANT Service Orchestrator
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GÉANT Orchestration and Automation Team
GAP
GÉANT Service Orchestrator
Merge requests
!97
Feature/nat 328 site names should be validated
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Feature/nat 328 site names should be validated
feature/NAT-328-Site-names-should-be-validated
into
develop
Overview
0
Commits
19
Pipelines
8
Changes
1
Merged
Hakan Calim
requested to merge
feature/NAT-328-Site-names-should-be-validated
into
develop
1 year ago
Overview
0
Commits
19
Pipelines
8
Changes
1
Expand
0
0
Merge request reports
Viewing commit
0aaf331a
Prev
Next
Show latest version
1 file
+
15
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
0aaf331a
NAT-328
: Moved the site name validation to this file
· 0aaf331a
Hakan Calim
authored
1 year ago
gso/utils/helpers.py
+
15
−
0
Options
@@ -179,3 +179,18 @@ def validate_country_code(country_code: str) -> str:
return
country_code
except
LookupError
:
raise
ValueError
(
"
Invalid or non-existent country code, it must be in ISO 3166-1 alpha-2 format.
"
)
def
validate_site_name
(
site_name
:
str
)
->
str
:
"""
Validate the site name.
The site name must consist of three uppercase letters (A-Z) followed by an optional single digit (0-9).
"""
pattern
=
re
.
compile
(
r
"
^[A-Z]{3}[0-9]?$
"
)
if
pattern
.
match
(
site_name
):
return
site_name
else
:
raise
ValueError
(
"
Enter a valid site name. It must consist of three uppercase letters (A-Z) followed by an optional single
"
"
digit (0-9).
"
)
Loading