@classmethod
def init(cls, ctx: CephadmContext, fsid: str,
daemon_id: Union[int, str]) -> 'SNMPGateway':
- assert ctx.config_json
- return cls(ctx, fsid, daemon_id,
- get_parm(ctx.config_json), ctx.image)
+ cfgs = fetch_configs(ctx)
+ assert cfgs # assert some config data was found
+ return cls(ctx, fsid, daemon_id, cfgs, ctx.image)
@staticmethod
def get_version(ctx: CephadmContext, fsid: str, daemon_id: str) -> Optional[str]:
@classmethod
def init(cls, ctx, fsid, daemon_id):
# type: (CephadmContext, str, Union[int, str]) -> NFSGanesha
- return cls(ctx, fsid, daemon_id, get_parm(ctx.config_json), ctx.image)
+ return cls(ctx, fsid, daemon_id, fetch_configs(ctx), ctx.image)
def get_container_mounts(self, data_dir):
# type: (str) -> Dict[str, str]
def init(cls, ctx, fsid, daemon_id):
# type: (CephadmContext, str, Union[int, str]) -> CephIscsi
return cls(ctx, fsid, daemon_id,
- get_parm(ctx.config_json), ctx.image)
+ fetch_configs(ctx), ctx.image)
@staticmethod
def get_container_mounts(data_dir, log_dir):
def init(cls, ctx: CephadmContext, fsid: str,
daemon_id: Union[int, str]) -> 'CephExporter':
return cls(ctx, fsid, daemon_id,
- get_parm(ctx.config_json), ctx.image)
+ fetch_configs(ctx), ctx.image)
@staticmethod
def get_container_mounts() -> Dict[str, str]:
@classmethod
def init(cls, ctx: CephadmContext,
fsid: str, daemon_id: Union[int, str]) -> 'HAproxy':
- return cls(ctx, fsid, daemon_id, get_parm(ctx.config_json),
+ return cls(ctx, fsid, daemon_id, fetch_configs(ctx),
ctx.image)
def create_daemon_dirs(self, data_dir: str, uid: int, gid: int) -> None:
def init(cls, ctx: CephadmContext, fsid: str,
daemon_id: Union[int, str]) -> 'Keepalived':
return cls(ctx, fsid, daemon_id,
- get_parm(ctx.config_json), ctx.image)
+ fetch_configs(ctx), ctx.image)
def create_daemon_dirs(self, data_dir: str, uid: int, gid: int) -> None:
"""Create files under the container data dir"""
def init(cls, ctx: CephadmContext,
fsid: str, daemon_id: Union[int, str]) -> 'CustomContainer':
return cls(fsid, daemon_id,
- get_parm(ctx.config_json), ctx.image)
+ fetch_configs(ctx), ctx.image)
def create_daemon_dirs(self, data_dir: str, uid: int, gid: int) -> None:
"""
port = meta['ports'][0]
r += [f'--web.listen-address={ip}:{port}']
if daemon_type == 'prometheus':
- config = get_parm(ctx.config_json)
+ config = fetch_configs(ctx)
retention_time = config.get('retention_time', '15d')
retention_size = config.get('retention_size', '0') # default to disabled
r += [f'--storage.tsdb.retention.time={retention_time}']
host = wrap_ipv6(addr) if addr else host
r += [f'--web.external-url={scheme}://{host}:{port}']
if daemon_type == 'alertmanager':
- config = get_parm(ctx.config_json)
+ config = fetch_configs(ctx)
peers = config.get('peers', list()) # type: ignore
for peer in peers:
r += ['--cluster.peer={}'.format(peer)]
if daemon_type == 'promtail':
r += ['--config.expand-env']
if daemon_type == 'prometheus':
- config = get_parm(ctx.config_json)
+ config = fetch_configs(ctx)
try:
r += [f'--web.config.file={config["web_config"]}']
except KeyError:
pass
if daemon_type == 'node-exporter':
- config = get_parm(ctx.config_json)
+ config = fetch_configs(ctx)
try:
r += [f'--web.config={config["web_config"]}']
except KeyError:
f.write(keyring)
if daemon_type in Monitoring.components.keys():
- config_json: Dict[str, Any] = dict()
- if 'config_json' in ctx:
- config_json = get_parm(ctx.config_json)
+ config_json = fetch_configs(ctx)
# Set up directories specific to the monitoring component
config_dir = ''
# populate the config directory for the component from the config-json
if 'files' in config_json:
for fname in config_json['files']:
- content = dict_get_join(config_json['files'], fname)
+ # work around mypy wierdness where it thinks `str`s aren't Anys
+ # when used for dictionary values! feels like possibly a mypy bug?!
+ cfg = cast(Dict[str, Any], config_json['files'])
+ content = dict_get_join(cfg, fname)
if os.path.isabs(fname):
fpath = os.path.join(data_dir_root, fname.lstrip(os.path.sep))
else:
config = None
keyring = None
- if 'config_json' in ctx and ctx.config_json:
- d = get_parm(ctx.config_json)
+ d = fetch_configs(ctx)
+ if d:
config = d.get('config')
keyring = d.get('keyring')
if config and keyring:
elif daemon_type in Tracing.components:
entrypoint = ''
name = '%s.%s' % (daemon_type, daemon_id)
- config = get_parm(ctx.config_json)
+ config = fetch_configs(ctx)
Tracing.set_configuration(config, daemon_type)
envs.extend(Tracing.components[daemon_type].get('envs', []))
elif daemon_type == NFSGanesha.daemon_type:
# with systemd if this is not a reconfig
if deployment_type != DeploymentType.RECONFIG:
if daemon_type == CephadmAgent.daemon_type:
- if ctx.config_json == '-':
- config_js = get_parm('-')
- else:
- config_js = get_parm(ctx.config_json)
+ config_js = fetch_configs(ctx)
assert isinstance(config_js, dict)
cephadm_agent = CephadmAgent(ctx, fsid, daemon_id)
uid, gid = extract_uid_gid(ctx)
make_var_run(ctx, ctx.fsid, uid, gid)
- config_json: Optional[Dict[str, str]] = None
- if 'config_json' in ctx and ctx.config_json:
- config_json = get_parm(ctx.config_json)
+ config_json = fetch_configs(ctx)
c = get_deployment_container(ctx, ctx.fsid, daemon_type, daemon_id,
ptrace=ctx.allow_ptrace)
# monitoring daemon - prometheus, grafana, alertmanager, node-exporter
# Default Checks
# make sure provided config-json is sufficient
- config = get_parm(ctx.config_json) # type: ignore
+ config = fetch_configs(ctx) # type: ignore
required_files = Monitoring.components[daemon_type].get('config-json-files', list())
required_args = Monitoring.components[daemon_type].get('config-json-args', list())
if required_files: