Skip to content

Commit 7b8a453

Browse files
authored
Merge branch 'master' into update_repo_urls_on_scc_sync
2 parents 1356c65 + 98f1142 commit 7b8a453

File tree

2 files changed

+35
-36
lines changed

2 files changed

+35
-36
lines changed

support/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Supportconfig plugin development notes
22
======================================
33

4-
Library of useful functions is installed by supportutils at: /usr/lib/supportconfig/resources/scplugin.rc
4+
Library of useful functions is installed by supportutils at: /usr/lib/supportconfig/resources/supportconfig.rc
55

66
plugin functions begin with 'p'.
77

support/rmt

Lines changed: 34 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -5,31 +5,30 @@
55
# about RMT
66
# License: GPLv2
77
# Author: SCC Team <[email protected]>
8-
# Modified: 2018 April 18
8+
# Modified: 2023-12-18
99
#############################################################
1010

11-
SVER=0.0.2
12-
RCFILE="/usr/lib/supportconfig/resources/scplugin.rc"
11+
SVER='0.0.3'
12+
RCFILE="/usr/lib/supportconfig/resources/supportconfig.rc"
13+
OF='output-rmt.txt'
1314

1415
[ -s $RCFILE ] && . $RCFILE || { echo "ERROR: Initializing resource file: $RCFILE"; exit 1; }
1516

1617
## Our own helper functions
1718
validate_rpm_if_installed() {
1819
THISRPM=$1
19-
echo "#==[ Validating RPM ]=================================#"
20+
log_write $OF '#==[ Validating RPM ]=================================#'
2021
if rpm -q "$THISRPM" >/dev/null 2>&1; then
21-
echo "# rpm -V $THISRPM"
22-
23-
if rpm -V "$THISRPM"; then
24-
echo "Status: Passed"
22+
if rpm -V $THISRPM >> ${LOG}/${OF} 2>&1; then
23+
log_write $OF "Status: Passed"
2524
else
26-
echo "Status: WARNING"
25+
log_write $OF "Status: WARNING"
2726
fi
2827
else
29-
echo "package $THISRPM is not installed"
30-
echo "Status: Skipped"
28+
log_write $OF "package $THISRPM is not installed"
29+
log_write $OF "Status: Skipped"
3130
fi
32-
echo
31+
log_write $OF
3332
}
3433

3534
RPMLIST=(rmt-server nginx mariadb)
@@ -40,51 +39,51 @@ LOG_UNITS=(rmt-server.service rmt-server-migration.service rmt-server-sync.servi
4039

4140
CONF_FILES=(/etc/rmt.conf /etc/nginx/vhosts.d/rmt-server-http.conf /etc/nginx/vhosts.d/rmt-server-https.conf)
4241

43-
section_header "Supportconfig Plugin for RMT, v${SVER}"
44-
if ! rpm -q rmt-server &>/dev/null; then
45-
echo -e "ERROR: RMT rpm package ('rmt-server') not installed\n"
46-
exit 111
47-
fi
42+
log_entry $OF note "Supportconfig Plugin for RMT, v${SVER}"
43+
rpm_verify $OF rmt-server || exit 111
44+
45+
log_entry $OF note 'Packages'
4846

49-
plugin_tag "Packages"
5047
for pkg in "${RPMLIST[@]}"; do
5148
validate_rpm_if_installed "$pkg"
5249
done
5350

54-
plugin_tag "Configuration"
55-
pconf_files "$CONF_FILES"
51+
log_entry $OF note "Configuration"
52+
conf_files $OF "$CONF_FILES"
5653

57-
plugin_tag "SSL Configuration"
58-
plugin_command "ls -l /usr/share/rmt/ssl/"
54+
log_entry $OF note "SSL Configuration"
55+
log_cmd $OF "ls -l /usr/share/rmt/ssl/"
5956

6057
if systemctl --quiet is-active nginx; then
61-
plugin_command "echo | openssl s_client -showcerts -servername localhost -connect localhost:443 2>/dev/null | openssl x509 -inform pem -noout -text"
58+
log_cmd $OF "echo | openssl s_client -showcerts -servername localhost -connect localhost:443 2>/dev/null | openssl x509 -inform pem -noout -text"
6259
else
6360
for cert in /usr/share/rmt/ssl/rmt-ca.crt /usr/share/rmt/ssl/rmt-server.crt; do
64-
plugin_command "openssl x509 -inform pem -noout -text -in $cert"
61+
log_cmd $OF "openssl x509 -inform pem -noout -text -in $cert"
6562
done
6663
fi
6764

68-
plugin_tag "Service Status"
65+
log_entry $OF note "Service Status"
6966
for i in "${STATUS_UNITS[@]}"; do
70-
plugin_command "systemctl status $i"
67+
log_cmd $OF "systemctl status $i"
7168
done
7269

73-
plugin_tag "Mirroring Status"
74-
plugin_command "rmt-cli products list"
75-
plugin_command "rmt-cli repos list"
70+
log_entry $OF note "Mirroring Status"
71+
log_cmd $OF "rmt-cli products list"
72+
log_cmd $OF "rmt-cli repos list"
7673

77-
plugin_tag "Service Logs"
74+
log_entry $OF note "Service Logs"
7875
for service in "${LOG_UNITS[@]}"; do
79-
plugin_command "journalctl -n1000 -u $service"
76+
log_cmd $OF "journalctl -n1000 -u $service"
8077
done
8178

82-
plugin_tag "Custom Repos"
83-
plugin_command "rmt-cli repos custom list"
79+
log_entry $OF note "Custom Repos"
80+
log_cmd $OF "rmt-cli repos custom list"
8481
custom_repos=$(rmt-cli repos custom list --csv 2>/dev/null | sed 1d | cut -d ',' -f 1)
8582
if [ -n "$custom_repos" ]; then
8683
for custom in $custom_repos; do
87-
echo "Products bound to custom repo id: $custom"
88-
plugin_command "rmt-cli repos custom products $custom"
84+
log_write $OF "Products bound to custom repo id: $custom"
85+
log_cmd $OF "rmt-cli repos custom products $custom"
8986
done
9087
fi
88+
_sanitize_file $OF
89+

0 commit comments

Comments
 (0)