wrapper script to overcome redirection + sudo behavior

Signed-off-by: Travis Glenn Hansen <travisghansen@yahoo.com>
This commit is contained in:
Travis Glenn Hansen 2024-03-03 14:19:46 -07:00
parent 6ada2684f3
commit 57f74ce665
3 changed files with 22 additions and 4 deletions

View File

@ -47,6 +47,7 @@ LABEL org.opencontainers.image.url https://github.com/democratic-csi/democratic-
LABEL org.opencontainers.image.licenses MIT
ENV DEBIAN_FRONTEND=noninteractive
ENV DEMOCRATIC_CSI_IS_CONTAINER=true
ARG TARGETPLATFORM
ARG BUILDPLATFORM
@ -96,6 +97,9 @@ RUN chmod +x /usr/local/sbin/iscsiadm
ADD docker/multipath /usr/local/sbin
RUN chmod +x /usr/local/sbin/multipath
ADD docker/simple-file-writer /usr/local/bin
RUN chmod +x /usr/local/bin/simple-file-writer
## USE_HOST_MOUNT_TOOLS=1
ADD docker/mount /usr/local/bin/mount
RUN chmod +x /usr/local/bin/mount

3
docker/simple-file-writer Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash
echo ${1} > ${2}

View File

@ -2021,11 +2021,22 @@ class FreeNASSshDriver extends ControllerZfsBaseDriver {
*
* midclt resync_lun_size_for_zvol tank/foo/bar
* works on SCALE only ^
*
*/
command = execClient.buildCommand("sh", [
"-c",
`echo 1 > /sys/kernel/scst_tgt/devices/${kName}/resync_size`,
]);
if (process.env.DEMOCRATIC_CSI_IS_CONTAINER == "true") {
// TODO: syntax fails with sudo
command = execClient.buildCommand("sh", [
"-c",
`echo 1 > /sys/kernel/scst_tgt/devices/${kName}/resync_size`,
]);
} else {
// use the built-in wrapper script that works with sudo
command = execClient.buildCommand("simple-file-writer", [
"1",
`/sys/kernel/scst_tgt/devices/${kName}/resync_size`,
]);
}
reload = true;
} else {
switch (apiVersion) {