Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Fukász Rómeó Ervin
/
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
742b9423
authored
Mar 01, 2014
by
Bach Dániel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
firewall: fix Host.save()
parent
f5d3ce91
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
15 deletions
+15
-15
circle/firewall/models.py
+15
-15
No files found.
circle/firewall/models.py
View file @
742b9423
...
...
@@ -540,36 +540,36 @@ class Host(models.Model):
super
(
Host
,
self
)
.
save
(
*
args
,
**
kwargs
)
# IPv4
if
self
.
ipv4
is
not
None
:
Record
.
objects
.
filter
(
host
=
self
,
name
=
self
.
hostname
,
# update existing records
affected_records
=
Record
.
objects
.
filter
(
host
=
self
,
name
=
self
.
hostname
,
type
=
'A'
)
.
update
(
address
=
self
.
ipv4
)
record_count
=
self
.
record_set
.
filter
(
host
=
self
,
name
=
self
.
hostname
,
address
=
self
.
ipv4
,
type
=
'A'
)
.
count
()
if
record_count
==
0
:
# create new record
if
affected_records
==
0
:
Record
(
host
=
self
,
name
=
self
.
hostname
,
domain
=
self
.
vlan
.
domain
,
address
=
self
.
ipv4
,
owner
=
self
.
owner
,
description
=
'host.save()'
,
description
=
'
created by
host.save()'
,
type
=
'A'
)
.
save
()
if
self
.
ipv6
:
Record
.
objects
.
filter
(
host
=
self
,
name
=
self
.
hostname
,
# IPv6
if
self
.
ipv6
is
not
None
:
# update existing records
affected_records
=
Record
.
objects
.
filter
(
host
=
self
,
name
=
self
.
hostname
,
type
=
'AAAA'
)
.
update
(
address
=
self
.
ipv6
)
record_count
=
self
.
record_set
.
filter
(
host
=
self
,
name
=
self
.
hostname
,
address
=
self
.
ipv6
,
type
=
'AAAA'
)
.
count
()
if
record_count
==
0
:
# create new record
if
affected_records
==
0
:
Record
(
host
=
self
,
name
=
self
.
hostname
,
domain
=
self
.
vlan
.
domain
,
address
=
self
.
ipv6
,
owner
=
self
.
owner
,
description
=
'host.save()'
,
description
=
'
created by
host.save()'
,
type
=
'AAAA'
)
.
save
()
def
enable_net
(
self
):
...
...
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