# type: (str, str, Optional[Union[int, str]]) -> str
# accept either name or type + id
if daemon_id is not None:
- return 'ceph-%s@%s.%s' % (fsid, daemon_type, daemon_id)
+ return DaemonIdentity(fsid, daemon_type, daemon_id).unit_name
else:
return 'ceph-%s@%s' % (fsid, daemon_type)
deployment_type: DeploymentType = DeploymentType.DEFAULT
if ctx.reconfig:
deployment_type = DeploymentType.RECONFIG
- unit_name = get_unit_name(ctx.fsid, daemon_type, daemon_id)
- (_, state, _) = check_unit(ctx, unit_name)
ident = DaemonIdentity(ctx.fsid, daemon_type, daemon_id)
+ (_, state, _) = check_unit(ctx, ident.unit_name)
if state == 'running' or is_container_running(ctx, CephContainer.for_daemon(ctx, ident, 'bash')):
# if reconfig was set, that takes priority over redeploy. If
# this is considered a fresh deployment at this stage,
name = f'ceph-{self.fsid}-{self.daemon_type}-{self.daemon_id}'
return name.replace('.', '-')
+ @property
+ def unit_name(self) -> str:
+ return f'ceph-{self.fsid}@{self.daemon_type}.{self.daemon_id}'
+
@classmethod
def from_name(cls, fsid: str, name: str) -> 'DaemonIdentity':
daemon_type, daemon_id = name.split('.', 1)