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
16213292
authored
Dec 06, 2013
by
Őry Máté
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
firewall: don't fail if default_vlangroup is missing
parent
9fee2104
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
13 deletions
+19
-13
circle/firewall/models.py
+19
-13
No files found.
circle/firewall/models.py
View file @
16213292
...
@@ -536,20 +536,26 @@ class Host(models.Model):
...
@@ -536,20 +536,26 @@ class Host(models.Model):
else
:
else
:
public
=
self
.
_get_random_port
(
proto
)
public
=
self
.
_get_random_port
(
proto
)
vg
=
VlanGroup
.
objects
.
get
(
name
=
settings
[
"default_vlangroup"
])
try
:
if
self
.
shared_ip
:
vgname
=
settings
[
"default_vlangroup"
]
if
public
<
1024
:
vg
=
VlanGroup
.
objects
.
get
(
name
=
vgname
)
raise
ValidationError
(
_
(
"Only ports above 1024 can be used."
))
except
VlanGroup
.
DoesNotExist
as
e
:
rule
=
Rule
(
direction
=
'1'
,
owner
=
self
.
owner
,
dport
=
public
,
logger
.
error
(
'Host.add_port: default_vlangroup
%
s missing.
%
s'
,
proto
=
proto
,
nat
=
True
,
accept
=
True
,
vgname
,
unicode
(
e
))
nat_dport
=
private
,
host
=
self
,
foreign_network
=
vg
)
else
:
else
:
rule
=
Rule
(
direction
=
'1'
,
owner
=
self
.
owner
,
dport
=
private
,
if
self
.
shared_ip
:
proto
=
proto
,
nat
=
False
,
accept
=
True
,
if
public
<
1024
:
host
=
self
,
foreign_network
=
vg
)
raise
ValidationError
(
_
(
"Only ports above 1024 can be used."
))
rule
.
full_clean
()
rule
=
Rule
(
direction
=
'1'
,
owner
=
self
.
owner
,
dport
=
public
,
rule
.
save
()
proto
=
proto
,
nat
=
True
,
accept
=
True
,
nat_dport
=
private
,
host
=
self
,
foreign_network
=
vg
)
else
:
rule
=
Rule
(
direction
=
'1'
,
owner
=
self
.
owner
,
dport
=
private
,
proto
=
proto
,
nat
=
False
,
accept
=
True
,
host
=
self
,
foreign_network
=
vg
)
rule
.
full_clean
()
rule
.
save
()
def
del_port
(
self
,
proto
,
private
):
def
del_port
(
self
,
proto
,
private
):
"""
"""
...
...
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