Skip to content

Commit

Permalink
Fix an annoying chef-pedant failure over error strings
Browse files Browse the repository at this point in the history
  • Loading branch information
ctdk committed Jul 2, 2015
1 parent 9eb4796 commit aef8927
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions environment/sql_funcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ func (e *ChefEnvironment) fillEnvFromSQL(row datastore.ResRow) error {
e.ChefType = "environment"
e.JSONClass = "Chef::Environment"
if e.Name == "_default" {
e.Default = make(map[string]interface{})
e.Override = make(map[string]interface{})
e.CookbookVersions = make(map[string]string)
return nil
}

Expand Down
3 changes: 2 additions & 1 deletion environments.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,8 @@ func environmentHandler(w http.ResponseWriter, r *http.Request) {
env, err := environment.Get(envName)
if err != nil {
var errMsg string
if err.Status() == http.StatusNotFound {
// bleh, stupid errors
if err.Status() == http.StatusNotFound && (op != "recipes" && op != "cookbooks") {
errMsg = fmt.Sprintf("environment '%s' not found", envName)
} else {
errMsg = err.Error()
Expand Down

0 comments on commit aef8927

Please sign in to comment.