Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE3
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
5
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
bacf18e7
authored
Jul 26, 2022
by
Karsa Zoltán István
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
validation error message
parent
c486bc51
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
2 deletions
+22
-2
circle/dashboard/validators.py
+21
-2
circle/dashboard/views/vm.py
+1
-0
No files found.
circle/dashboard/validators.py
View file @
bacf18e7
...
@@ -24,6 +24,7 @@ import yaml
...
@@ -24,6 +24,7 @@ import yaml
from
vm.models
import
Instance
from
vm.models
import
Instance
rng_file
=
"/usr/share/libvirt/schemas/domain.rng"
rng_file
=
"/usr/share/libvirt/schemas/domain.rng"
# Mandatory xml elements dor parsing
# Mandatory xml elements dor parsing
...
@@ -57,14 +58,32 @@ def meta_data_validator(value):
...
@@ -57,14 +58,32 @@ def meta_data_validator(value):
try
:
try
:
Instance
.
validate_meta_data
(
value
)
Instance
.
validate_meta_data
(
value
)
except
yaml
.
YAMLError
as
exc
:
except
yaml
.
YAMLError
as
exc
:
raise
ValidationError
(
exc
.
problem_mark
)
if
hasattr
(
exc
,
'problem_mark'
):
if
exc
.
context
!=
None
:
raise
ValidationError
(
' parser says
\n
'
+
str
(
exc
.
problem_mark
)
+
'
\n
'
+
str
(
exc
.
problem
)
+
' '
+
str
(
exc
.
context
)
+
'
\n
Please correct data and retry.'
)
else
:
raise
ValidationError
(
' parser says
\n
'
+
str
(
exc
.
problem_mark
)
+
'
\n
'
+
str
(
exc
.
problem
)
+
'
\n
Please correct data and retry.'
)
else
:
raise
ValidationError
(
"Something went wrong while parsing yaml file"
)
def
user_data_validator
(
value
):
def
user_data_validator
(
value
):
try
:
try
:
Instance
.
validate_user_data
(
value
)
Instance
.
validate_user_data
(
value
)
except
yaml
.
YAMLError
as
exc
:
except
yaml
.
YAMLError
as
exc
:
raise
ValidationError
(
exc
.
problem_mark
)
if
hasattr
(
exc
,
'problem_mark'
):
if
exc
.
context
!=
None
:
raise
ValidationError
(
' parser says
\n
'
+
str
(
exc
.
problem_mark
)
+
'
\n
'
+
str
(
exc
.
problem
)
+
' '
+
str
(
exc
.
context
)
+
'
\n
Please correct data and retry.'
)
else
:
raise
ValidationError
(
' parser says
\n
'
+
str
(
exc
.
problem_mark
)
+
'
\n
'
+
str
(
exc
.
problem
)
+
'
\n
Please correct data and retry.'
)
else
:
raise
ValidationError
(
"Something went wrong while parsing yaml file"
)
def
connect_command_template_validator
(
value
):
def
connect_command_template_validator
(
value
):
...
...
circle/dashboard/views/vm.py
View file @
bacf18e7
...
@@ -70,6 +70,7 @@ from ..forms import (
...
@@ -70,6 +70,7 @@ from ..forms import (
VmRemoveInterfaceForm
,
VmRemoveInterfaceForm
,
VmRenameForm
,
VmRenameForm
,
)
)
from
django.views.generic.edit
import
FormMixin
from
request.models
import
TemplateAccessType
,
LeaseType
from
request.models
import
TemplateAccessType
,
LeaseType
from
request.forms
import
LeaseRequestForm
,
TemplateRequestForm
from
request.forms
import
LeaseRequestForm
,
TemplateRequestForm
from
..models
import
Favourite
from
..models
import
Favourite
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment