ca_cert=ssl_params.ssl_ca_cert or '',
)
- def _rgw_creds_uri(self, cluster_id: str) -> Optional[str]:
+ @classmethod
+ def _lookup_rgw_creds_uri(
+ cls, mgr: 'CephadmOrchestrator', cluster_id: str
+ ) -> Optional[str]:
from smb.external import rgw_config_key as _smb_rgw_config_key
from smb.mon_store import MonKeyConfigStore
- _rgw_entry = MonKeyConfigStore(self.mgr)[
- _smb_rgw_config_key(cluster_id)
- ]
+ _rgw_entry = MonKeyConfigStore(mgr)[_smb_rgw_config_key(cluster_id)]
if _rgw_entry.exists():
return _rgw_entry.uri
return None
+ def _rgw_creds_uri(self, cluster_id: str) -> Optional[str]:
+ return self._lookup_rgw_creds_uri(self.mgr, cluster_id)
+
def generate_config(
self, daemon_spec: CephadmDaemonDeploySpec
) -> Tuple[Dict[str, Any], List[str]]:
out.append(Dep.META(f'ceph_cluster_config.{ccc.alias}', value))
# Add features as a dependency
out.append(Dep.FIELD('features', ','.join(sorted(smb_spec.features or []))))
+ rgw_creds_uri = cls._lookup_rgw_creds_uri(mgr, smb_spec.cluster_id) or ''
+ out.append(Dep.FIELD('rgw_creds_uri', rgw_creds_uri))
return out
def choose_next_action(
scheduled_action, daemon_type, spec, curr_deps, last_deps)
if step.action is utils.Action.RECONFIG:
sym_diff = set(curr_deps).symmetric_difference(last_deps)
- if any(d.startswith(Dep.FIELD('features', '')) for d in sym_diff):
+ needs_redeploy_prefixes = (
+ Dep.FIELD('features', ''),
+ Dep.FIELD('rgw_creds_uri', ''),
+ )
+ if any(
+ d.startswith(p)
+ for d in sym_diff
+ for p in needs_redeploy_prefixes
+ ):
return replace(step, action=utils.Action.REDEPLOY)
return step
rgw = sc.resource.rgw
assert rgw is not None
assert rgw.credential_ref is not None
- cred = cred_map[rgw.credential_ref]
+ cred = cred_map.get(rgw.credential_ref)
+ if cred is None:
+ log.error(
+ "share %r references missing RGW credential %r",
+ sc.resource.name,
+ rgw.credential_ref,
+ )
+ continue
access_key = cred.access_key_id or ''
secret_key = cred.secret_access_key or ''
merge_shares[sc.resource.name] = {