Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gyuricska Milán
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
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
82514d62
authored
May 16, 2013
by
Bence Dányi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
firewall_gui: save hostgroups of hosts
parent
bd2cb60b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
1 deletions
+12
-1
firewall_gui/views.py
+12
-1
No files found.
firewall_gui/views.py
View file @
82514d62
...
...
@@ -460,6 +460,18 @@ def save_host(request):
host
.
location
=
data
[
'location'
]
set_field
(
host
,
'vlan'
,
errors
,
name
=
data
[
'vlan'
][
'name'
])
set_field
(
host
,
'owner'
,
errors
,
username
=
data
[
'owner'
][
'name'
])
for
host
in
data
[
'vlans'
]:
try
:
if
'__destroyed'
in
host
and
host
[
'__destroyed'
]:
host_object
=
Vlan
.
objects
.
get
(
name
=
host
[
'name'
])
vlan
.
snat_to
.
remove
(
host_object
)
elif
'__created'
in
host
and
host
[
'__created'
]:
host_object
=
Vlan
.
objects
.
get
(
name
=
host
[
'name'
])
vlan
.
snat_to
.
add
(
host_object
)
except
Exception
as
e
:
errors
[
'vlans'
]
=
(
'Host with the name "
%(name)
s" does not exists!'
)
%
{
'name'
:
host
[
'name'
]
}
try
:
host
.
full_clean
()
except
Exception
as
e
:
...
...
@@ -554,7 +566,6 @@ def save_hostgroup(request):
errors
=
{}
hostgroup
.
name
=
data
[
'name'
]
hostgroup
.
description
=
data
[
'description'
]
# TODO: save hosts
set_field
(
hostgroup
,
'owner'
,
errors
,
username
=
data
[
'owner'
][
'name'
])
try
:
hostgroup
.
full_clean
()
...
...
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