Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Nounous
re2o
Commits
c76a5d23
Commit
c76a5d23
authored
Jan 01, 2019
by
Maxime Bombar
Committed by
chirac
Jan 01, 2019
Browse files
Prevents from crashing where there is no defined prefix_v6
parent
de068f6c
Changes
1
Show whitespace changes
Inline
Side-by-side
machines/models.py
View file @
c76a5d23
...
...
@@ -1380,7 +1380,10 @@ class Ipv6List(RevMixin, AclMixin, FieldPermissionModelMixin, models.Model):
.
filter
(
interface
=
self
.
interface
,
slaac_ip
=
True
)
.
exclude
(
id
=
self
.
id
)):
raise
ValidationError
(
_
(
"A SLAAC IP address is already registered."
))
try
:
prefix_v6
=
self
.
interface
.
type
.
ip_type
.
prefix_v6
.
encode
().
decode
(
'utf-8'
)
except
AttributeError
:
# Prevents from crashing when there is no defined prefix_v6
prefix_v6
=
None
if
prefix_v6
:
if
(
IPv6Address
(
self
.
ipv6
.
encode
().
decode
(
'utf-8'
)).
exploded
[:
20
]
!=
IPv6Address
(
prefix_v6
).
exploded
[:
20
]):
...
...
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