ceph-daemon: do not pass -it unless it is an interactive shell#31181
ceph-daemon: do not pass -it unless it is an interactive shell#31181liewegas merged 1 commit intoceph:masterfrom
Conversation
jenkins test make check |
|
jenkins test make check |
|
the LANG=C was unconditoinally set in the shell_cmd() method. updated to be consistent!
|
| '--env', 'LANG=C', | ||
| ] | ||
| c = get_container(args.fsid, daemon_type, daemon_id, | ||
| podman_args=podman_args) |
There was a problem hiding this comment.
get_container needs a podman_args cmd
diff --git a/src/ceph-daemon b/src/ceph-daemon
index 94563545b7..369f55624e 100755
--- a/src/ceph-daemon
+++ b/src/ceph-daemon
@@ -365,8 +365,7 @@ def get_container_mounts(fsid, daemon_type, daemon_id):
return mounts
-def get_container(fsid, daemon_type, daemon_id, privileged=False):
- podman_args = []
+def get_container(fsid, daemon_type, daemon_id, privileged=False, podman_args=[]):
if daemon_type == 'osd' or privileged:
podman_args += ['--privileged']
return CephContainer(
There was a problem hiding this comment.
Note that in python you should not use an object like a list as a default argument - it does not work as you might expect: https://stackoverflow.com/a/366430
There was a problem hiding this comment.
weird. updated! (and ran test_ceph_daemon this time)
src/ceph-daemon
Outdated
| podman_args=['--privileged'], | ||
| podman_args=podman_args, | ||
| volume_mounts=mounts) | ||
| return subprocess.call(c.shell_cmd(args.command)) |
There was a problem hiding this comment.
Minor fixup for shell cmd when no args are passed -
| return subprocess.call(c.shell_cmd(args.command)) | |
| return subprocess.call(c.shell_cmd(command)) |
# ./ceph-daemon shell
Traceback (most recent call last):
File "./ceph-daemon", line 1683, in <module>
r = args.func()
File "./ceph-daemon", line 1145, in command_shell
return subprocess.call(c.shell_cmd(args.command))
File "./ceph-daemon", line 714, in shell_cmd
] + cmd[1:]
IndexError: list index out of rang
There was a problem hiding this comment.
sigh, fixed. I want to do something like
diff --git a/qa/standalone/test_ceph_daemon.sh b/qa/standalone/test_ceph_daemon.sh
index 69ecb242646..af17925f1c1 100755
--- a/qa/standalone/test_ceph_daemon.sh
+++ b/qa/standalone/test_ceph_daemon.sh
@@ -133,6 +133,7 @@ $SUDO $CEPH_DAEMON unit --fsid $FSID --name mon.a -- is-enabled
## shell
$SUDO $CEPH_DAEMON --image $IMAGE shell -- true
$SUDO $CEPH_DAEMON --image $IMAGE shell --fsid $FSID -- test -d /var/log/ceph
+echo 'whoami ; exit' | $SUDO $CEPH_DAEMON --image $IMAGE shell
## enter
expect_false $SUDO $CEPH_DAEMON enter
@@ -142,6 +143,8 @@ $SUDO $CEPH_DAEMON enter --fsid $FSID --name mon.a -- pidof ceph-mon
expect_false $SUDO $CEPH_DAEMON enter --fsid $FSID --name mgr.x -- pidof ceph-mon
$SUDO $CEPH_DAEMON enter --fsid $FSID --name mgr.x -- pidof ceph-mgr
+echo 'pidof ceph-mgr ; exit' | $SUDO $CEPH_DAEMON enter --fsid $FSID --name mgr.x
+
## ceph-volume
$SUDO $CEPH_DAEMON --image $IMAGE ceph-volume --fsid $FSID -- inventory --format=json \
| jq '.[]'
but i have a feeling this needs to use something like expect since there is maybe no tty?
There was a problem hiding this comment.
Or maybe remove the -t option since a pty is not in use?
diff --git a/src/ceph-daemon b/src/ceph-daemon
index 949af8ffb2..c698ae152b 100755
--- a/src/ceph-daemon
+++ b/src/ceph-daemon
@@ -1138,7 +1138,7 @@ def command_shell():
else:
command = ['bash']
podman_args += [
- '-it',
+ '-i',
'--env', 'LANG=C',
]
c = CephContainer(
@@ -1159,7 +1159,7 @@ def command_enter():
else:
command = ['bash']
podman_args += [
- '-it',
+ '-i',
'--env', 'LANG=C',
]
c = get_container(args.fsid, daemon_type, daemon_id,
1450af2 to
e177212
Compare
Otherwise, we get errors like 2019-10-26T17:29:42.004 INFO:tasks.workunit.client.0.mira109.stderr:+ sudo /usr/sbin/ceph-daemon shell -- ceph -v 2019-10-26T17:29:42.004 INFO:tasks.workunit.client.0.mira109.stderr:+ grep 'ceph version' 2019-10-26T17:29:42.149 INFO:tasks.workunit.client.0.mira109.stderr:the input device is not a TTY Fixes: https://tracker.ceph.com/issues/42499 Signed-off-by: Sage Weil <sage@redhat.com>
* refs/pull/31181/head: ceph-daemon: only pass podman -it if need an interactive shell Reviewed-by: Sebastian Wagner <swagner@suse.com> Reviewed-by: Michael Fritch <mfritch@suse.com>
Checklist
Show available Jenkins commands
jenkins retest this pleasejenkins test crimson perfjenkins test signedjenkins test make checkjenkins test make check arm64jenkins test submodulesjenkins test dashboardjenkins test dashboard backendjenkins test docsjenkins render docs