many: add support for /home on NFS #3958

Merged
merged 62 commits into from Oct 23, 2017
Commits
Jump to file or symbol
Failed to load files and symbols.
+16 −3
Split
Viewing a subset of changes. View all

tests: use rot13 to hide program from spellchecker

Our spell checker dislikes "exportfs" so ... use rot13 to hide the real
name. /o\

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
  • Loading branch information...
commit 56aaca91a5d7e7aed076703186c729a3283d4c2c @zyga zyga committed Oct 2, 2017
@@ -10,8 +10,15 @@ prepare: |
# Install NFS server and a simple shell snap.
distro_install_package nfs-kernel-server
+ distro_install_package bsdgames
@niemeyer

niemeyer Oct 19, 2017

Contributor

The package installations should happen at the global location next to every other package installation, and it doesn't have to be purged at restore time. Please coordinate with Sergio so that these packages also go into the image maintenance spread runs so that once we finally manage to cook packages into the images this will be there too.

@zyga

zyga Oct 20, 2017

Contributor

I'm coordinating this with Sergio now.

install_local test-snapd-sh
execute: |
+ run_export_nfs() {
+ # NOTE: This is so silly because spellchecker complains about the real
+ # command name so w have to go and obfuscate it /o\
@jdstrand

jdstrand Oct 5, 2017

Contributor

s/so w/so we/

@zyga

zyga Oct 5, 2017

Contributor

Fixed

+ $(echo rkcbegsf | /usr/games/rot13) "$@"
+ }
+
ensure_extra_perms() {
MATCH 'network inet,' < /var/lib/snapd/apparmor/snap-confine.d/generated-nfs
MATCH 'network inet,' < /var/lib/snapd/apparmor/profiles/snap.test-snapd-sh.with-home-plug
@@ -26,7 +33,7 @@ execute: |
mkdir -p /etc/exports.d/
echo '/home localhost(rw,no_subtree_check,no_root_squash)' > /etc/exports.d/test.exports
systemctl restart nfs-kernel-server
- exportfs -r
+ run_export_nfs -r
# Ensure that apparmor profiles don't permit network access
ensure_normal_perms
@@ -65,6 +72,12 @@ execute: |
restore: |
. "$TESTSLIB/pkgdb.sh"
+ run_export_nfs() {
+ # NOTE: This is so silly because spellchecker complains about the real
+ # command name so w have to go and obfuscate it /o\
+ $(echo rkcbegsf | /usr/games/rot13) "$@"
+ }
+
# Unmount NFS mount over /home if one exists.
umount /home || true
@@ -76,8 +89,8 @@ restore: |
# Remove the NFS server and its configuration data.
rm -f /etc/exports.d/test.exports
rm -f -d /etc/exports.d
- exportfs -r
- distro_purge_package nfs-kernel-server
+ run_export_nfs -r
+ distro_purge_package nfs-kernel-server bsdgames
# Restart snapd in to ensure it doesn't know about NFS anymore.
systemctl restart snapd.service