Skip to content

Commit 54be404

Browse files
committed
fix reversed equals error
Signed-off-by: Avi Deitcher <avi@deitcher.net>
1 parent f0b0027 commit 54be404

File tree

4 files changed

+66
-1
lines changed

4 files changed

+66
-1
lines changed

pkg/init/cmd/service/system_init.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ func systemInitCmd(ctx context.Context, args []string) {
8585

8686
// look for containerd options
8787
ctrdArgs := []string{}
88-
if b, err := ioutil.ReadFile(containerdOptsFile); err != nil {
88+
if b, err := ioutil.ReadFile(containerdOptsFile); err == nil {
8989
ctrdArgs = strings.Fields(string(b))
9090
}
9191

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/sh
2+
3+
function failed {
4+
printf "containerd commandline vars not set: FAILED\n" >/dev/console
5+
/sbin/poweroff -f
6+
exit 1
7+
}
8+
9+
ps -ef | grep containerd | grep -q trace || failed
10+
11+
printf "containerd commandline vars test suite PASSED\n" >/dev/console
12+
13+
/sbin/poweroff -f
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/sh
2+
# SUMMARY: Check that the containerd command-line options have been enabled by init
3+
# LABELS:
4+
# REPEAT:
5+
6+
set -e
7+
8+
# Source libraries. Uncomment if needed/defined
9+
#. "${RT_LIB}"
10+
. "${RT_PROJECT_ROOT}/_lib/lib.sh"
11+
NAME=init_containerd
12+
13+
clean_up() {
14+
rm -rf ${NAME}-*
15+
}
16+
trap clean_up EXIT
17+
18+
# Test code goes here
19+
linuxkit build -format kernel+initrd -name "${NAME}" test.yml
20+
RESULT="$(linuxkit run $NAME)"
21+
echo "${RESULT}"
22+
echo "${RESULT}" | grep -q "suite PASSED"
23+
24+
exit 0
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
kernel:
2+
image: linuxkit/kernel:5.4.39
3+
cmdline: "console=ttyS0 console=ttyAMA0"
4+
init:
5+
- linuxkit/init:4f6508f4f35b134dda3807bb5d75c117c193a86a
6+
- linuxkit/runc:v0.8
7+
- linuxkit/containerd:a4aa19c608556f7d786852557c36136255220c1f
8+
- linuxkit/ca-certificates:v0.8
9+
services:
10+
- name: test
11+
image: alpine:3.11
12+
pid: host
13+
binds:
14+
- /check.sh:/check.sh
15+
- /dev/console:/dev/console
16+
capabilities:
17+
- CAP_SYS_BOOT
18+
command: ["sh", "/check.sh"]
19+
files:
20+
- path: check.sh
21+
source: ./check.sh
22+
- path: /etc/containerd/cli-opts
23+
contents: "--log-level trace"
24+
trust:
25+
org:
26+
- linuxkit
27+
image:
28+
- alpine:3.11

0 commit comments

Comments
 (0)