import repository from arizona
[raven.git] / apps / stork / storkmetapoll.py
1 #! /usr/bin/env python
2 """
3 <Program Name>
4    storkrepodl.py
5
6 <Started>
7    5-6-09
8
9 <Author>
10    Programmed by .
11
12 <Purpose>
13    Routines for .
14 """
15
16 #           [option, long option,    variable,     action,        data,     default,                            metavar, description]
17 """arizonaconfig
18    options=[
19             ["-C",   "--configfile", "configfile", "store",       "string", "/usr/local/stork/etc/stork.conf", "FILE",   "use a different config file (/usr/local/stork/etc/stork.conf is the default)"]]
20    includes=[]
21 """
22
23 import os
24 import sys
25 import tempfile
26 import arizonageneral
27 import shutil
28 import arizonaconfig
29 import arizonacrypt
30 import arizonareport
31 import arizonatransfer
32 import dircache
33 import random
34 import fnmatch
35 import storkerror
36 import storkrepodl
37 import storkrepolist
38 import storkversion
39 import storkmutex
40
41 def sync():
42     arizonaconfig.set_option("metafilecachetime", 0)
43     storkrepodl.sync(True, maskList=["nothing"])
44
45 def main(args):
46     """ TODO comment """
47     if arizonaconfig.get_option("noupdateonstart"):
48         arizonareport.send_out(0, "not syncing because --noupdateonstart was specified")
49     else:
50         sync()
51
52 if __name__ == "__main__":
53    try:
54       # use error reporting tool
55       storkerror.init_error_reporting("storkmetapoll.py")
56
57       # get command line and config file options
58       args = arizonaconfig.init_options("storkreposync.py", configfile_optvar="configfile", version=storkversion.VERREL)
59
60       if os.geteuid() > 0:
61           arizonareport.send_error(0, "You must be root to run this program...")
62           sys.exit(1)
63
64       storkmutex.wait_for_mutex()
65
66       main(args)
67
68    except KeyboardInterrupt:
69       arizonareport.send_out(0, "Exiting via keyboard interrupt...")
70       sys.exit(0)