diff options
author | Rob Austein <sra@hactrn.net> | 2014-05-29 22:31:15 +0000 |
---|---|---|
committer | Rob Austein <sra@hactrn.net> | 2014-05-29 22:31:15 +0000 |
commit | 35c1ca65ac2b5cbd943248d59b3e02c6220b232f (patch) | |
tree | bf2daf07febf7cb352b8fcd530e62a1e5df89626 /ca | |
parent | 07a045d1259f30878abba416b86373c05c929965 (diff) |
PyLint
svn path=/trunk/; revision=5845
Diffstat (limited to 'ca')
-rw-r--r-- | ca/tests/myrpki-xml-parse-test.py | 6 | ||||
-rw-r--r-- | ca/tests/old_irdbd.py | 6 | ||||
-rw-r--r-- | ca/tests/smoketest.py | 50 | ||||
-rw-r--r-- | ca/tests/smoketest.setup.sql | 2 | ||||
-rw-r--r-- | ca/tests/sql-cleaner.py | 10 | ||||
-rw-r--r-- | ca/tests/sql-dumper.py | 6 | ||||
-rw-r--r-- | ca/tests/testpoke.py | 6 | ||||
-rw-r--r-- | ca/tests/xml-parse-test.py | 12 | ||||
-rw-r--r-- | ca/tests/yamlconf.py | 20 | ||||
-rw-r--r-- | ca/tests/yamltest.py | 24 |
10 files changed, 71 insertions, 71 deletions
diff --git a/ca/tests/myrpki-xml-parse-test.py b/ca/tests/myrpki-xml-parse-test.py index 10b9cd58..9db7ec57 100644 --- a/ca/tests/myrpki-xml-parse-test.py +++ b/ca/tests/myrpki-xml-parse-test.py @@ -1,11 +1,11 @@ # $Id$ -# +# # Copyright (C) 2009--2012 Internet Systems Consortium ("ISC") -# +# # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. -# +# # THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH # REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY # AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, diff --git a/ca/tests/old_irdbd.py b/ca/tests/old_irdbd.py index d258e4c0..d66e683e 100644 --- a/ca/tests/old_irdbd.py +++ b/ca/tests/old_irdbd.py @@ -1,11 +1,11 @@ # $Id$ -# +# # Copyright (C) 2010-2012 Internet Systems Consortium ("ISC") -# +# # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. -# +# # THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH # REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY # AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, diff --git a/ca/tests/smoketest.py b/ca/tests/smoketest.py index bc73f1a5..64fd6173 100644 --- a/ca/tests/smoketest.py +++ b/ca/tests/smoketest.py @@ -16,11 +16,11 @@ things that don't belong in yaml_file. # Copyright (C) 2013--2014 Dragon Research Labs ("DRL") # Portions copyright (C) 2009--2012 Internet Systems Consortium ("ISC") # Portions copyright (C) 2007--2008 American Registry for Internet Numbers ("ARIN") -# +# # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notices and this permission notice appear in all copies. -# +# # THE SOFTWARE IS PROVIDED "AS IS" AND DRL, ISC, AND ARIN DISCLAIM ALL # WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED # WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DRL, @@ -203,7 +203,7 @@ def main(): logger.info("Reading master YAML configuration") y = yaml_script.pop(0) - + logger.info("Constructing internal allocation database") db = allocation_db(y) @@ -290,7 +290,7 @@ def main(): # Loop until we run out of control YAML yaml_loop() - logger.info("Sleeping %d seconds while daemons start up" % startup_delay) + logger.info("Sleeping %d seconds while daemons start up", startup_delay) rpki.async.timer(start).set(rpki.sundial.timedelta(seconds = startup_delay)) rpki.async.event_loop() @@ -323,7 +323,7 @@ def cmd_sleep(cb, interval): Set an alarm, then wait for it to go off. """ howlong = rpki.sundial.timedelta.parse(interval) - logger.info("Sleeping %r" % howlong) + logger.info("Sleeping %r", howlong) rpki.async.timer(cb).set(howlong) def cmd_shell(cb, *cmd): @@ -332,7 +332,7 @@ def cmd_shell(cb, *cmd): """ cmd = " ".join(cmd) status = subprocess.call(cmd, shell = True) - logger.info("Shell command returned status %d" % status) + logger.info("Shell command returned status %d", status) cb() def cmd_echo(cb, *words): @@ -376,7 +376,7 @@ class roa_request(object): @classmethod def parse(cls, yaml): return cls(yaml.get("asn"), yaml.get("ipv4"), yaml.get("ipv6")) - + class router_cert(object): """ Representation for a router_cert object. @@ -546,7 +546,7 @@ class allocation(object): Apply deltas to this entity. """ - logger.info("Applying delta: %s" % yaml) + logger.info("Applying delta: %s", yaml) def loop(iterator, kv): if kv[0] == "name": @@ -633,7 +633,7 @@ class allocation(object): cb() if target is None: - logger.info("Rekeying <self/> %s" % self.name) + logger.info("Rekeying <self/> %s", self.name) self.call_rpkid([rpki.left_right.self_elt.make_pdu( action = "set", self_handle = self.name, rekey = "yes")], cb = done) else: @@ -650,7 +650,7 @@ class allocation(object): cb() if target is None: - logger.info("Revoking <self/> %s" % self.name) + logger.info("Revoking <self/> %s", self.name) self.call_rpkid([rpki.left_right.self_elt.make_pdu( action = "set", self_handle = self.name, revoke = "yes")], cb = done) else: @@ -709,7 +709,7 @@ class allocation(object): """ Create BPKI certificates for this entity. """ - logger.info("Constructing BPKI keys and certs for %s" % self.name) + logger.info("Constructing BPKI keys and certs for %s", self.name) setup_bpki_cert_chain(name = self.name, ee = ("RPKI", "IRDB", "IRBE"), ca = ("SELF",)) @@ -722,7 +722,7 @@ class allocation(object): """ Write config files for this entity. """ - logger.info("Writing config files for %s" % self.name) + logger.info("Writing config files for %s", self.name) assert self.rpki_port is not None d = { "my_name" : self.name, "irdb_db_name" : self.irdb_db_name, @@ -741,7 +741,7 @@ class allocation(object): """ Set up this entity's IRDB. """ - logger.info("Setting up MySQL for %s" % self.name) + logger.info("Setting up MySQL for %s", self.name) db = MySQLdb.connect(user = "rpki", db = self.rpki_db_name, passwd = rpki_db_pass, conv = sql_conversions) cur = db.cursor() @@ -775,7 +775,7 @@ class allocation(object): once during setup, then do it again every time we apply a delta to this entity. """ - logger.info("Updating MySQL data for IRDB %s" % self.name) + logger.info("Updating MySQL data for IRDB %s", self.name) db = MySQLdb.connect(user = "irdb", db = self.irdb_db_name, passwd = irdb_db_pass, conv = sql_conversions) cur = db.cursor() @@ -828,7 +828,7 @@ class allocation(object): """ Run daemons for this entity. """ - logger.info("Running daemons for %s" % self.name) + logger.info("Running daemons for %s", self.name) self.rpkid_process = subprocess.Popen((prog_python, prog_rpkid, "--foreground", "--log-stdout", "--log-level", "debug", "--config", self.name + ".conf") + (("--profile", self.name + ".prof") if args.profile else ())) self.irdbd_process = subprocess.Popen((prog_python, prog_irdbd, "--foreground", "--log-stdout", "--log-level", "debug", "--config", self.name + ".conf")) @@ -859,7 +859,7 @@ class allocation(object): of this happens with the hosting RPKI daemon. """ - logger.info("Calling rpkid for %s" % self.name) + logger.info("Calling rpkid for %s", self.name) if self.is_hosted: logger.info("rpkid %s is hosted by rpkid %s, switching" % (self.name, self.hosted_by.name)) @@ -877,7 +877,7 @@ class allocation(object): logger.debug(q_cms.pretty_print_content()) def done(r_der): - logger.info("Callback from rpkid %s" % self.name) + logger.info("Callback from rpkid %s", self.name) r_cms = rpki.left_right.cms_msg(DER = r_der) r_msg = r_cms.unwrap((self.rpkid_ta, self.rpkid_cert)) self.last_cms_time = r_cms.check_replay(self.last_cms_time, q_url) @@ -941,7 +941,7 @@ class allocation(object): f.write(x.get_PEM()) f.close() - logger.debug("Cross certified %s:" % certfile) + logger.debug("Cross certified %s:", certfile) logger.debug(" Issuer %s [%s]" % (x.getIssuer(), x.hAKI())) logger.debug(" Subject %s [%s]" % (x.getSubject(), x.hSKI())) return x @@ -1050,7 +1050,7 @@ class allocation(object): for s in selves: b = bsc_dict[s.name] - logger.info("Issuing BSC EE cert for %s" % s.name) + logger.info("Issuing BSC EE cert for %s", s.name) cmd = (prog_openssl, "x509", "-req", "-sha256", "-extfile", s.name + "-RPKI.conf", "-extensions", "req_x509_ext", "-days", "30", "-CA", s.name + "-SELF.cer", "-CAkey", s.name + "-SELF.key", "-CAcreateserial", "-text") @@ -1094,7 +1094,7 @@ class allocation(object): """ if not os.path.exists(self.name + ".key"): - logger.info("Generating RPKI key for %s" % self.name) + logger.info("Generating RPKI key for %s", self.name) subprocess.check_call((prog_openssl, "genrsa", "-out", self.name + ".key", "2048" ), stdout = subprocess.PIPE, stderr = subprocess.STDOUT) ski = rpki.x509.RSA(PEM_file = self.name + ".key").gSKI() @@ -1107,7 +1107,7 @@ class allocation(object): self.cross_certify(self.parent.name + "-SELF") self.cross_certify(parent_host + "-TA") - logger.info("Writing leaf YAML for %s" % self.name) + logger.info("Writing leaf YAML for %s", self.name) f = open(self.name + ".yaml", "w") f.write(yaml_fmt_1 % { "parent_name" : self.parent.name, @@ -1124,7 +1124,7 @@ class allocation(object): Trigger cron run for this engine. """ - logger.info("Running cron for %s" % self.name) + logger.info("Running cron for %s", self.name) assert self.rpki_port is not None @@ -1146,10 +1146,10 @@ class allocation(object): error, but only issue a warning when issue fails. """ - logger.info("Running YAML for %s" % self.name) + logger.info("Running YAML for %s", self.name) subprocess.check_call((prog_python, prog_poke, "-y", self.name + ".yaml", "-r", "list")) if subprocess.call((prog_python, prog_poke, "-y", self.name + ".yaml", "-r", "issue")) != 0: - logger.warning("YAML issue command failed for %s, continuing" % self.name) + logger.warning("YAML issue command failed for %s, continuing", self.name) def setup_bpki_cert_chain(name, ee = (), ca = ()): """ @@ -1183,7 +1183,7 @@ def setup_rootd(rpkid, rootd_yaml): Write the config files for rootd. """ rpkid.cross_certify(rootd_name + "-TA", reverse = True) - logger.info("Writing config files for %s" % rootd_name) + logger.info("Writing config files for %s", rootd_name) d = { "rootd_name" : rootd_name, "rootd_port" : rootd_port, "rpkid_name" : rpkid.name, diff --git a/ca/tests/smoketest.setup.sql b/ca/tests/smoketest.setup.sql index 326988f1..8f7df211 100644 --- a/ca/tests/smoketest.setup.sql +++ b/ca/tests/smoketest.setup.sql @@ -17,7 +17,7 @@ -- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE -- OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -- PERFORMANCE OF THIS SOFTWARE. --- +-- -- Portions copyright (C) 2007--2008 American Registry for Internet Numbers ("ARIN") -- -- Permission to use, copy, modify, and distribute this software for any diff --git a/ca/tests/sql-cleaner.py b/ca/tests/sql-cleaner.py index c5b25ac2..ca88d456 100644 --- a/ca/tests/sql-cleaner.py +++ b/ca/tests/sql-cleaner.py @@ -1,11 +1,11 @@ # $Id$ -# +# # Copyright (C) 2009--2012 Internet Systems Consortium ("ISC") -# +# # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. -# +# # THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH # REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY # AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, @@ -28,7 +28,7 @@ for name in ("rpkid", "irdbd", "pubd"): username = cfg.get("%s_sql_username" % name, name[:4]) password = cfg.get("%s_sql_password" % name, "fnord") - + schema = [] for line in getattr(rpki.sql_schemas, name, "").splitlines(): schema.extend(line.partition("--")[0].split()) @@ -52,7 +52,7 @@ for name in ("rpkid", "irdbd", "pubd"): cur.execute("SET foreign_key_checks = 0") for table in tables: cur.execute("DROP TABLE %s" % table) - cur.execute("SET foreign_key_checks = 1") + cur.execute("SET foreign_key_checks = 1") for statement in schema: cur.execute(statement) diff --git a/ca/tests/sql-dumper.py b/ca/tests/sql-dumper.py index f4a7681d..19cc1b34 100644 --- a/ca/tests/sql-dumper.py +++ b/ca/tests/sql-dumper.py @@ -1,11 +1,11 @@ # $Id$ -# +# # Copyright (C) 2009--2012 Internet Systems Consortium ("ISC") -# +# # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. -# +# # THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH # REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY # AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, diff --git a/ca/tests/testpoke.py b/ca/tests/testpoke.py index 9ca03dce..efa068c9 100644 --- a/ca/tests/testpoke.py +++ b/ca/tests/testpoke.py @@ -1,13 +1,13 @@ # $Id$ -# +# # Copyright (C) 2014 Dragon Research Labs ("DRL") # Portions copyright (C) 2009--2012 Internet Systems Consortium ("ISC") # Portions copyright (C) 2007--2008 American Registry for Internet Numbers ("ARIN") -# +# # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notices and this permission notice appear in all copies. -# +# # THE SOFTWARE IS PROVIDED "AS IS" AND DRL, ISC, AND ARIN DISCLAIM ALL # WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED # WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DRL, diff --git a/ca/tests/xml-parse-test.py b/ca/tests/xml-parse-test.py index 42b54695..3647a82a 100644 --- a/ca/tests/xml-parse-test.py +++ b/ca/tests/xml-parse-test.py @@ -1,11 +1,11 @@ # $Id$ -# +# # Copyright (C) 2010 Internet Systems Consortium ("ISC") -# +# # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. -# +# # THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH # REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY # AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, @@ -13,13 +13,13 @@ # LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # PERFORMANCE OF THIS SOFTWARE. -# +# # Portions copyright (C) 2007--2008 American Registry for Internet Numbers ("ARIN") -# +# # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. -# +# # THE SOFTWARE IS PROVIDED "AS IS" AND ARIN DISCLAIMS ALL WARRANTIES WITH # REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY # AND FITNESS. IN NO EVENT SHALL ARIN BE LIABLE FOR ANY SPECIAL, DIRECT, diff --git a/ca/tests/yamlconf.py b/ca/tests/yamlconf.py index 7b737836..5025ef61 100644 --- a/ca/tests/yamlconf.py +++ b/ca/tests/yamlconf.py @@ -1,13 +1,13 @@ # $Id$ -# +# # Copyright (C) 2013--2014 Dragon Research Labs ("DRL") # Portions copyright (C) 2009--2012 Internet Systems Consortium ("ISC") # Portions copyright (C) 2007--2008 American Registry for Internet Numbers ("ARIN") -# +# # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notices and this permission notice appear in all copies. -# +# # THE SOFTWARE IS PROVIDED "AS IS" AND DRL, ISC, AND ARIN DISCLAIM ALL # WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED # WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DRL, @@ -108,7 +108,7 @@ class roa_request(object): @classmethod def parse(cls, y): return cls(y.get("asn"), y.get("ipv4"), y.get("ipv6")) - + class router_cert(object): """ Representation for a router_cert object. @@ -328,7 +328,7 @@ class allocation(object): def dump_asns(self, fn): with self.csvout(fn) as f: - for k in self.kids: + for k in self.kids: f.writerows((k.name, a) for a in k.resources.asn) def dump_prefixes(self, fn): @@ -352,7 +352,7 @@ class allocation(object): if i > 0: f.write("\n") f.write(g) - + def dump_router_certificates(self, fn): if self.router_certs: path = self.path(fn) @@ -423,7 +423,7 @@ class allocation(object): pubd_server_host = self.pubd.hostname, pubd_server_port = str(self.pubd.pubd_port), publication_rsync_server = self.rsync_server) - + if loopback: r.update( irdbd_sql_database = self.irdb_name, @@ -582,7 +582,7 @@ def pre_django_sql_setup(needed): if mysql_rootpass: db = MySQLdb.connect(user = mysql_rootuser, passwd = mysql_rootpass) else: - db = MySQLdb.connect(user = mysql_rootuser) + db = MySQLdb.connect(user = mysql_rootuser) cur = db.cursor() for database in needed: try: @@ -611,7 +611,7 @@ def pre_django_sql_setup(needed): cur.execute("SET foreign_key_checks = 0") for table in tables: cur.execute("DROP TABLE %s" % table) - cur.execute("SET foreign_key_checks = 1") + cur.execute("SET foreign_key_checks = 1") cur.close() db.commit() @@ -711,7 +711,7 @@ def main(): for k in ("rpkid_sql_password", "irdbd_sql_password", "pubd_sql_password", "rpkid_sql_username", "irdbd_sql_username", "pubd_sql_username"): if cfg.has_option(k): - config_overrides[k] = cfg.get(k) + config_overrides[k] = cfg.get(k) if args.profile: import cProfile diff --git a/ca/tests/yamltest.py b/ca/tests/yamltest.py index df60ec17..5d6686b4 100644 --- a/ca/tests/yamltest.py +++ b/ca/tests/yamltest.py @@ -8,15 +8,15 @@ and waits for one of them to exit. """ # $Id$ -# +# # Copyright (C) 2013--2014 Dragon Research Labs ("DRL") # Portions copyright (C) 2009--2012 Internet Systems Consortium ("ISC") # Portions copyright (C) 2007--2008 American Registry for Internet Numbers ("ARIN") -# +# # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notices and this permission notice appear in all copies. -# +# # THE SOFTWARE IS PROVIDED "AS IS" AND DRL, ISC, AND ARIN DISCLAIM ALL # WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED # WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DRL, @@ -27,14 +27,14 @@ and waits for one of them to exit. # WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # Much of the YAML handling code lifted from smoketest.py. -# +# # Still to do: -# +# # - Implement smoketest.py-style delta actions, that is, modify the # allocation database under control of the YAML file, dump out new # .csv files, and run rpkic.py again to feed resulting changes into # running daemons. -# +# # pylint: disable=W0702,W0621 @@ -111,8 +111,8 @@ class roa_request(object): Parse a ROA request from YAML format. """ return cls(y.get("asn"), y.get("ipv4"), y.get("ipv6")) - - + + class router_cert(object): """ Representation for a router_cert object. @@ -355,7 +355,7 @@ class allocation(object): fn = "%s.asns.csv" % d.name if not args.skip_config: f = self.csvout(fn) - for k in self.kids: + for k in self.kids: f.writerows((k.name, a) for a in k.resources.asn) f.close() if not args.stop_after_config: @@ -483,7 +483,7 @@ class allocation(object): bpki_servers_directory = self.path(), publication_base_directory = self.path("publication"), shared_sql_password = "fnord") - + r.update(config_overrides) f = open(self.path("rpki.conf"), "w") @@ -565,7 +565,7 @@ class allocation(object): stderr = subprocess.STDOUT) print 'Running %s for %s: pid %d process %r' % (" ".join(cmd), self.name, p.pid, p) return p - + def run_rpkid(self): """ Run rpkid. @@ -705,7 +705,7 @@ try: if args.skip_config: print "Skipping pre-daemon configuration, assuming you already did that" - + else: # Set up each entity in our test, create publication directories, |