mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-30 15:05:27 +00:00
examples/volumes/flexvolume/nfs: check for jq and simplify quoting.
This commit is contained in:
parent
a9bf44101b
commit
7d664960df
@ -48,7 +48,7 @@ domount() {
|
|||||||
SHARE=$(echo $2 | jq -r '.share')
|
SHARE=$(echo $2 | jq -r '.share')
|
||||||
|
|
||||||
if [ $(ismounted) -eq 1 ] ; then
|
if [ $(ismounted) -eq 1 ] ; then
|
||||||
log "{\"status\": \"Success\"}"
|
log '{"status": "Success"}'
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -59,14 +59,14 @@ domount() {
|
|||||||
err "{ \"status\": \"Failure\", \"message\": \"Failed to mount ${NFS_SERVER}:${SHARE} at ${MNTPATH}\"}"
|
err "{ \"status\": \"Failure\", \"message\": \"Failed to mount ${NFS_SERVER}:${SHARE} at ${MNTPATH}\"}"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
log "{\"status\": \"Success\"}"
|
log '{"status": "Success"}'
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
unmount() {
|
unmount() {
|
||||||
MNTPATH=$1
|
MNTPATH=$1
|
||||||
if [ $(ismounted) -eq 0 ] ; then
|
if [ $(ismounted) -eq 0 ] ; then
|
||||||
log "{\"status\": \"Success\"}"
|
log '{"status": "Success"}'
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -76,14 +76,19 @@ unmount() {
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
log "{\"status\": \"Success\"}"
|
log '{"status": "Success"}'
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
op=$1
|
op=$1
|
||||||
|
|
||||||
|
if ! command -v jq >/dev/null 2>&1; then
|
||||||
|
err "{ \"status\": \"Failure\", \"message\": \"'jq' binary not found. Please install jq package before using this driver\"}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "$op" = "init" ]; then
|
if [ "$op" = "init" ]; then
|
||||||
log "{\"status\": \"Success\", \"capabilities\": {\"attach\": false}}"
|
log '{"status": "Success", "capabilities": {"attach": false}}'
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -101,7 +106,7 @@ case "$op" in
|
|||||||
unmount $*
|
unmount $*
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
log "{ \"status\": \"Not supported\" }"
|
log '{"status": "Not supported"}'
|
||||||
exit 0
|
exit 0
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user