mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
pep8
This commit is contained in:
parent
0496ba7a00
commit
08d2e10cb9
@ -103,10 +103,10 @@ class CsAcl(CsDataBag):
|
||||
rnge = ''
|
||||
if "first_port" in self.rule.keys() and \
|
||||
self.rule['first_port'] == self.rule['last_port']:
|
||||
rnge = self.rule['first_port']
|
||||
rnge = self.rule['first_port']
|
||||
if "first_port" in self.rule.keys() and \
|
||||
self.rule['first_port'] != self.rule['last_port']:
|
||||
rnge = "%s:%s" % (rule['first_port'], rule['last_port'])
|
||||
rnge = "%s:%s" % (rule['first_port'], rule['last_port'])
|
||||
if self.direction == 'ingress':
|
||||
if rule['protocol'] == "icmp":
|
||||
self.fw.append(["mangle", "front",
|
||||
@ -136,7 +136,7 @@ class CsAcl(CsDataBag):
|
||||
if rule['protocol'] != "all":
|
||||
fwr += "-p %s " % rule['protocol'] + \
|
||||
" -m %s " % rule['protocol'] + \
|
||||
" --dport %s" % rnge
|
||||
" --dport %s" % rnge
|
||||
self.fw.append(["filter", "front", "%s -j %s" % (fwr, rule['action'])])
|
||||
|
||||
class AclDevice():
|
||||
@ -172,7 +172,6 @@ class CsAcl(CsDataBag):
|
||||
else:
|
||||
self.init_vr(self, direction, acl, rule, config)
|
||||
|
||||
|
||||
def init_vpc(self, direction, acl, rule, config):
|
||||
self.table = ""
|
||||
self.device = acl.device
|
||||
|
||||
@ -18,14 +18,15 @@
|
||||
from pprint import pprint
|
||||
import copy
|
||||
|
||||
|
||||
def merge(dbag, data):
|
||||
dbagc = copy.deepcopy(dbag)
|
||||
dbagc = copy.deepcopy(dbag)
|
||||
if "rules" not in data:
|
||||
return dbagc
|
||||
for rule in data['rules']:
|
||||
id = str(rule['id'])
|
||||
id = str(rule['id'])
|
||||
if rule['revoked']:
|
||||
del(dbagc[id])
|
||||
del(dbagc[id])
|
||||
if id not in dbagc.keys():
|
||||
dbagc[id] = rule
|
||||
dbagc[id] = rule
|
||||
return dbagc
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user