CLICommandMeta
from . import remotes
+from . import utils
from .nfs import NFSGanesha
from .osd import RemoveUtil, OSDRemoval
self.cleanup()
-def name_to_config_section(name):
- """
- Map from daemon names to ceph entity names (as seen in config)
- """
- daemon_type = name.split('.', 1)[0]
- if daemon_type in ['rgw', 'rbd-mirror', 'nfs', 'crash']:
- return 'client.' + name
- elif daemon_type in ['mon', 'osd', 'mds', 'mgr', 'client']:
- return name
- else:
- return 'mon'
-
-
class SpecStore():
def __init__(self, mgr):
# type: (CephadmOrchestrator) -> None
'prefix': 'config set',
'name': 'container_image',
'value': target_name,
- 'who': name_to_config_section(daemon_type + '.' + d.daemon_id),
+ 'who': utils.name_to_config_section(daemon_type + '.' + d.daemon_id),
})
self._daemon_action(
d.daemon_type,
})
to_clean = []
for section in image_settings.keys():
- if section.startswith(name_to_config_section(daemon_type) + '.'):
+ if section.startswith(utils.name_to_config_section(daemon_type) + '.'):
to_clean.append(section)
if to_clean:
self.log.debug('Upgrade: Cleaning up container_image for %s...' %
ret, image, err = self.mon_command({
'prefix': 'config rm',
'name': 'container_image',
- 'who': name_to_config_section(daemon_type),
+ 'who': utils.name_to_config_section(daemon_type),
})
self.log.info('Upgrade: Complete!')
# get container image
ret, image, err = self.mon_command({
'prefix': 'config get',
- 'who': name_to_config_section(entity),
+ 'who': utils.name_to_config_section(entity),
'key': 'container_image',
})
image = image.strip() # type: ignore
if daemon_type == 'mon':
ename = 'mon.'
else:
- ename = name_to_config_section(daemon_type + '.' + daemon_id)
+ ename = utils.name_to_config_section(daemon_type + '.' + daemon_id)
ret, keyring, err = self.mon_command({
'prefix': 'auth get',
'entity': ename,
import cephadm
from orchestrator import OrchestratorError
+from . import utils
+
logger = logging.getLogger(__name__)
class NFSGanesha(object):
def get_keyring_entity(self):
# type: () -> str
- return cephadm.name_to_config_section(self.get_rados_user())
+ return utils.name_to_config_section(self.get_rados_user())
def get_or_create_keyring(self, entity=None):
# type: (Optional[str]) -> str
--- /dev/null
+import re
+
+from orchestrator import OrchestratorError
+
+def name_to_config_section(name):
+ """
+ Map from daemon names to ceph entity names (as seen in config)
+ """
+ daemon_type = name.split('.', 1)[0]
+ if daemon_type in ['rgw', 'rbd-mirror', 'nfs', 'crash']:
+ return 'client.' + name
+ elif daemon_type in ['mon', 'osd', 'mds', 'mgr', 'client']:
+ return name
+ else:
+ return 'mon'