Skip to content
  • P
    Projects
  • G
    Groups
  • S
    Snippets
  • Help

CIRCLE / cloud

  • This project
    • Loading...
  • Sign in
Go to a project
  • Project
  • Repository
  • Issues 94
  • Merge Requests 10
  • Pipelines
  • Wiki
  • Snippets
  • Members
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Merged
Merge request !352 opened Aug 31, 2015 by Czémán Arnold@cemiarni 
  • Report abuse
Report abuse

add_rule command for firewall

  • Discussion 3
  • Commits 9
  • Changes
{{ resolvedDiscussionCount }}/{{ discussionCount }} {{ resolvedCountText }} resolved
  • Bach Dániel
    @bachdaniel started a discussion on commit aa12028e Aug 17, 2015
    circle/firewall/management/commands/add_rule.py 0 → 100644
    101 self.add_rule(port, 'udp', action, dir, owner, vlan, fnet)
    102
    103 def add_rule(self, port, proto, action, dir, owner, vlan, fnet):
    104
    105 if self.is_exist(port, proto, action, dir, owner, vlan, fnet):
    106 raise CommandError('Rule does exist, yet')
    107
    108 rule = Rule(direction=dir, dport=port, proto=proto, action=action,
    109 vlan=vlan, foreign_network=fnet, owner=owner)
    110
    111 rule.save()
    112
    113 def is_exist(self, port, proto, action, dir, owner, vlan, fnet):
    114
    115 try:
    116 Rule.objects.get(direction=dir, dport=port, proto=proto,
    • Bach Dániel @bachdaniel commented Aug 17, 2015
      Owner

      Rule.objects.filter(blabla='szia').exists()

      Rule.objects.filter(blabla='szia').exists()
    Please register or sign in to reply
  • Bach Dániel
    @bachdaniel started a discussion on commit aa12028e Aug 17, 2015
    circle/firewall/management/commands/add_rule.py 0 → 100644
    95 raise CommandError("VlanGroup '%s' does not exist" % fnet)
    96
    97 if proto:
    98 self.add_rule(port, proto, action, dir, owner, vlan, fnet)
    99 else:
    100 self.add_rule(port, 'tcp', action, dir, owner, vlan, fnet)
    101 self.add_rule(port, 'udp', action, dir, owner, vlan, fnet)
    102
    103 def add_rule(self, port, proto, action, dir, owner, vlan, fnet):
    104
    105 if self.is_exist(port, proto, action, dir, owner, vlan, fnet):
    106 raise CommandError('Rule does exist, yet')
    107
    108 rule = Rule(direction=dir, dport=port, proto=proto, action=action,
    109 vlan=vlan, foreign_network=fnet, owner=owner)
    110
    • Bach Dániel @bachdaniel commented Aug 17, 2015
      Owner

      rule.full_clean()

      rule.full_clean()
    Please register or sign in to reply
  • Bach Dániel
    @bachdaniel started a discussion on an old version of the diff Mar 02, 2016
    circle/firewall/management/commands/add_rule.py 0 → 100644
    120
    121 rules = []
    122
    123 for port in xrange(lower, higher+1):
    124 try:
    125 rule = self.make_rule(port, proto, action, dir,
    126 owner, firewall, fnet)
    127 rules.append(rule)
    128 except Warning as e:
    129 logger.warning(e)
    130
    131 Rule.objects.bulk_create(rules)
    132
    133 def make_rule(self, port, proto, action, dir, owner, firewall, fnet):
    134
    135 rule = Rule(direction=dir, dport=port, proto=proto, action=action,
    • Bach Dániel @bachdaniel commented Mar 02, 2016
      Owner

      rule, created = Rule.objects.get_or_create(**kwargs)

      rule, created = Rule.objects.get_or_create(**kwargs)
    Please register or sign in to reply
  • Czémán Arnold @cemiarni

    Added 1 commit:

    • c7fd2925 - firewall: rework make_rule method in add_rule command
    Mar 03, 2016

    Added 1 commit:

    • c7fd2925 - firewall: rework make_rule method in add_rule command
    Added 1 commit: * c7fd2925 - firewall: rework make_rule method in add_rule command
    Toggle commit list
  • Czémán Arnold @cemiarni

    Added 37 commits:

    • c7fd2925...dad93220 - 36 commits from branch master
    • 10261b9a - Merge branch 'master' of https://git.ik.bme.hu/circle/cloud into add_rule
    Mar 03, 2016

    Added 37 commits:

    • c7fd2925...dad93220 - 36 commits from branch master
    • 10261b9a - Merge branch 'master' of https://git.ik.bme.hu/circle/cloud into add_rule
    Added 37 commits: * c7fd2925...dad93220 - 36 commits from branch `master` * 10261b9a - Merge branch 'master' of https://git.ik.bme.hu/circle/cloud into add_rule
    Toggle commit list
  • Czémán Arnold @cemiarni

    Status changed to closed

    Mar 03, 2016

    Status changed to closed

    Status changed to closed
    Toggle commit list
  • Czémán Arnold @cemiarni

    Status changed to reopened

    Mar 03, 2016

    Status changed to reopened

    Status changed to reopened
    Toggle commit list
  • Kálmán Viktor @kviktor

    Status changed to merged

    Mar 03, 2016

    Status changed to merged

    Status changed to merged
    Toggle commit list
  • Kálmán Viktor @kviktor

    mentioned in commit cbcbb8e6

    Mar 03, 2016

    mentioned in commit cbcbb8e6

    mentioned in commit cbcbb8e60c512813d81f1b7eecb43d1cb670eb28
    Toggle commit list
  • Write
  • Preview
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment
Assignee
No assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
0
Labels
None
Assign labels
  • View labels
3
3 participants
Reference: circle/cloud!352
×

Revert this merge request

Switch branch
Cancel
A new branch will be created in your fork and a new merge request will be started.
×

Cherry-pick this merge request

Switch branch
Cancel
A new branch will be created in your fork and a new merge request will be started.