Compare commits

..

No commits in common. "9714ac20b2034497ce028eb7c9e6125c8ad61782" and "4c6aabec6a379887f16bc5e99fd37429c5046763" have entirely different histories.

7 changed files with 15 additions and 21 deletions

View File

@ -671,9 +671,9 @@ def cli_cluster_maintenance_off():
@format_opt( @format_opt(
{ {
"pretty": cli_cluster_task_format_pretty, "pretty": cli_cluster_task_format_pretty,
"raw": lambda d: ( "raw": lambda d: "\n".join([t["id"] for t in d])
"\n".join([t["id"] for t in d]) if isinstance(d, list) else d["state"] if isinstance(d, list)
), else d["state"],
"json": lambda d: jdumps(d), "json": lambda d: jdumps(d),
"json-pretty": lambda d: jdumps(d, indent=2), "json-pretty": lambda d: jdumps(d, indent=2),
} }

View File

@ -580,11 +580,9 @@ def cli_cluster_fault_list_format_long(CLI_CONFIG, fault_data):
fault_id=fault["id"], fault_id=fault["id"],
fault_status=fault["status"].title(), fault_status=fault["status"].title(),
fault_health_delta=f"-{fault['health_delta']}%", fault_health_delta=f"-{fault['health_delta']}%",
fault_acknowledged_at=( fault_acknowledged_at=fault["acknowledged_at"]
fault["acknowledged_at"] if fault["acknowledged_at"] != ""
if fault["acknowledged_at"] != "" else "N/A",
else "N/A"
),
fault_last_reported=fault["last_reported"], fault_last_reported=fault["last_reported"],
fault_first_reported=fault["first_reported"], fault_first_reported=fault["first_reported"],
) )

View File

@ -1765,9 +1765,9 @@ def format_info(config, domain_information, long_output):
tags_name=tag["name"], tags_name=tag["name"],
tags_type=tag["type"], tags_type=tag["type"],
tags_protected=str(tag["protected"]), tags_protected=str(tag["protected"]),
tags_protected_colour=( tags_protected_colour=ansiprint.green()
ansiprint.green() if tag["protected"] else ansiprint.blue() if tag["protected"]
), else ansiprint.blue(),
end=ansiprint.end(), end=ansiprint.end(),
) )
) )

View File

@ -320,11 +320,7 @@ def get_list_osd(zkhandler, limit=None, is_fuzzy=True):
# #
def getPoolInformation(zkhandler, pool): def getPoolInformation(zkhandler, pool):
# Parse the stats data # Parse the stats data
( (pool_stats_raw, tier, pgs,) = zkhandler.read_many(
pool_stats_raw,
tier,
pgs,
) = zkhandler.read_many(
[ [
("pool.stats", pool), ("pool.stats", pool),
("pool.tier", pool), ("pool.tier", pool),

View File

@ -244,9 +244,9 @@ def get_parsed_configuration(config_file):
] ]
][0] ][0]
config_cluster_networks_specific[f"{network_type}_dev_ip"] = ( config_cluster_networks_specific[
f"{list(network.hosts())[address_id]}/{network.prefixlen}" f"{network_type}_dev_ip"
) ] = f"{list(network.hosts())[address_id]}/{network.prefixlen}"
config = {**config, **config_cluster_networks_specific} config = {**config, **config_cluster_networks_specific}

View File

@ -231,7 +231,7 @@ class NetstatsInstance(object):
# Get a list of all active interfaces # Get a list of all active interfaces
net_root_path = "/sys/class/net" net_root_path = "/sys/class/net"
all_ifaces = list() all_ifaces = list()
for _, dirnames, _ in walk(net_root_path): for (_, dirnames, _) in walk(net_root_path):
all_ifaces.extend(dirnames) all_ifaces.extend(dirnames)
all_ifaces.sort() all_ifaces.sort()

View File

@ -743,7 +743,7 @@ def node_keepalive(logger, config, zkhandler, this_node, netstats):
# Get node performance statistics # Get node performance statistics
this_node.memtotal = int(psutil.virtual_memory().total / 1024 / 1024) this_node.memtotal = int(psutil.virtual_memory().total / 1024 / 1024)
this_node.memused = int(psutil.virtual_memory().used / 1024 / 1024) this_node.memused = int(psutil.virtual_memory().used / 1024 / 1024)
this_node.memfree = int(psutil.virtual_memory().available / 1024 / 1024) this_node.memfree = int(psutil.virtual_memory().free / 1024 / 1024)
this_node.cpuload = round(os.getloadavg()[0], 2) this_node.cpuload = round(os.getloadavg()[0], 2)
# Get node network statistics via netstats instance # Get node network statistics via netstats instance