Skip to content

Commit 039dc7e

Browse files
committed
Merge branch 'twans_fix' into 'development'
TRIX-742 trix diag to return non zero exit on problems See merge request clustervision/luna2-utils!98
2 parents 2a18b5f + 5917948 commit 039dc7e

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

utils/lsosreport

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ function fetch_processes() {
6767
}
6868

6969
function fetch_logs() {
70-
for logfile in messages luna pacemaker trinity.log sssd slurm httpd nginx ondemand-nginx; do
70+
for logfile in messages luna alertx pacemaker trinity.log sssd slurm httpd nginx ondemand-nginx; do
7171
echo "== logfiles $logfile =="
7272
cp -arL /var/log/$logfile $WORK/log/ 2>&1
7373
done

utils/trinity_diagnosis.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,11 @@ def trinity_status(self, command=None):
8484
if self.controller is False:
8585
self.exit_diagnosis('Trinity Diagnosis is only Available from the Controller OR Luna2 Daemon is not present.')
8686
response = ''
87+
status = True
8788
with subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) as process:
8889
output, error = process.communicate()
8990
output = output.decode("utf-8") if output else ''
91+
status = False if error else True
9092
error = error.decode("utf-8") if error else ''
9193
response = output if output else error
9294
response = response.replace('\n', '')
@@ -102,7 +104,7 @@ def trinity_status(self, command=None):
102104
response = response.replace('could not be found', colored('could not be found', 'yellow', attrs=['bold']))
103105
response = response.strip()
104106

105-
return response
107+
return status, response
106108

107109

108110
def execute(self, command=None):
@@ -136,6 +138,7 @@ def main():
136138
"Trinity OOD": {}
137139
}
138140
debian = False
141+
status = True
139142
os_info = Diagnosis().platform_info()
140143
for _, os_value in os_info.items():
141144
if 'debian' in os_value.lower() or 'ubuntu' in os_value.lower():
@@ -146,12 +149,17 @@ def main():
146149
response["Trinity OOD"]["httpd"] = None
147150
for key, value in response.items():
148151
for service, val in value.items():
149-
response[key][service] = Diagnosis().trinity_status(f"systemctl status {service}.service | grep Active:")
152+
ret, response[key][service] = Diagnosis().trinity_status(f"systemctl status {service}.service | grep Active:")
153+
if not ret:
154+
status = False
150155
for key, value in response.items():
151156
print(colored(key, 'grey', attrs=['bold']))
152157
for service, val in value.items():
153158
print(f'\t{service}: {val}')
154159
print('\n')
160+
if status:
161+
exit(0)
162+
exit(1)
155163

156164

157165
if __name__ == "__main__":

0 commit comments

Comments
 (0)