diff --git a/Vagrantfile b/Vagrantfile index 9a49a7323..1111fc4c3 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -33,6 +33,7 @@ Vagrant.configure('2') do |config| config.vm.provision :shell, inline: "chmod 777 /var/vcap/sys/log/cpi" config.vm.provision :shell, inline: "sudo #{agent_dir}/integration/assets/install-go.sh" + config.vm.provision :shell, inline: "sudo cp #{agent_dir}/integration/assets/start_logging_and_auditing.sh /var/vcap/bosh/bin/start_logging_and_auditing.sh" config.vm.provision :shell, inline: "sudo #{agent_dir}/integration/assets/install-agent.sh" config.vm.provision :shell, inline: "sudo #{agent_dir}/integration/assets/install-fake-registry.sh" config.vm.provision :shell, inline: "sudo #{agent_dir}/integration/assets/disable_growpart.sh" diff --git a/integration/assets/start_logging_and_auditing.sh b/integration/assets/start_logging_and_auditing.sh new file mode 100755 index 000000000..8c3cbfc39 --- /dev/null +++ b/integration/assets/start_logging_and_auditing.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +exit 0 diff --git a/integration/test_environment.go b/integration/test_environment.go index 32d682c0c..74c99776e 100644 --- a/integration/test_environment.go +++ b/integration/test_environment.go @@ -58,10 +58,8 @@ sudo umount /tmp/config-drive return err } -func (t *TestEnvironment) CleanupDataDir() error { - t.RunCommand(`sudo /var/vcap/bosh/bin/monit stop all`) - - mountPoints, err := t.RunCommand(`sudo mount | grep "on /var/vcap/data" | cut -d ' ' -f 3`) +func (t *TestEnvironment) unmountDir(dir string) error { + mountPoints, err := t.RunCommand(fmt.Sprintf(`sudo mount | grep "on %s" | cut -d ' ' -f 3`, dir)) if err != nil { return err } @@ -72,10 +70,21 @@ func (t *TestEnvironment) CleanupDataDir() error { } } - _, err = t.RunCommand("sudo rm -rf /var/vcap/data") + _, err = t.RunCommand(fmt.Sprintf("sudo rm -rf %s", dir)) return err } +func (t *TestEnvironment) CleanupDataDir() error { + t.RunCommand(`sudo /var/vcap/bosh/bin/monit stop all`) + + err := t.unmountDir("/var/log") + if err != nil { + return err + } + + return t.unmountDir("/var/vcap/data") +} + // ConfigureAgentForGenericInfrastructure executes the agent_runit.sh asset. // Required for reverse-compatibility with older bosh-lite // (remove once a new warden stemcell is built). diff --git a/platform/linux_platform.go b/platform/linux_platform.go index eafdd3d8d..642bad107 100644 --- a/platform/linux_platform.go +++ b/platform/linux_platform.go @@ -768,11 +768,17 @@ func (p linux) SetupTmpDir() error { func (p linux) SetupLogDir() error { logDir := "/var/log" + + err := p.fs.MkdirAll(logDir, userRootLogDirPermissions) + if err != nil { + return bosherr.WrapError(err, "Creating system log dir") + } + boshRootLogPath := path.Join(p.dirProvider.DataDir(), "root_log") - err := p.fs.MkdirAll(boshRootLogPath, userRootLogDirPermissions) + err = p.fs.MkdirAll(boshRootLogPath, userRootLogDirPermissions) if err != nil { - return bosherr.WrapError(err, "Creating root tmp dir") + return bosherr.WrapError(err, "Creating root log dir") } auditDirPath := path.Join(boshRootLogPath, "audit")