diff options
author | Rob Austein <sra@hactrn.net> | 2016-01-29 02:27:20 +0000 |
---|---|---|
committer | Rob Austein <sra@hactrn.net> | 2016-01-29 02:27:20 +0000 |
commit | 2a598fa8adb5ae40eb05aa2406d523f2a2155790 (patch) | |
tree | f7b14f3be342dda26c8493a5c0a85d6950ee70aa /rp | |
parent | 7b450b49e5d07c1b194ae1eea137a5cf4dc32f93 (diff) |
Whack rcynicng to produce an XML file which rcynic-html can parse:
needs further work, but produces somewhat-useful output now.
Start merging command line argument (argparse) and config file
(ConfigParser) support into a unified library module, in an attempt to
reduce the amount of code duplication and reign in some of the
configuration chaos. Trigger for this is all of the RP programs now
needing SQL configuration.
Whack rpki.rcynicdb.models to work with PostgreSQL, which has length
restrictions on indexed columns.
svn path=/branches/tk705/; revision=6239
Diffstat (limited to 'rp')
-rwxr-xr-x | rp/rcynic/rcynicng | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/rp/rcynic/rcynicng b/rp/rcynic/rcynicng index 51dbc6a7..ba6dfefe 100755 --- a/rp/rcynic/rcynicng +++ b/rp/rcynic/rcynicng @@ -917,6 +917,18 @@ class Fetcher(object): # tornado.httpclient.AsyncHTTPClient.fetch() # tornado.httpclient.HTTPError + # Might need to do something with If-Modified-Since support + # See if_modified_since argument to + # http://www.tornadoweb.org/en/stable/httpclient.html#request-objects + # (which we can pass to client.fetch(), below). Not sure how + # "you don't need to retrieve this" result comes back, + # probably a benign exception we need to catch. Supporting + # this means adding another null-able timestamp field to the + # RRDPSnapshot model (which probably should be named the + # RRDPZone model instead), and storing a datetime there. + # Would also need to pull timestamp from the Last-Modified + # header in the response object. + try: ok = False t0 = time.time() @@ -1197,10 +1209,13 @@ def final_report(): for s in Status.db.itervalues(): if codes.OBJECT_ACCEPTED in s.status: s.status.discard(codes.OBJECT_REJECTED) - doc = Element("rcynic-summary") # rcynic-version = "", summary-version = "", reporting-hostname = "" + doc = Element("rcynic-summary", date = time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime())) + doc.set("reporting-hostname", socket.getfqdn()) + doc.set("rcynic-version", "rcynicng") + doc.set("summary-version", "1") labels = SubElement(doc, "labels") for code in codes.all(): - SubElement(labels, code.name).text = code.text + SubElement(labels, code.name, kind = code.kind).text = code.text for uri in Status.db: for sym in sorted(Status.db[uri].status): SubElement(doc, "validation_status", @@ -1285,9 +1300,7 @@ def main(): DJANGO_SETTINGS_MODULE = "rpki.django_settings.rcynic") time.tzset() - parser = argparse.ArgumentParser(description = __doc__) - - parser.add_argument("-c", "--config", default = "/dev/null") + cfg, parser = rpki.config.argparser(section = "rcynic", doc = __doc__, cfg_optional = True) parser.add_argument("--authenticated", default = "rcynic-data/authenticated") parser.add_argument("--unauthenticated", default = "rcynic-data/unauthenticated") @@ -1314,14 +1327,6 @@ def main(): global args args = parser.parse_args() - rpki.config.parser(set_filename = args.config, section = "rcynic") - - # If we're going to allow some options to be controlled from both - # config file and command line, this is where we sort that out. - # Doesn't play well with action=store_true. Might want a more - # generalized mechanism letting us do command-line overrides of - # interesting parameters for other programs as well. - import django django.setup() |