From c37504e81c80064932dccc93624d2c9ce83bf84d Mon Sep 17 00:00:00 2001 From: Michael Fritch Date: Fri, 31 Jan 2020 08:14:29 -0700 Subject: [PATCH] cephadm: simplify Monitoring.components structure by removing the nested image/metadata dict Signed-off-by: Michael Fritch --- src/cephadm/cephadm | 50 +++++++++++++++++++-------------------------- 1 file changed, 21 insertions(+), 29 deletions(-) diff --git a/src/cephadm/cephadm b/src/cephadm/cephadm index 6bb3503b042bb..690bf7cd66421 100755 --- a/src/cephadm/cephadm +++ b/src/cephadm/cephadm @@ -96,37 +96,31 @@ class Monitoring(object): components = { "prometheus": { - "image": { - "image": "prom/prometheus:latest", - "cpus": '2', - "memory": '4GB', - "args": [ - "--config.file=/etc/prometheus/prometheus.yml", - "--storage.tsdb.path=/prometheus", - "--web.listen-address=:{}".format(port_map['prometheus']), - ] - }, + "image": "prom/prometheus:latest", + "cpus": '2', + "memory": '4GB', + "args": [ + "--config.file=/etc/prometheus/prometheus.yml", + "--storage.tsdb.path=/prometheus", + "--web.listen-address=:{}".format(port_map['prometheus']), + ], "config-json": [ "prometheus.yml", ], }, "node-exporter": { - "image": { - "image": "prom/node-exporter", - "cpus": "1", - "memory": "1GB", - "args": [ - "--no-collector.timex", - ], - } + "image": "prom/node-exporter", + "cpus": "1", + "memory": "1GB", + "args": [ + "--no-collector.timex", + ], }, "grafana": { - "image": { - "image": "pcuzner/ceph-grafana-el8:latest", - "cpus": "2", - "memory": "4GB", - "args": [], - }, + "image": "pcuzner/ceph-grafana-el8:latest", + "cpus": "2", + "memory": "4GB", + "args": [], "config-json": [ "grafana.ini", "provisioning/datasources/ceph-dashboard.yml", @@ -885,8 +879,7 @@ def get_daemon_args(fsid, daemon_type, daemon_id): '--default-mon-cluster-log-to-stderr=true', ] elif daemon_type in Monitoring.components: - component = Monitoring.components[daemon_type] - metadata = component.get('image', list()) + metadata = Monitoring.components[daemon_type] r += metadata.get('args', list()) return r @@ -1986,10 +1979,9 @@ def command_deploy(): uid, gid = extract_uid_gid(file_path='/var/lib/grafana') else: raise Error("{} not implemented yet".format(daemon_type)) - + # Monitoring metadata is nested dicts, so asking mypy to ignore - m = Monitoring.components[daemon_type] - metadata = m.get('image', dict()) + metadata = Monitoring.components[daemon_type] monitoring_args = [ '--user', str(uid), -- 2.39.5