Skip to content

Instantly share code, notes, and snippets.

@adam-stokes
Last active April 3, 2018 16:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adam-stokes/74e473f017641490f39db4a8586e6f3a to your computer and use it in GitHub Desktop.
Save adam-stokes/74e473f017641490f39db4a8586e6f3a to your computer and use it in GitHub Desktop.
verify parsing version string
diff --git a/canonical-kubernetes/steps/00_process-providertype/before-deploy b/canonical-kubernetes/steps/00_process-providertype/before-deploy
index 49d0a3b..7f7680a 100755
--- a/canonical-kubernetes/steps/00_process-providertype/before-deploy
+++ b/canonical-kubernetes/steps/00_process-providertype/before-deploy
@@ -6,7 +6,13 @@ set -eux
if [[ "$JUJU_PROVIDERTYPE" == "localhost" ]]; then
debug "Running pre-deploy for $CONJURE_UP_SPELL"
- sed "s/##MODEL##/$JUJU_MODEL/" "$(scriptPath)/lxd-profile.yaml" | lxc profile edit "juju-$JUJU_MODEL"
+ lxc_aa_profile="lxc.aa_profile"
+ version=$(lxc --version)
+ version_arr=(${version//./})
+ if [[ "${version_arr[0]}" -gt "2" ]]; then
+ lxc_aa_profile="lxc.apparmor.profile"
+ fi
+ cat "$(scriptPath)/lxd-profile.yaml" | sed "s/##MODEL##/$JUJU_MODEL/" | sed "s/##AA_PROFILE##/$lxc_aa_profile/" | lxc profile edit "juju-$JUJU_MODEL"
fi
cluster_tag="$JUJU_MODEL-$(pwgen -0AB 4 1)"
diff --git a/canonical-kubernetes/steps/00_process-providertype/lxd-profile.yaml b/canonical-kubernetes/steps/00_process-providertype/lxd-profile.yaml
index b24e7f2..fede5a9 100644
--- a/canonical-kubernetes/steps/00_process-providertype/lxd-profile.yaml
+++ b/canonical-kubernetes/steps/00_process-providertype/lxd-profile.yaml
@@ -3,7 +3,7 @@ config:
boot.autostart: "true"
linux.kernel_modules: ip_tables,ip6_tables,netlink_diag,nf_nat,overlay
raw.lxc: |
- lxc.aa_profile=unconfined
+ ##AA_PROFILE##=unconfined
lxc.mount.auto=proc:rw sys:rw
lxc.cap.drop=
security.nesting: "true"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment