diff options
Diffstat (limited to 'ca')
-rwxr-xr-x | ca/irbe_cli | 7 | ||||
-rwxr-xr-x | ca/rpki-sql-setup | 17 | ||||
-rwxr-xr-x | ca/rpki-start-servers | 1 | ||||
-rwxr-xr-x | ca/rpkigui-apache-conf-gen | 29 | ||||
-rwxr-xr-x | ca/tests/yamltest.py | 7 |
5 files changed, 38 insertions, 23 deletions
diff --git a/ca/irbe_cli b/ca/irbe_cli index 59039bf9..15a7a30d 100755 --- a/ca/irbe_cli +++ b/ca/irbe_cli @@ -50,6 +50,9 @@ import rpki.publication pem_out = None +# This program needs a complete rewrite. In the meantime, shut up about lint. +# pylint: skip-file + class UsageWrapper(textwrap.TextWrapper): """ Call interface around Python textwrap.Textwrapper class. @@ -207,7 +210,7 @@ class left_right_msg(cmd_msg_mixin, rpki.left_right.msg): for x in (self_elt, bsc_elt, parent_elt, child_elt, repository_elt, list_published_objects_elt, list_received_resources_elt, report_error_elt)) -class left_right_sax_handler(rpki.left_right.sax_handler): # pylint: disable=W0232 +class left_right_sax_handler(rpki.left_right.sax_handler): pdu = left_right_msg class left_right_cms_msg(rpki.left_right.cms_msg): @@ -251,7 +254,7 @@ class publication_msg(cmd_msg_mixin, rpki.publication.msg): manifest_elt, roa_elt, report_error_elt, ghostbuster_elt)) -class publication_sax_handler(rpki.publication.sax_handler): # pylint: disable=W0232 +class publication_sax_handler(rpki.publication.sax_handler): pdu = publication_msg class publication_cms_msg(rpki.publication.cms_msg): diff --git a/ca/rpki-sql-setup b/ca/rpki-sql-setup index c399fcfe..297571a2 100755 --- a/ca/rpki-sql-setup +++ b/ca/rpki-sql-setup @@ -51,6 +51,7 @@ class RootDB(object): self.mysql_defaults = mysql_defaults def __getattr__(self, name): + # pylint: disable=W0201 if self.initialized: raise AttributeError if self.mysql_defaults is None: @@ -70,7 +71,7 @@ class RootDB(object): def close(self): if self.initialized: - self.db.close() + self.db.close() # pylint: disable=E1101 class UserDB(object): @@ -112,15 +113,17 @@ class UserDB(object): self.cur.close() self.cur = None if self.db is not None: + # pylint: disable=E1101 self.db.commit() self.db.close() self.db = None @property def exists_and_accessible(self): + # pylint: disable=E1101 try: MySQLdb.connect(db = self.database, user = self.username, passwd = self.password).close() - except: # pylint: disable=W0702 + except: return False else: return True @@ -143,7 +146,7 @@ class UserDB(object): if v > self.version: self.cur.execute("DELETE FROM upgrade_version") self.cur.execute("INSERT upgrade_version (version, updated) VALUES (%s, %s)", (v, datetime.datetime.now())) - self.db.commit() + self.db.commit() # pylint: disable=E1101 log("Updated %s to %s" % (self.name, v)) @@ -192,7 +195,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 # pylint: disable=W0122 + exec f # pylint: disable=W0122 def do_drop(name): @@ -200,7 +203,7 @@ def do_drop(name): if db.database in root.databases: log("DROP DATABASE %s" % db.database) root.cur.execute("DROP DATABASE %s" % db.database) - root.db.commit() + root.db.commit() # pylint: disable=E1101 def do_create(name): db = UserDB(name) @@ -209,7 +212,7 @@ def do_create(name): log("GRANT ALL ON %s.* TO %s@localhost IDENTIFIED BY ###" % (db.database, db.username)) root.cur.execute("GRANT ALL ON %s.* TO %s@localhost IDENTIFIED BY %%s" % (db.database, db.username), (db.password,)) - root.db.commit() + root.db.commit() # pylint: disable=E1101 db.open() db.version = current_version db.close() @@ -228,7 +231,7 @@ def do_fix_grants(name): log("GRANT ALL ON %s.* TO %s@localhost IDENTIFIED BY ###" % (db.database, db.username)) root.cur.execute("GRANT ALL ON %s.* TO %s@localhost IDENTIFIED BY %%s" % (db.database, db.username), (db.password,)) - root.db.commit() + root.db.commit() # pylint: disable=E1101 def do_create_if_missing(name): db = UserDB(name) diff --git a/ca/rpki-start-servers b/ca/rpki-start-servers index e01f4f9b..9bf47d0c 100755 --- a/ca/rpki-start-servers +++ b/ca/rpki-start-servers @@ -68,7 +68,6 @@ cfg = rpki.config.parser(set_filename = args.config, section = "myrpki") def run(name, old_flag = None): if cfg.getboolean("start_" + name, cfg.getboolean("run_" + name if old_flag is None else old_flag, False)): - # pylint: disable=E1103 log_file = os.path.join(args.log_directory, name + ".log") cmd = (os.path.join(rpki.autoconf.libexecdir, name), "--log-level", args.log_level) if args.log_file: diff --git a/ca/rpkigui-apache-conf-gen b/ca/rpkigui-apache-conf-gen index a6a58c2c..b617b4ac 100755 --- a/ca/rpkigui-apache-conf-gen +++ b/ca/rpkigui-apache-conf-gen @@ -207,6 +207,7 @@ def Guess(args): return Redhat(args) raise NotImplementedError("Can't guess what platform this is, sorry") + class Platform(object): """ Abstract base class representing an operating system platform. @@ -317,6 +318,13 @@ class Platform(object): # on the details of your particular Apache configuration. ''' % (self.apache_conf_sample, self.apache_conf)) + @property + def apache_conf_target(self): + raise NotImplementedError + + def restart(self): + raise NotImplementedError + def install(self): with open(self.apache_conf_sample, "w") as f: self.log("Writing %s" % f.name) @@ -353,7 +361,7 @@ class Platform(object): def remove(self): try: same = open(self.apache_conf, "r").read() == open(self.apache_conf_sample, "r").read() - except: # pylint: disable=W0702 + except: same = False self.unlink(self.apache_conf_sample) if same: @@ -393,6 +401,7 @@ class Platform(object): return True return False + class FreeBSD(Platform): """ FreeBSD. @@ -429,6 +438,7 @@ class FreeBSD(Platform): def restart(self): self.run("service", self.apache_name, "restart") + class Debian(Platform): """ Debian and related platforms like Ubuntu. @@ -474,6 +484,7 @@ class Debian(Platform): def restart(self): self.run("service", "apache2", "restart") + class Ubuntu(Debian): # On Ubuntu, the filename must end in .conf on Trusty and must not @@ -485,20 +496,18 @@ class Ubuntu(Debian): else: return "/etc/apache2/sites-available/rpki" -class NIY(Platform): + +class NIY(Platform): # pylint: disable=W0223 def __init__(self, args): super(NIY, self).__init__(args) raise NotImplementedError("Platform %s not implemented yet, sorry" % self.__class__.__name__) -class Redhat(NIY): - """ - Redhat family of Linux distributions (Fedora, CentOS). - """ +class Redhat(NIY): # pylint: disable=W0223 + "Redhat family of Linux distributions (Fedora, CentOS)." + +class Darwin(NIY): # pylint: disable=W0223 + "Mac OS X (aka Darwin)." -class Darwin(NIY): - """ - Mac OS X (aka Darwin). - """ def main(): """ diff --git a/ca/tests/yamltest.py b/ca/tests/yamltest.py index 3740cbf6..a7ee6540 100755 --- a/ca/tests/yamltest.py +++ b/ca/tests/yamltest.py @@ -36,8 +36,6 @@ and waits for one of them to exit. # running daemons. # -# pylint: disable=W0702,W0621 - import subprocess import re import os @@ -57,6 +55,8 @@ import rpki.csv_utils import rpki.x509 import rpki.relaxng +# pylint: disable=W0621 + # Nasty regular expressions for parsing config files. Sadly, while # the Python ConfigParser supports writing config files, it does so in # such a limited way that it's easier just to hack this ourselves. @@ -288,7 +288,7 @@ class allocation(object): resources = self.base for kid in self.kids: resources |= kid.closure() - self.resources = resources + self.resources = resources # pylint: disable=W0201 return resources def dump(self): @@ -299,6 +299,7 @@ class allocation(object): print str(self) def __str__(self): + # pylint: disable=C0321 s = self.name + ":\n" if self.resources.asn: s += " ASNs: %s\n" % self.resources.asn if self.resources.v4: s += " IPv4: %s\n" % self.resources.v4 |