From b7b7762e0eca91bed24e5f2fcbce67c55f00af9e Mon Sep 17 00:00:00 2001 From: Arjun Sreedharan Date: Wed, 7 Apr 2021 18:10:06 -0400 Subject: [PATCH] Revert "fail if no files found matching include directive" (#218) This reverts commit 3744a120b44757797701097b9a7dbf4918716491. This is to allow downstream buildpacks like php-web that generate nginx.conf with include masks referring to files/dirs that may not exist. See https://github.com/paketo-buildpacks/php-web/blob/v0.0.139/config/nginx.go#L215 --- cmd/configure/main.go | 5 ----- cmd/configure/main_test.go | 15 --------------- 2 files changed, 20 deletions(-) diff --git a/cmd/configure/main.go b/cmd/configure/main.go index e3851221..90926d59 100644 --- a/cmd/configure/main.go +++ b/cmd/configure/main.go @@ -81,11 +81,6 @@ func getIncludedConfs(confText string, confDir string) ([]string, error) { if err != nil { return nil, fmt.Errorf("failed to get 'include' files for %s: %w", conf, err) } - - if len(matchFiles) == 0 { - return nil, fmt.Errorf("failed to get 'include' files for %s: no matching files exist", conf) - } - includeFiles = append(includeFiles, matchFiles...) } } diff --git a/cmd/configure/main_test.go b/cmd/configure/main_test.go index 7d8863da..f7dc9167 100644 --- a/cmd/configure/main_test.go +++ b/cmd/configure/main_test.go @@ -289,21 +289,6 @@ http { Expect(buffer.String()).To(ContainSubstring(`/\/\/.conf: syntax error in pattern`)) }) }) - context("when an include file does not exist", func() { - it.Before(func() { - Expect(ioutil.WriteFile(filepath.Join(workingDir, "nginx.conf"), []byte("include donotexist.conf;"), 0644)).To(Succeed()) - command = exec.Command(path, filepath.Join(workingDir, "nginx.conf"), localModulePath, globalModulePath) - buffer = bytes.NewBuffer(nil) - }) - - it("exits non-zero", func() { - session, err := gexec.Start(command, buffer, buffer) - Expect(err).ToNot(HaveOccurred()) - Eventually(session).Should(gexec.Exit(1), buffer.String) - Expect(buffer.String()).To(ContainSubstring(`failed to get 'include' files for /tmp/working-dir`)) - Expect(buffer.String()).To(ContainSubstring("no matching files exist")) - }) - }) }) }, spec.Report(report.Terminal{})) }