From 379523bd09e4bbd9f475d316cddea0cb154a906b Mon Sep 17 00:00:00 2001 From: Tobias Henkel Date: Wed, 27 Dec 2017 10:24:04 +0100 Subject: Make ZuulDaemonApp an abstract base class We use ZuulDaemonApp like an abstract base class with run() as an abstract method so make that explicit. This creates the groundwork for later refactorings like centralized signal handling. Change-Id: I20f14274df27ab181711b2ca2b80251fa5b09938 --- zuul/cmd/__init__.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/zuul/cmd/__init__.py b/zuul/cmd/__init__.py index bdb93978f..2aad4eb39 100755 --- a/zuul/cmd/__init__.py +++ b/zuul/cmd/__init__.py @@ -14,6 +14,7 @@ # License for the specific language governing permissions and limitations # under the License. +import abc import argparse import configparser import daemon @@ -156,7 +157,7 @@ class ZuulApp(object): self.connections.configure(self.config, source_only) -class ZuulDaemonApp(ZuulApp): +class ZuulDaemonApp(ZuulApp, metaclass=abc.ABCMeta): def createParser(self): parser = super(ZuulDaemonApp, self).createParser() parser.add_argument('-d', dest='nodaemon', action='store_true', @@ -169,6 +170,13 @@ class ZuulDaemonApp(ZuulApp): expand_user=True) return pid_fn + @abc.abstractmethod + def run(self): + """ + This is the main run method of the application. + """ + pass + def main(self): self.parseArguments() self.readConfig() -- cgit v1.2.1