Skip to content

Commit

Permalink
co inspect
Browse files Browse the repository at this point in the history
  • Loading branch information
paigerube14 authored and chaitanyaenr committed Jul 7, 2022
1 parent 4148fc0 commit c27af88
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
15 changes: 13 additions & 2 deletions cerberus/inspect/inspect.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os
import logging

import cerberus.invoke.command as runcommand


Expand All @@ -9,12 +10,22 @@ def delete_inspect_directory():
if os.path.isdir("inspect_data/"):
logging.info("Deleting existing inspect_data directory")
runcommand.invoke("rm -R inspect_data")
runcommand.invoke("mkdir inspect_data")


def inspect_component(namespace):
dir_name = "inspect_data/" + namespace + "-logs"
if os.path.isdir(dir_name):
runcommand.invoke("rm -R " + dir_name)
logging.info("Deleted existing %s directory" % (dir_name))
command_out = runcommand.invoke("oc adm inspect ns/" + namespace + " --dest" "-dir=" + dir_name + " | tr -d '\n'")
logging.info(command_out)
runcommand.invoke("oc adm inspect ns/" + namespace + " --dest-dir=" + dir_name + " | tr -d '\n'")
logging.info("Inspecting namespace %s into %s" % (namespace, dir_name))


def inspect_operator(operator):
dir_name = "inspect_data/" + operator + "-logs.out"
if os.path.isdir(dir_name):
runcommand.invoke("rm -R " + dir_name)
logging.info("Deleted existing %s directory" % (dir_name))
runcommand.invoke("oc adm inspect clusteroperator/" + operator + " --dest-dir=" + dir_name)
logging.info("Inspecting cluster operator %s into %s" % (operator, dir_name))
3 changes: 2 additions & 1 deletion start_cerberus.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,10 +300,11 @@ def main(cfg):
logging.info("%s\n" % (failed_nodes))
dbcli.insert(datetime.now(), time.time(), 1, "not ready", failed_nodes, "node")

if not watch_cluster_operators_status:
if not watch_cluster_operators_status and distribution == "openshift" and watch_cluster_operators:
logging.info("Iteration %s: Failed operators" % (iteration))
logging.info("%s\n" % (failed_operators))
dbcli.insert(datetime.now(), time.time(), 1, "degraded", failed_operators, "cluster operator")
pool.map(inspect.inspect_operator, failed_operators)

if not server_status:
logging.info(
Expand Down

0 comments on commit c27af88

Please sign in to comment.