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