From 333b05cce0415d0ae34007ea352aa78db3c499e7 Mon Sep 17 00:00:00 2001 From: Ulrik Haugen <qha@lysator.liu.se> Date: Mon, 13 Apr 2015 14:27:59 +0200 Subject: [PATCH] further tweaks to be able to use sudo as fakeroot. update copyright statement. fakeroot: tweak example sudoers config further. %.testoutput targets: call env inside $(fakeroot) to keep it from dropping environment variables if it is sudo. smoke-testing-state/var/lib/puppet, smoke-testing-state/var/run: merge targets. clean: chown smoke-testing-state recursively before attempting to delete directories in smoke-testing-state/var. --- modules/Makefile | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/modules/Makefile b/modules/Makefile index 8e47224..93289a0 100755 --- a/modules/Makefile +++ b/modules/Makefile @@ -3,7 +3,7 @@ # Make instructions for smoke testing Puppet manifests. # Copyright 2013 - 2015 Ulrik Haugen -# Copyright 2013 - 2014 Linköpings universitet +# Copyright 2013 - 2015 Linköpings universitet # This program is free software: you can redistribute it and/or modify # it under the terms of the Gnu general public license as published by @@ -167,8 +167,9 @@ osfamily := $(shell facter osfamily|tr A-Z a-z) # Possible values for fakeroot are: fakeroot, fakeroot-ng # (nonfunctional), empty (noop) and sudo. -# Sudo will require a line like +# Sudo will require lines like # %puppet-devs ALL = (root) NOPASSWD: /usr/bin/env * puppet apply --noop * +# %puppet-devs ALL = (root) NOPASSWD: /bin/chown -R * smoke-testing-state # in your sudoers configuration. Beware though that this will let all # members of puppet-devs trivially escalate their priviliges. # Set it to empty on Centos/Redhat and fakeroot elsewhere. @@ -209,8 +210,9 @@ puppet-paths := --confdir smoke-testing-state/etc \ # Apply test manifests with specified environment: %.testoutput: %.testenv smoke-testing-state/share/global.testenv smoke-testing-state/etc/puppet.conf smoke-testing-state/var/lib/puppet smoke-testing-state/var/run FORCE cat $< >$@ - env `cat smoke-testing-state/share/global.testenv` `cat $<` \ - $(fakeroot) puppet apply --noop \ + $(fakeroot) \ + env `cat smoke-testing-state/share/global.testenv` `cat $<` \ + puppet apply --noop \ $(puppet-extra-args) \ $(puppet-paths) --verbose --color no \ $(basename $*).pp >>$@ 2>&1 \ @@ -218,8 +220,9 @@ puppet-paths := --confdir smoke-testing-state/etc \ # Apply test manifests without specified environment: %.testoutput: %.pp smoke-testing-state/share/global.testenv smoke-testing-state/etc/puppet.conf smoke-testing-state/var/lib/puppet smoke-testing-state/var/run FORCE - env `cat smoke-testing-state/share/global.testenv` \ - $(fakeroot) puppet apply --noop \ + $(fakeroot) \ + env `cat smoke-testing-state/share/global.testenv` \ + puppet apply --noop \ $(puppet-extra-args) \ $(puppet-paths) --verbose --color no \ $< >$@ 2>&1 \ @@ -292,14 +295,12 @@ smoke-testing-state/share/global.testenv: smoke-testing-state/share/global.teste echo -n "FACTER_$${envdef} "; \ done >$@ -smoke-testing-state/var/lib/puppet: - mkdir -p $@ - -smoke-testing-state/var/run: +smoke-testing-state/var/lib/puppet smoke-testing-state/var/run: mkdir -p $@ clean: rm -f $(testartifacts) + $(fakeroot) chown -R `id -un` smoke-testing-state rm -fr smoke-testing-state/share/global.testenv \ smoke-testing-state/var/lib/puppet smoke-testing-state/var/run \ smoke-testing-state/var/state smoke-testing-state/var/reports -- GitLab