[lxc-devel] [lxc/master] lxc-oci: cmd parsing and less verbose umoci

flx42 on Github lxc-bot at linuxcontainers.org
Thu Mar 29 18:19:57 UTC 2018


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 301 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20180329/474a30b2/attachment.bin>
-------------- next part --------------
From d99e3b2ea72f99c8d8809cb6d774d1cdcc6e8dda Mon Sep 17 00:00:00 2001
From: Felix Abecassis <fabecassis at nvidia.com>
Date: Thu, 29 Mar 2018 10:20:31 -0700
Subject: [PATCH 1/2] lxc-oci: fix Cmd/Entrypoint parsing

Don't use the -r option of jq, since it will strip the double quotes.

Fixes: #2195
Signed-off-by: Felix Abecassis <fabecassis at nvidia.com>
---
 templates/lxc-oci.in | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/templates/lxc-oci.in b/templates/lxc-oci.in
index d843a079e..4dca46ac0 100644
--- a/templates/lxc-oci.in
+++ b/templates/lxc-oci.in
@@ -100,8 +100,8 @@ getep() {
 
   configpath="$1"
 
-  ep=$(jq -c -r '.config.Entrypoint[]?'< "${configpath}")
-  cmd=$(jq -c -r '.config.Cmd[]?' < "${configpath}")
+  ep=$(jq -c '.config.Entrypoint[]?'< "${configpath}" | tr '\n' ' ')
+  cmd=$(jq -c '.config.Cmd[]?'< "${configpath}" | tr '\n' ' ')
   if [ -z "${ep}" ]; then
     ep="${cmd}"
     if [ -z "${ep}" ]; then

From 845ba283d6dedc4719096c4099e82e7517f074aa Mon Sep 17 00:00:00 2001
From: Felix Abecassis <fabecassis at nvidia.com>
Date: Thu, 29 Mar 2018 10:21:22 -0700
Subject: [PATCH 2/2] lxc-oci: make umoci less verbose

Signed-off-by: Felix Abecassis <fabecassis at nvidia.com>
---
 templates/lxc-oci.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/templates/lxc-oci.in b/templates/lxc-oci.in
index 4dca46ac0..d4fef193e 100644
--- a/templates/lxc-oci.in
+++ b/templates/lxc-oci.in
@@ -312,7 +312,7 @@ if [ -n "$LXC_MAPPED_UID" ] && [ "$LXC_MAPPED_UID" != "-1" ]; then
 fi
 # shellcheck disable=SC2039
 # shellcheck disable=SC2068
-umoci unpack ${umoci_args[@]} --image "${DOWNLOAD_TEMP}:latest" "${LXC_ROOTFS}.tmp"
+umoci --log=error unpack ${umoci_args[@]} --image "${DOWNLOAD_TEMP}:latest" "${LXC_ROOTFS}.tmp"
 rmdir "${LXC_ROOTFS}"
 mv "${LXC_ROOTFS}.tmp/rootfs" "${LXC_ROOTFS}"
 


More information about the lxc-devel mailing list