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
Commits
7cd6e1e0
Commit
7cd6e1e0
authored
1 year ago
by
Hakan Calim
Browse files
Options
Downloads
Patches
Plain Diff
NAT-328
: updated validation site name by an utils method
parent
70780c81
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
gso/workflows/site/create_site.py
+2
-7
2 additions, 7 deletions
gso/workflows/site/create_site.py
with
2 additions
and
7 deletions
gso/workflows/site/create_site.py
+
2
−
7
View file @
7cd6e1e0
import
ipaddress
import
re
from
typing
import
NoReturn
import
pycountry
...
...
@@ -15,6 +14,7 @@ from gso.products.product_blocks import site as site_pb
from
gso.products.product_blocks.site
import
LatitudeCoordinate
,
LongitudeCoordinate
from
gso.products.product_types
import
site
from
gso.services.crm
import
customer_selector
from
gso.util.helpers
import
validate_site_name
def
initial_input_form_generator
(
product_name
:
str
)
->
FormGenerator
:
# noqa: C901
...
...
@@ -52,12 +52,7 @@ def initial_input_form_generator(product_name: str) -> FormGenerator: # noqa: C
@validator
(
"
site_name
"
,
allow_reuse
=
True
)
def
site_name_must_be_valid
(
cls
,
site_name
:
str
)
->
str
|
NoReturn
:
# Accept 3 chapital letters and only one ditigt after capital letters.
pattern
=
re
.
compile
(
r
"
^[A-Z]{3}[0-9]?$
"
)
if
not
bool
(
pattern
.
match
(
site_name
)):
raise
ValueError
(
f
"
Enter a valid site name similar looks like AMS, AMS1or LON9. Get:
{
site_name
}
"
)
return
site_name
return
validate_site_name
(
site_name
)
user_input
=
yield
CreateSiteForm
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment