Daniel P. Berrange wrote: > On Tue, Mar 03, 2009 at 05:43:28PM +0100, Jim Meyering wrote: >> >From 0e79e00614e8c6cd2b7fe7bcad1d52b2de1a3a58 Mon Sep 17 00:00:00 2001 >> From: Jim Meyering <meyering@xxxxxxxxxx> >> Date: Tue, 3 Mar 2009 17:42:53 +0100 >> Subject: [PATCH] * qemud/libvirtd_qemu.aug: Add "security_driver". >> >> --- >> qemud/libvirtd.conf | 4 ++-- >> qemud/libvirtd_qemu.aug | 2 +- > > If changing this, should also change qemud/test_libvirtd_qemu.aug > so it validates the parsing of it. Hmm... rather than continue the duplication, [qemud/test_libvirtd_qemu.aug has the entire content of src/qemu.conf two times, first with double quotes escaped, second with curly braces] this patch makes it so test_libvirtd_qemu.aug is generated, and by doing that, adds coverage for "security_driver". The same code should work for test_libvirtd.aug. >From 8ff1830e4c5584cdfc0755b512c400dd60d6bc7e Mon Sep 17 00:00:00 2001 From: Jim Meyering <meyering@xxxxxxxxxx> Date: Tue, 3 Mar 2009 19:31:49 +0100 Subject: [PATCH] Generate augeas test file from qemu.conf, to test new "security_driver" * qemud/Makefile.am (test_libvirtd_qemu.aug): New rule. * qemud/test_libvirtd_qemu.aug: Regenerate to reflect the addition of the new "security_driver" configuration parameter. --- qemud/Makefile.am | 14 ++++++++++++++ qemud/test_libvirtd_qemu.aug | 18 ++++++++++++++++++ 2 files changed, 32 insertions(+), 0 deletions(-) diff --git a/qemud/Makefile.am b/qemud/Makefile.am index 924e8ad..fa56ed8 100644 --- a/qemud/Makefile.am +++ b/qemud/Makefile.am @@ -252,6 +252,20 @@ check-local: test -x '$(AUGPARSE)' \ && '$(AUGPARSE)' -I $(srcdir) $(srcdir)/test_libvirtd_qemu.aug || : +# Generate augeas test file from qemu.conf. +test_libvirtd_qemu.aug: $(top_srcdir)/src/qemu.conf + ( printf 'module Test_libvirtd_qemu =\n' \ + && printf '\n let conf = "' \ + && perl -pe 's/^# (\w+ =)/$$1/;s/"/\\"/g' $< \ + && printf '"\n\n test Libvirtd_qemu.lns get conf =\n' \ + && perl -pe 's/^# (\w+ =)/$$1/;' \ + -e 's/^# *([^\n]*)/{ "#comment" = "$$1" }/;' \ + -e 's/^$$/{ "#empty" }/;' \ + -e 's/^(\w+) =/"$$1" =/;' \ + -e 's/ = ([^"]\S*)$$/ = "$$1"/;' \ + -e 's/^(".*)/{ $$1 }/;' $<; \ + ) > $@-t && mv $@-t $@ + else install-init: diff --git a/qemud/test_libvirtd_qemu.aug b/qemud/test_libvirtd_qemu.aug index 083ccba..518336b 100644 --- a/qemud/test_libvirtd_qemu.aug +++ b/qemud/test_libvirtd_qemu.aug @@ -60,6 +60,15 @@ vnc_tls_x509_verify = 1 # example here before you set this # vnc_password = \"XYZ12345\" + + +# The default security driver is SELinux. If SELinux is disabled +# on the host, then the security driver will automatically disable +# itself. If you wish to disable QEMU SELinux security driver while +# leaving SELinux enabled for the host in general, then set this +# to 'none' instead +# +security_driver = \"selinux\" " test Libvirtd_qemu.lns get conf = @@ -123,3 +132,12 @@ vnc_password = \"XYZ12345\" { "#comment" = "example here before you set this" } { "#comment" = "" } { "vnc_password" = "XYZ12345" } +{ "#empty" } +{ "#empty" } +{ "#comment" = "The default security driver is SELinux. If SELinux is disabled" } +{ "#comment" = "on the host, then the security driver will automatically disable" } +{ "#comment" = "itself. If you wish to disable QEMU SELinux security driver while" } +{ "#comment" = "leaving SELinux enabled for the host in general, then set this" } +{ "#comment" = "to 'none' instead" } +{ "#comment" = "" } +{ "security_driver" = "selinux" } -- 1.6.2.rc1.285.gc5f54 -- Libvir-list mailing list Libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list