summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.openstack.org>2019-03-08 18:37:16 +0000
committerGerrit Code Review <review@openstack.org>2019-03-08 18:37:16 +0000
commit95f7071c2ac2b4c9fc433de4c1e81d634dbd2bf2 (patch)
tree87c639a5d0df473b07084aae51cb0014f1843274
parent3561e278c6178436aa1d8d673f839a676598ea17 (diff)
parent6b9af280df07ef2ec07789b6469c7b605f3e760b (diff)
Merge "docker: don't daemonize when starting images"
-rw-r--r--Dockerfile4
-rw-r--r--nodepool/cmd/__init__.py29
-rw-r--r--nodepool/cmd/builder.py7
-rwxr-xr-xnodepool/cmd/launcher.py7
4 files changed, 28 insertions, 19 deletions
diff --git a/Dockerfile b/Dockerfile
index 2d313b8..3b4206a 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -25,7 +25,7 @@ RUN /output/install-from-bindep
25CMD ["/usr/local/bin/nodepool"] 25CMD ["/usr/local/bin/nodepool"]
26 26
27FROM nodepool as nodepool-launcher 27FROM nodepool as nodepool-launcher
28CMD ["/usr/local/bin/nodepool-launcher"] 28CMD ["/usr/local/bin/nodepool-launcher", "-f"]
29 29
30FROM nodepool as nodepool-builder 30FROM nodepool as nodepool-builder
31CMD ["/usr/local/bin/nodepool-builder"] 31CMD ["/usr/local/bin/nodepool-builder", "-f"]
diff --git a/nodepool/cmd/__init__.py b/nodepool/cmd/__init__.py
index ed50dcf..51b2cde 100644
--- a/nodepool/cmd/__init__.py
+++ b/nodepool/cmd/__init__.py
@@ -106,9 +106,16 @@ class NodepoolApp(object):
106 return parser 106 return parser
107 107
108 def parse_args(self): 108 def parse_args(self):
109 args = self.parser.parse_args() 109 self.args = self.parser.parse_args()
110 self.logconfig = self.get_path(args.logconfig) 110 self.logconfig = self.get_path(self.args.logconfig)
111 return args 111
112 # The arguments debug and foreground both lead to nodaemon mode so
113 # set nodaemon if one of them is set.
114 if ((hasattr(self.args, 'debug') and self.args.debug) or
115 (hasattr(self.args, 'foreground') and self.args.foreground)):
116 self.args.nodaemon = True
117 else:
118 self.args.nodaemon = False
112 119
113 def setup_logging(self): 120 def setup_logging(self):
114 if self.logconfig: 121 if self.logconfig:
@@ -118,7 +125,8 @@ class NodepoolApp(object):
118 # config, leave the config set to emit to stdout. 125 # config, leave the config set to emit to stdout.
119 if hasattr(self.args, 'nodaemon') and self.args.nodaemon: 126 if hasattr(self.args, 'nodaemon') and self.args.nodaemon:
120 logging_config = logconfig.ServerLoggingConfig() 127 logging_config = logconfig.ServerLoggingConfig()
121 logging_config.setDebug() 128 if hasattr(self.args, 'debug') and self.args.debug:
129 logging_config.setDebug()
122 else: 130 else:
123 # Setting a server value updates the defaults to use 131 # Setting a server value updates the defaults to use
124 # WatchedFileHandler on /var/log/nodepool/{server}-debug.log 132 # WatchedFileHandler on /var/log/nodepool/{server}-debug.log
@@ -132,7 +140,7 @@ class NodepoolApp(object):
132 argv = sys.argv[1:] 140 argv = sys.argv[1:]
133 141
134 self.parser = self.create_parser() 142 self.parser = self.create_parser()
135 self.args = self.parse_args() 143 self.parse_args()
136 return self._do_run() 144 return self._do_run()
137 145
138 def _do_run(self): 146 def _do_run(self):
@@ -161,16 +169,19 @@ class NodepoolDaemonApp(NodepoolApp):
161 default='/var/run/nodepool/%s.pid' % self.app_name) 169 default='/var/run/nodepool/%s.pid' % self.app_name)
162 170
163 parser.add_argument('-d', 171 parser.add_argument('-d',
164 dest='nodaemon', 172 dest='debug',
173 action='store_true',
174 help='do not run as a daemon with debug logging')
175 parser.add_argument('-f',
176 dest='foreground',
165 action='store_true', 177 action='store_true',
166 help='do not run as a daemon') 178 help='do not run as a daemon')
167 179
168 return parser 180 return parser
169 181
170 def parse_args(self): 182 def parse_args(self):
171 args = super(NodepoolDaemonApp, self).parse_args() 183 super().parse_args()
172 self.pidfile = self.get_path(args.pidfile) 184 self.pidfile = self.get_path(self.args.pidfile)
173 return args
174 185
175 def _do_run(self): 186 def _do_run(self):
176 if self.args.nodaemon: 187 if self.args.nodaemon:
diff --git a/nodepool/cmd/builder.py b/nodepool/cmd/builder.py
index d0bf156..e3b11d6 100644
--- a/nodepool/cmd/builder.py
+++ b/nodepool/cmd/builder.py
@@ -48,10 +48,9 @@ class NodePoolBuilderApp(nodepool.cmd.NodepoolDaemonApp):
48 return parser 48 return parser
49 49
50 def parse_args(self): 50 def parse_args(self):
51 args = super(NodePoolBuilderApp, self).parse_args() 51 super(NodePoolBuilderApp, self).parse_args()
52 self.config_file = self.get_path(args.config) 52 self.config_file = self.get_path(self.args.config)
53 self.secure_file = self.get_path(args.secure) 53 self.secure_file = self.get_path(self.args.secure)
54 return args
55 54
56 def run(self): 55 def run(self):
57 self.nb = builder.NodePoolBuilder( 56 self.nb = builder.NodePoolBuilder(
diff --git a/nodepool/cmd/launcher.py b/nodepool/cmd/launcher.py
index 4e95ce0..a812cf0 100755
--- a/nodepool/cmd/launcher.py
+++ b/nodepool/cmd/launcher.py
@@ -42,10 +42,9 @@ class NodePoolLauncherApp(nodepool.cmd.NodepoolDaemonApp):
42 return parser 42 return parser
43 43
44 def parse_args(self): 44 def parse_args(self):
45 args = super(NodePoolLauncherApp, self).parse_args() 45 super().parse_args()
46 self.config_file = self.get_path(args.config) 46 self.config_file = self.get_path(self.args.config)
47 self.secure_file = self.get_path(args.secure) 47 self.secure_file = self.get_path(self.args.secure)
48 return args
49 48
50 def exit_handler(self, signum, frame): 49 def exit_handler(self, signum, frame):
51 self.pool.stop() 50 self.pool.stop()