Stop the puppet process.
(self)
| 194 | return self.process |
| 195 | |
| 196 | def stop_puppet(self): |
| 197 | """Stop the puppet process.""" |
| 198 | if self.process: |
| 199 | self.process.terminate() |
| 200 | try: |
| 201 | self.process.wait(timeout=5) |
| 202 | except subprocess.TimeoutExpired: |
| 203 | self.process.kill() |
| 204 | self.process = None |
| 205 | |
| 206 | if self.httpd: |
| 207 | self.httpd.shutdown() |
| 208 | self.httpd = None |
| 209 | |
| 210 | if os.path.isfile(self.lockfile): |
| 211 | os.remove(self.lockfile) |
| 212 | |
| 213 | # Close and clean up log file |
| 214 | if self.log_file: |
| 215 | try: |
| 216 | self.log_file.close() |
| 217 | except Exception: |
| 218 | pass |
| 219 | self.log_file = None |
| 220 | |
| 221 | log_path = self.get_log_path() |
| 222 | if os.path.exists(log_path): |
| 223 | try: |
| 224 | os.remove(log_path) |
| 225 | except Exception: |
| 226 | pass |
| 227 | |
| 228 | def is_running(self): |
| 229 | """Check if puppet process is running.""" |
no test coverage detected