Commit d59f5827 by Bach Dániel

random fixes

parent 3c7d5c26
......@@ -7,13 +7,13 @@ import socket
from ovs import Switch
IRC_CHANNEL = getenv('IRC_CHANNEL', '/home/cloud/irc/irc.atw.hu/#ik/in')
DHCP_LOGFILE = getenv('DHCP_LOGFILE', '/home/cloud/dhcp.log')
DHCP_LOGFILE = getenv('DHCP_LOGFILE', '/var/log/syslog')
VLAN_CONF = getenv('VLAN_CONF', 'vlan.conf')
FIREWALL_CONF = getenv('FIREWALL_CONF', 'firewall.conf')
celery = Celery('tasks', backend='amqp', )
celery.conf.update(CELERY_TASK_RESULT_EXPIRES=3600,
celery.conf.update(CELERY_TASK_RESULT_EXPIRES=300,
BROKER_URL=getenv("AMQP_URI"),
CELERY_CREATE_MISSING_QUEUES=True)
......@@ -46,7 +46,7 @@ def reload_firewall_vlan(data, onstart=False):
if onstart is False:
with open(VLAN_CONF, 'w') as f:
json.dump(data, f)
subprocess.call("/sbin/ip ro add default via 10.7.255.254", shell=True)
@task(name="firewall.reload_dhcp")
def reload_dhcp(data):
......@@ -135,7 +135,7 @@ dhcp_no_free_re = re.compile(r'\S DHCPDISCOVER '
# r'(\((?P<hostnamename>[^)]+)\) )?'
@task(name="firewall.tasks.get_dhcp_clients_task")
@task(name="firewall.get_dhcp_clients")
def get_dhcp_clients():
clients = {}
......@@ -152,7 +152,7 @@ def get_dhcp_clients():
ip = m.get('ip', None)
hostname = m.get('hostname', None)
interface = m.get('interface', None)
clients[mac] = (ip, hostname, interface)
clients[mac] = {'ip': ip, 'hostname': hostname, 'interface': interface}
return clients
......
......@@ -5,12 +5,14 @@ stop on runlevel [!2345]
respawn
respawn limit 30 30
setuid cloud
env USER=firewall
setgid firewall
setuid firewall
chdir /home/cloud/fwdriver
script
. /home/cloud/.virtualenvs/fwdriver/local/bin/postactivate
exec /home/cloud/.virtualenvs/fwdriver/bin/celeryd -A fw -Q firewall --loglevel=info --logfile=/tmp/fwcelery.log
cd /home/$USER/fwdriver
. /home/$USER/.virtualenvs/fwdriver/local/bin/postactivate
exec /home/$USER/.virtualenvs/fwdriver/bin/celeryd -A fw -Q firewall --loglevel=info
end script
......@@ -135,7 +135,8 @@ class Switch:
logging.debug('[ovs] add: %s' % (add, ))
for i in delete:
self.delete_port(i)
if not i.startswith('gre'):
self.delete_port(i)
for i in add:
internal = new_ports[i].get('type', '') == 'internal'
tag = new_ports[i]['tag']
......
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