Skip to content

Commit

Permalink
Revert "fail if no files found matching include directive" (#218)
Browse files Browse the repository at this point in the history
This reverts commit 3744a12.

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
  • Loading branch information
arjun024 authored Apr 7, 2021
1 parent 8961e35 commit b7b7762
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 20 deletions.
5 changes: 0 additions & 5 deletions cmd/configure/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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...)
}
}
Expand Down
15 changes: 0 additions & 15 deletions cmd/configure/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}))
}

0 comments on commit b7b7762

Please sign in to comment.