|
14 | 14 | from ceph.deployment.service_spec import ServiceSpec, NFSServiceSpec |
15 | 15 | from .service_registry import register_cephadm_service |
16 | 16 |
|
17 | | -from orchestrator import DaemonDescription |
| 17 | +from orchestrator import DaemonDescription, OrchestratorError |
18 | 18 |
|
19 | 19 | from cephadm.services.cephadmservice import AuthEntity, CephadmDaemonDeploySpec, CephService |
20 | 20 |
|
@@ -321,12 +321,24 @@ def purge(self, service_name: str) -> None: |
321 | 321 | '--namespace', cast(str, spec.service_id), |
322 | 322 | 'rm', 'grace', |
323 | 323 | ] |
324 | | - subprocess.run( |
325 | | - cmd, |
326 | | - stdout=subprocess.PIPE, |
327 | | - stderr=subprocess.PIPE, |
328 | | - timeout=10 |
329 | | - ) |
| 324 | + try: |
| 325 | + result = subprocess.run( |
| 326 | + cmd, |
| 327 | + stdout=subprocess.PIPE, |
| 328 | + stderr=subprocess.PIPE, |
| 329 | + timeout=10 |
| 330 | + ) |
| 331 | + except Exception as e: |
| 332 | + err_msg = f'Got unexpected exception trying to remove ganesha grace file for nfs.{spec.service_id} service: {str(e)}' |
| 333 | + self.mgr.log.warning(err_msg) |
| 334 | + raise OrchestratorError(err_msg) |
| 335 | + if result.returncode: |
| 336 | + if "No such file" in result.stderr.decode('utf-8'): |
| 337 | + logger.info(f'Grace file for nfs.{spec.service_id} already deleted') |
| 338 | + else: |
| 339 | + err_msg = f'Failed to remove ganesha grace file for nfs.{spec.service_id} service: {result.stderr.decode("utf-8")}' |
| 340 | + self.mgr.log.warning(err_msg) |
| 341 | + raise OrchestratorError(err_msg) |
330 | 342 |
|
331 | 343 | def _haproxy_hosts(self) -> List[str]: |
332 | 344 | # NB: Ideally, we would limit the list to IPs on hosts running |
|
0 commit comments