You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

26 lines
732 B

#!/usr/bin/env python3
import sys
from redis import Redis
from rq import Queue
from django.utils.translation import ugettext as _
def die(text):
print(text)
exit(1)
if __name__ == "__main__":
argv = sys.argv
if len(argv) < 3:
die(_('Too few arguments, exiting...'))
action = argv[1]
q = Queue(connection=Redis())
if action == 'commit':
if len(argv) < 6:
die(_('Too few arguments, exiting...'))
q.enqueue('agent.commands.dhcp.dhcp_commit', argv[2], argv[3], argv[4], int(argv[5]))
elif action == 'expiry':
q.enqueue('agent.commands.dhcp.dhcp_expiry', argv[2])
elif action == 'release':
q.enqueue('agent.commands.dhcp.dhcp_release', argv[2])