aboutsummaryrefslogtreecommitdiff
path: root/ca
diff options
context:
space:
mode:
Diffstat (limited to 'ca')
-rwxr-xr-xca/irbe_cli2
-rwxr-xr-xca/rpki-confgen10
-rwxr-xr-xca/rpki-sql-backup4
-rwxr-xr-xca/rpki-sql-setup24
-rwxr-xr-xca/rpki-start-servers6
-rwxr-xr-xca/rpkigui-apache-conf-gen12
-rwxr-xr-xca/rpkigui-import-routes2
-rwxr-xr-xca/rpkigui-rcynic2
-rw-r--r--ca/tests/smoketest.py32
-rw-r--r--ca/tests/xml-parse-test.py2
-rw-r--r--ca/tests/yamlconf.py1
-rw-r--r--ca/tests/yamltest.py1
-rw-r--r--ca/upgrade-scripts/upgrade-rpkid-to-0.5709.py2
13 files changed, 49 insertions, 51 deletions
diff --git a/ca/irbe_cli b/ca/irbe_cli
index 9deac6d6..1becd403 100755
--- a/ca/irbe_cli
+++ b/ca/irbe_cli
@@ -30,7 +30,7 @@
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
-__doc__ = """
+"""
Command line IR back-end control program for rpkid and pubd.
"""
diff --git a/ca/rpki-confgen b/ca/rpki-confgen
index f531bee8..07c87f0f 100755
--- a/ca/rpki-confgen
+++ b/ca/rpki-confgen
@@ -4,11 +4,11 @@
#
# Copyright (C) 2014 Dragon Research Labs ("DRL")
# Portions copyright (C) 2013 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 notices and this permission notice appear in all copies.
-#
+#
# THE SOFTWARE IS PROVIDED "AS IS" AND DRL AND ISC DISCLAIM ALL
# WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DRL OR
@@ -155,7 +155,7 @@ class CustomAction(argparse.Action):
class CustomFlagAction(argparse.Action):
def __init__(self, option_strings, dest, default = None,
- required = False, help = None):
+ required = False, help = None): # pylint: disable=W0622
super(CustomFlagAction, self).__init__(
option_strings = option_strings, dest = dest, nargs = 0,
const = None, default = default, required = required, help = help)
@@ -221,7 +221,7 @@ class main(object):
name, value = arg.split("=", 1)
section, option = name.split("::")
except ValueError:
- sys.exit("Couldn't parse --set specification \"%s\"" % a)
+ sys.exit("Couldn't parse --set specification \"%s\"" % arg)
name = (section, option)
if name not in self.option_map:
sys.exit("Couldn't find option %s::%s" % name)
@@ -232,7 +232,7 @@ class main(object):
try:
section, option = arg.split("::")
except ValueError:
- sys.exit("Couldn't parse --pwgen specification \"%s\"" % a)
+ sys.exit("Couldn't parse --pwgen specification \"%s\"" % arg)
name = (section, option)
if name not in self.option_map:
sys.exit("Couldn't find option %s::%s" % name)
diff --git a/ca/rpki-sql-backup b/ca/rpki-sql-backup
index 0b2d079d..e60f9ae3 100755
--- a/ca/rpki-sql-backup
+++ b/ca/rpki-sql-backup
@@ -4,11 +4,11 @@
#
# Copyright (C) 2014 Dragon Research Labs ("DRL")
# Portions copyright (C) 2010-2013 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 notices and this permission notice appear in all copies.
-#
+#
# THE SOFTWARE IS PROVIDED "AS IS" AND DRL AND ISC DISCLAIM ALL
# WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DRL OR
diff --git a/ca/rpki-sql-setup b/ca/rpki-sql-setup
index 40a78532..edc2c242 100755
--- a/ca/rpki-sql-setup
+++ b/ca/rpki-sql-setup
@@ -4,11 +4,11 @@
#
# Copyright (C) 2014 Dragon Research Labs ("DRL")
# Portions copyright (C) 2009-2013 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 notices and this permission notice appear in all copies.
-#
+#
# THE SOFTWARE IS PROVIDED "AS IS" AND DRL AND ISC DISCLAIM ALL
# WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DRL OR
@@ -116,7 +116,7 @@ class UserDB(object):
def exists_and_accessible(self):
try:
MySQLdb.connect(db = self.database, user = self.username, passwd = self.password).close()
- except:
+ except: # pylint: disable=W0702
return False
else:
return True
@@ -179,13 +179,13 @@ class Upgrade(object):
"""
@classmethod
- def load_all(cls, name, dir):
- g = os.path.join(dir, "upgrade-%s-to-*.py" % name)
+ def load_all(cls, name, dn):
+ g = os.path.join(dn, "upgrade-%s-to-*.py" % name)
for fn in glob.iglob(g):
yield cls(g, fn)
def __init__(self, g, fn):
- head, sep, tail = g.partition("*")
+ head, sep, tail = g.partition("*") # pylint: disable=W0612
self.fn = fn
self.version = Version(fn[len(head):-len(tail)])
@@ -196,7 +196,7 @@ class Upgrade(object):
# db is an argument here primarily so the script we exec can get at it
log("Applying %s to %s" % (self.fn, db.name))
with open(self.fn, "r") as f:
- exec f
+ exec f # pylint: disable=W0122
def do_drop(name):
@@ -302,10 +302,10 @@ try:
cfg = rpki.config.parser(args.config, "myrpki")
root = RootDB(args.mysql_defaults)
current_version = Version(rpki.version.VERSION)
- for name in ("irdbd", "rpkid", "pubd"):
- if cfg.getboolean("start_" + name, False):
- args.dispatch(name)
+ for program_name in ("irdbd", "rpkid", "pubd"):
+ if cfg.getboolean("start_" + program_name, False):
+ args.dispatch(program_name)
root.close()
except Exception, e:
- #sys.exit(str(e))
- raise
+ #raise
+ sys.exit(str(e))
diff --git a/ca/rpki-start-servers b/ca/rpki-start-servers
index f867fefa..8a745896 100755
--- a/ca/rpki-start-servers
+++ b/ca/rpki-start-servers
@@ -1,15 +1,15 @@
#!/usr/bin/env python
# $Id$
-#
+#
# Copyright (C) 2014 Dragon Research Labs ("DRL")
# Portions copyright (C) 2009--2013 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/rpkigui-apache-conf-gen b/ca/rpkigui-apache-conf-gen
index 6201c364..0f56342f 100755
--- a/ca/rpkigui-apache-conf-gen
+++ b/ca/rpkigui-apache-conf-gen
@@ -17,7 +17,6 @@
# PERFORMANCE OF THIS SOFTWARE.
import os
-import re
import sys
import socket
import urllib2
@@ -168,7 +167,7 @@ class Platform(object):
apache_key = os.path.join(rpki.autoconf.sysconfdir, "rpki", "apache.key")
apache_conf = os.path.join(rpki.autoconf.sysconfdir, "rpki", "apache.conf")
- apache_conf_sample = apache_conf + ".sample"
+ apache_conf_sample = apache_conf + ".sample"
apache_conf_preface = ""
@@ -305,7 +304,7 @@ class Platform(object):
def remove(self):
try:
same = open(self.apache_conf, "r").read() == open(self.apache_conf_sample, "r").read()
- except:
+ except: # pylint: disable=W0702
same = False
self.unlink(self.apache_conf_sample)
if same:
@@ -334,7 +333,7 @@ class Platform(object):
addrinfo = socket.getaddrinfo(host, port, family, proto)
except socket.error:
return False
- for af, socktype, proto, canon, sa in addrinfo:
+ for af, socktype, proto, canon, sa in addrinfo: # pylint: disable=W0612
try:
s = socket.socket(af, socktype, proto)
s.connect(sa)
@@ -344,7 +343,7 @@ class Platform(object):
else:
return True
return False
-
+
class FreeBSD(Platform):
"""
FreeBSD.
@@ -353,7 +352,7 @@ class FreeBSD(Platform):
# On FreeBSD we have to ask httpd what version it is before we know
# where to put files or what to call the service. In FreeBSD's makefiles,
# this value is called APACHE_VERSION, and is calculated thusly:
- #
+ #
# httpd -V | sed -ne 's/^Server version: Apache\/\([0-9]\)\.\([0-9]*\).*/\1\2/p'
_apache_name = None
@@ -417,6 +416,7 @@ class Debian(Platform):
class NIY(Platform):
def __init__(self, args):
+ super(NIY, self).__init__(args)
raise NotImplementedError("Platform %s not implemented yet, sorry" % self.__class__.__name__)
class Redhat(NIY):
diff --git a/ca/rpkigui-import-routes b/ca/rpkigui-import-routes
index 234a865b..3dce26b3 100755
--- a/ca/rpkigui-import-routes
+++ b/ca/rpkigui-import-routes
@@ -81,7 +81,7 @@ automatically.""")
delay = random.SystemRandom().randint(0, options.jitter)
except NotImplementedError:
delay = random.randint(0, options.jitter)
- logging.info('jitter active, delaying startup for %d seconds' % delay)
+ logging.info('jitter active, delaying startup for %d seconds', delay)
time.sleep(delay)
if options.lockfile:
diff --git a/ca/rpkigui-rcynic b/ca/rpkigui-rcynic
index 8fb91a70..79afb15f 100755
--- a/ca/rpkigui-rcynic
+++ b/ca/rpkigui-rcynic
@@ -47,7 +47,7 @@ if __name__ == '__main__':
v = getattr(logging, options.log_level.upper())
logging.basicConfig(level=v)
- logging.info('log level set to %s' % logging.getLevelName(v))
+ logging.info('log level set to %s', logging.getLevelName(v))
import_rcynic_xml(options.root, options.logfile)
diff --git a/ca/tests/smoketest.py b/ca/tests/smoketest.py
index 04b43f07..7f56843f 100644
--- a/ca/tests/smoketest.py
+++ b/ca/tests/smoketest.py
@@ -35,7 +35,6 @@ things that don't belong in yaml_file.
import os
import yaml
import subprocess
-import signal
import time
import logging
import argparse
@@ -311,13 +310,13 @@ def main():
(rsyncd_process, "rsyncd")):
# pylint: disable=E1103
if proc is not None and proc.poll() is None:
- logger.info("Killing %s, pid %s" % (name, proc.pid))
+ logger.info("Killing %s, pid %s", name, proc.pid)
try:
proc.terminate()
except OSError:
pass
if proc is not None:
- logger.info("Daemon %s, pid %s exited with code %s" % (name, proc.pid, proc.wait()))
+ logger.info("Daemon %s, pid %s exited with code %s", name, proc.pid, proc.wait())
def cmd_sleep(cb, interval):
"""
@@ -405,11 +404,10 @@ class router_cert(object):
return self.asn == other.asn and self.sn == other.sn and self.gski == other.gski
def __hash__(self):
- v6 = tuple(self.v6) if self.v6 is not None else None
- return tuple(self.asn).__hash__() + sn.__hash__() + self.gski.__hash__()
+ return tuple(self.asn).__hash__() + self.cn.__hash__() + self.sn.__hash__() + self.gski.__hash__()
def __str__(self):
- return "%s: %s: %s" % (self.asn, self.cn, self.sn, self.gski)
+ return "%s: %s,%s: %s" % (self.asn, self.cn, self.sn, self.gski)
@classmethod
def parse(cls, yaml):
@@ -638,7 +636,7 @@ class allocation(object):
self.call_rpkid([rpki.left_right.self_elt.make_pdu(
action = "set", self_handle = self.name, rekey = "yes")], cb = done)
else:
- logger.info("Rekeying <parent/> %s %s" % (self.name, target))
+ logger.info("Rekeying <parent/> %s %s", self.name, target)
self.call_rpkid([rpki.left_right.parent_elt.make_pdu(
action = "set", self_handle = self.name, parent_handle = target, rekey = "yes")], cb = done)
@@ -655,7 +653,7 @@ class allocation(object):
self.call_rpkid([rpki.left_right.self_elt.make_pdu(
action = "set", self_handle = self.name, revoke = "yes")], cb = done)
else:
- logger.info("Revoking <parent/> %s %s" % (self.name, target))
+ logger.info("Revoking <parent/> %s %s", self.name, target)
self.call_rpkid([rpki.left_right.parent_elt.make_pdu(
action = "set", self_handle = self.name, parent_handle = target, revoke = "yes")], cb = done)
@@ -842,14 +840,14 @@ class allocation(object):
for proc, name in ((self.rpkid_process, "rpkid"),
(self.irdbd_process, "irdbd")):
if proc is not None and proc.poll() is None:
- logger.info("Killing daemon %s pid %s for %s" % (name, proc.pid, self.name))
+ logger.info("Killing daemon %s pid %s for %s", name, proc.pid, self.name)
try:
proc.terminate()
except OSError:
pass
if proc is not None:
- logger.info("Daemon %s pid %s for %s exited with code %s" % (
- name, proc.pid, self.name, proc.wait()))
+ logger.info("Daemon %s pid %s for %s exited with code %s",
+ name, proc.pid, self.name, proc.wait())
def call_rpkid(self, pdus, cb):
"""
@@ -863,7 +861,7 @@ class allocation(object):
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))
+ logger.info("rpkid %s is hosted by rpkid %s, switching", self.name, self.hosted_by.name)
self = self.hosted_by
assert not self.is_hosted
@@ -909,7 +907,7 @@ class allocation(object):
certifier = self.name + "-SELF"
certfile = certifier + "-" + certificant + ".cer"
- logger.info("Cross certifying %s into %s's BPKI (%s)" % (certificant, certifier, certfile))
+ logger.info("Cross certifying %s into %s's BPKI (%s)", certificant, certifier, certfile)
child = rpki.x509.X509(Auto_file = certificant + ".cer")
parent = rpki.x509.X509(Auto_file = certifier + ".cer")
@@ -943,8 +941,8 @@ class allocation(object):
f.close()
logger.debug("Cross certified %s:", certfile)
- logger.debug(" Issuer %s [%s]" % (x.getIssuer(), x.hAKI()))
- logger.debug(" Subject %s [%s]" % (x.getSubject(), x.hSKI()))
+ logger.debug(" Issuer %s [%s]", x.getIssuer(), x.hAKI())
+ logger.debug(" Subject %s [%s]", x.getSubject(), x.hSKI())
return x
def create_rpki_objects(self, cb):
@@ -965,7 +963,7 @@ class allocation(object):
selves = [self] + self.hosts
for i, s in enumerate(selves):
- logger.info("Creating RPKI objects for [%d] %s" % (i, s.name))
+ logger.info("Creating RPKI objects for [%d] %s", i, s.name)
rpkid_pdus = []
pubd_pdus = []
@@ -1062,7 +1060,7 @@ class allocation(object):
raise CouldntIssueBSCEECertificate("Couldn't issue BSC EE certificate")
s.bsc_ee = rpki.x509.X509(PEM = signed[0])
s.bsc_crl = rpki.x509.CRL(PEM_file = s.name + "-SELF.crl")
- logger.info("BSC EE cert for %s SKI %s" % (s.name, s.bsc_ee.hSKI()))
+ logger.info("BSC EE cert for %s SKI %s", s.name, s.bsc_ee.hSKI())
bsc_pdus.append(rpki.left_right.bsc_elt.make_pdu(
action = "set",
diff --git a/ca/tests/xml-parse-test.py b/ca/tests/xml-parse-test.py
index 3647a82a..5ea25492 100644
--- a/ca/tests/xml-parse-test.py
+++ b/ca/tests/xml-parse-test.py
@@ -50,7 +50,7 @@ def test(fileglob, rng, sax_handler, encoding, tester = None):
print "<!-- Output -->"
print lxml.etree.tostring(elt_out, pretty_print = True, encoding = encoding, xml_declaration = True)
rng.assertValid(elt_out)
- if (tester):
+ if tester:
tester(elt_in, elt_out, handler.result)
if verbose:
print
diff --git a/ca/tests/yamlconf.py b/ca/tests/yamlconf.py
index e9b6e391..acc56497 100644
--- a/ca/tests/yamlconf.py
+++ b/ca/tests/yamlconf.py
@@ -133,7 +133,6 @@ class router_cert(object):
return self.asn == other.asn and self.router_id == other.router_id and self.gski == other.gski
def __hash__(self):
- v6 = tuple(self.v6) if self.v6 is not None else None
return tuple(self.asn).__hash__() + self.router_id.__hash__() + self.gski.__hash__()
def __str__(self):
diff --git a/ca/tests/yamltest.py b/ca/tests/yamltest.py
index a2390aff..1482c4e2 100644
--- a/ca/tests/yamltest.py
+++ b/ca/tests/yamltest.py
@@ -137,7 +137,6 @@ class router_cert(object):
return self.asn == other.asn and self.router_id == other.router_id and self.gski == other.gski
def __hash__(self):
- v6 = tuple(self.v6) if self.v6 is not None else None
return tuple(self.asn).__hash__() + self.router_id.__hash__() + self.gski.__hash__()
def __str__(self):
diff --git a/ca/upgrade-scripts/upgrade-rpkid-to-0.5709.py b/ca/upgrade-scripts/upgrade-rpkid-to-0.5709.py
index aa8e3ec1..0cea5671 100644
--- a/ca/upgrade-scripts/upgrade-rpkid-to-0.5709.py
+++ b/ca/upgrade-scripts/upgrade-rpkid-to-0.5709.py
@@ -14,6 +14,8 @@
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
+# pylint: disable=E0602
+
"""
Upgrade RPKI SQL databases to schema expected by 0.5709.