Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
1471faf0
authored
Jan 31, 2013
by
Őry Máté
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
firewall: fix #28
parent
f3a566cf
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
0 deletions
+13
-0
firewall/models.py
+13
-0
No files found.
firewall/models.py
View file @
1471faf0
...
@@ -120,6 +120,12 @@ class Alias(models.Model):
...
@@ -120,6 +120,12 @@ class Alias(models.Model):
created_at
=
models
.
DateTimeField
(
auto_now_add
=
True
)
created_at
=
models
.
DateTimeField
(
auto_now_add
=
True
)
modified_at
=
models
.
DateTimeField
(
auto_now
=
True
)
modified_at
=
models
.
DateTimeField
(
auto_now
=
True
)
def
clean
(
self
):
# FIXME later: critical race condition
for
h
in
Host
.
objects
:
if
h
.
get_fqdn
()
==
self
.
alias
:
raise
ValidationError
(
_
(
"Host name already used."
))
class
Meta
:
class
Meta
:
verbose_name_plural
=
'aliases'
verbose_name_plural
=
'aliases'
...
@@ -182,6 +188,13 @@ class Host(models.Model):
...
@@ -182,6 +188,13 @@ class Host(models.Model):
def
get_fqdn
(
self
):
def
get_fqdn
(
self
):
return
self
.
hostname
+
u'.'
+
self
.
vlan
.
domain
return
self
.
hostname
+
u'.'
+
self
.
vlan
.
domain
def
clean
(
self
):
# FIXME later: critical race condition
for
a
in
Alias
.
objects
:
if
self
.
get_fqdn
()
==
a
.
alias
:
raise
ValidationError
(
_
(
"Host name already used as alias."
))
class
Firewall
(
models
.
Model
):
class
Firewall
(
models
.
Model
):
name
=
models
.
CharField
(
max_length
=
20
,
unique
=
True
)
name
=
models
.
CharField
(
max_length
=
20
,
unique
=
True
)
...
...
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