File tree Expand file tree Collapse file tree 3 files changed +83
-0
lines changed
tests/RobotFramework/tests/tedge/diag Expand file tree Collapse file tree 3 files changed +83
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+ set -e
3+
4+ OUTPUT_DIR=" "
5+ TEDGE_CONFIG_DIR=${TEDGE_CONFIG_DIR:-/ etc/ tedge}
6+ COMMAND=" "
7+
8+ # Parse arguments
9+ while [ $# -gt 0 ]; do
10+ case " $1 " in
11+ --output-dir)
12+ OUTPUT_DIR=" $2 "
13+ shift 2
14+ ;;
15+ --config-dir)
16+ TEDGE_CONFIG_DIR=" $2 "
17+ shift 2
18+ ;;
19+ collect)
20+ COMMAND=" collect"
21+ shift
22+ ;;
23+ * )
24+ shift
25+ ;;
26+ esac
27+ done
28+
29+ # Check if the output directory exists
30+ if [ -n " $OUTPUT_DIR " ] && [ ! -d " $OUTPUT_DIR " ]; then
31+ echo " Error: Output directory does not exist: $OUTPUT_DIR " >&2
32+ exit 1
33+ fi
34+
35+ collect () {
36+ # Directory listing
37+ if [ -d /etc/ssl/certs ]; then
38+ # list certs and show symlinks
39+ ls -l /etc/ssl/certs > " $OUTPUT_DIR /etc_ssl_certs.txt" || :
40+ else
41+ echo " Directory /etc/ssl/certs does not exist" >&2
42+ fi
43+
44+ if [ -f /etc/ssl/certs/ca-certificates.crt ]; then
45+ echo " Copying /etc/ssl/certs/ca-certificates.crt" >&2
46+ cp -a /etc/ssl/certs/ca-certificates.crt " $OUTPUT_DIR /"
47+ else
48+ echo " File /etc/ssl/certs/ca-certificates.crt does not exist" >&2
49+ fi
50+
51+ # Check for ca-certificates package
52+ if command -V dpkg > /dev/null 2>&1 ; then
53+ echo " dpkg ca-certificates package" >&2
54+ dpkg --list | grep ca-certificates >&2 || :
55+ fi
56+ }
57+
58+ # Execute the specified command
59+ case " $COMMAND " in
60+ collect)
61+ collect
62+ ;;
63+ * )
64+ echo " Unknown command" >&2
65+ exit 1
66+ ;;
67+ esac
68+
69+ exit 0
Original file line number Diff line number Diff line change @@ -170,6 +170,11 @@ contents:
170170 file_info :
171171 mode : 0755
172172
173+ - src : ./configuration/contrib/diag-plugins/08_truststore.sh
174+ dst : /usr/share/tedge/diag-plugins/
175+ file_info :
176+ mode : 0755
177+
173178 - src : ./configuration/contrib/diag-plugins/template.sh.ignore
174179 dst : /usr/share/tedge/diag-plugins/
175180 file_info :
Original file line number Diff line number Diff line change @@ -79,6 +79,15 @@ Test Tags theme:troubleshooting theme:cli theme:plugins
7979 Should Be True int(${log_line_count } ) <= 1000
8080 Execute Command diff /var/log/mosquitto/mosquitto.log /results/test/07_mosquitto/mosquitto.log
8181
82+ 08_truststore
83+ ${log_names } = Create List
84+ ... output.log
85+ ... etc_ssl_certs.txt
86+ ... ca-certificates.crt
87+ FOR ${log_name } IN @{log_names }
88+ File Size Is Not Zero ${log_name }
89+ END
90+
8291
8392*** Keywords ***
8493File Size Is Not Zero
You can’t perform that action at this time.
0 commit comments