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
e955e9f5
Commit
e955e9f5
authored
1 year ago
by
Hakan Calim
Committed by
Neda Moeini
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
NAT-328
: updated validation site name by an utils method
parent
0aaf331a
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!97
Feature/nat 328 site names should be validated
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
gso/workflows/site/create_site.py
+8
-11
8 additions, 11 deletions
gso/workflows/site/create_site.py
with
8 additions
and
11 deletions
gso/workflows/site/create_site.py
+
8
−
11
View file @
e955e9f5
import
re
from
orchestrator.forms
import
FormPage
from
orchestrator.targets
import
Target
from
orchestrator.types
import
FormGenerator
,
State
,
SubscriptionLifecycle
,
UUIDstr
...
...
@@ -13,7 +11,12 @@ 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.utils.helpers
import
validate_country_code
,
validate_ipv4_or_ipv6
,
validate_site_fields_is_unique
from
gso.utils.helpers
import
(
validate_country_code
,
validate_ipv4_or_ipv6
,
validate_site_fields_is_unique
,
validate_site_name
,
)
def
initial_input_form_generator
(
product_name
:
str
)
->
FormGenerator
:
# noqa: C901
...
...
@@ -56,14 +59,8 @@ def initial_input_form_generator(product_name: str) -> FormGenerator: # noqa: C
by an optional single digit (0-9).
"""
validate_site_fields_is_unique
(
"
site_name
"
,
site_name
)
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).
"
)
validate_site_name
(
site_name
)
return
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