#!/usr/bin/env python
# -*- coding: utf-8 -*-
# +--------------------------------------------------------------------------+
# | OpenFW UTM Community                                                     |
# +--------------------------------------------------------------------------+

from optparse import OptionParser

from endian.job.engine_control import send_cmd_to_engine


def main():
    usage = "usage: %prog <options>"
    parser = OptionParser(usage)    

    parser.add_option("-d", "--debug", dest="debug", action="store_true",
                      help="Be more verbose.", default=False)
    parser.add_option("-f", "--force", dest="force", action="store_true",
                      help="Forces update.", default=False)
    parser.add_option("-p", "--no_pre", dest="no_pre", action="store_true",
                      help="Skip pre hook.", default=False)
    parser.add_option("-c", "--no_post_un_compress",
                      dest="no_post_un_compress", action="store_true",
                      help="Skip post_un_compress hook.", default=False)
    parser.add_option("-o", "--no_post", dest="no_post", action="store_true",
                      help="Skip post hook.", default=False)
    parser.add_option("-t", "--tmp_dir", dest="tmp_dir", metavar="FILE",
                      help="Use this dir as temporary directory", default=False)
    parser.add_option("-u", "--http_username", dest="http_username", metavar="FILE",
                      help="Use this username for http authentication", default=False)
    parser.add_option("-x", "--http_password", dest="http_password", metavar="FILE",
                      help="Use this password for http authentication", default=False)

    (options, args) = parser.parse_args()
    
    send_cmd_to_engine("restart urlfilterlistsupdate", options=options)


if __name__ == "__main__":
    main()
