The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/4252

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===
Signed-off-by: Free Ekanayaka <free.ekanay...@canonical.com>
From 13e07959c3c6f1a1446373dd158f49faa3e43e46 Mon Sep 17 00:00:00 2001
From: Free Ekanayaka <free.ekanay...@canonical.com>
Date: Tue, 13 Feb 2018 06:06:16 +0000
Subject: [PATCH] Check for LXC version to decide which apparmor profile config
 key to use

Signed-off-by: Free Ekanayaka <free.ekanay...@canonical.com>
---
 test/suites/config.sh | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/test/suites/config.sh b/test/suites/config.sh
index 4c97391a3..aa69210c4 100644
--- a/test/suites/config.sh
+++ b/test/suites/config.sh
@@ -153,8 +153,20 @@ test_config_profiles() {
   lxc profile device add onenic eth0 nic nictype=p2p
   lxc profile assign foo onenic
   lxc profile create unconfined
-  lxc profile set unconfined raw.lxc "lxc.apparmor.profile=unconfined"
+
+  # Look at the LXC version to decide whether to use the new
+  # or the new config key for apparmor.
+  lxc_version=$(lxc info | grep "driver_version: " | cut -d' ' -f4)
+  lxc_major=$(echo "${lxc_version}" | cut -d. -f1)
+  lxc_minor=$(echo "${lxc_version}" | cut -d. -f2)
+  if [ "${lxc_major}" -lt 2 ] || ([ "${lxc_major}" = "2" ] && [ "${lxc_minor}" 
-lt "1" ]); then
+      lxc profile set unconfined raw.lxc "lxc.aa_profile=unconfined"
+  else
+      lxc profile set unconfined raw.lxc "lxc.apparmor.profile=unconfined"
+  fi
+
   lxc profile assign foo onenic,unconfined
+
   # test profile rename
   lxc profile create foo
   lxc profile rename foo bar
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to