Defect #9748

Error about configuration.yml validness should mention file path

Added by Mark P almost 6 years ago. Updated almost 6 years ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:Jean-Philippe Lang% Done:

0%

Category:-
Target version:1.3.0
Resolution:Fixed Affected version:

Description

We've been using Redmine since the .7.x days, and done several upgrades to stay current, and this is the first time I have had any issues. When I upgraded from 1.0.1 to 1.2.2 in my non-production instance, I get the following when I ran rake --trace db:migrate RAILS_ENV=development:

syntax error on line 150, col 0: `production:'

After grepping around a bit, we found that line in the configuration.yml file. Just a stab in the dark, we commented that out, and tried again. Then we got this one:

syntax error on line 154, col 0: `development:'

Which points to the development entry on line 154 of the configuration.yml file. So, I commented that out too, and ran the rake again with no issues. My non-production instance is now up and running fine.

My question is related to the purpose of those lines as they come shipped in the configuration.yml file. I have to assume they are non commented for a reason. My having to comment them out makes me think something else is incorrect.

The files comments say this:

# specific configuration options for production environment
# that overrides the default ones

Both the production and development lines are enabled, leading me to believe that the file wants to override default values, but where are those default values coming from, and what are they? If I comment both prod and dev out, then are the configuration.yml file settings being used or not? I want to make sure that if I leave them commented out, then I won't be plagued with some continual issues in the future.

Thank you in advance for your help, and as always, nice job on the Redmine project.

Associated revisions

Revision 8112
Added by Jean-Philippe Lang almost 6 years ago

Adds an explicit error message for invalid YAML configuration file (#9748).

Revision 8160
Added by Jean-Philippe Lang almost 6 years ago

Merged r8112 from trunk (#9748).

History

#1 Updated by Etienne Massip almost 6 years ago

Mark P wrote:

Both the production and development lines are enabled, leading me to believe that the file wants to override default values, but where are those default values coming from, and what are they?

Up in the file, right after:

# default configuration options for all environments
default:

If I comment both prod and dev out, then are the configuration.yml file settings being used or not?

Yes.
The global idea is that to put in default: section parameters that are common to all of your environments and put your environment-specific exceptions after development: and production: lines.

#2 Updated by Mark P almost 6 years ago

I wonder then why the rake task caused a syntax error that could only be fixed by commenting those lines out.

#3 Updated by Jean-Philippe Lang almost 6 years ago

The rake task should not raise an error even if these lines are present. This error means that your configuration.yml is not a valid YAML file. The one provided with Redmine (configuration.yml.example) is a valid one. Did you make any change to this file (like inserting tabs)?

#4 Updated by Jean-Philippe Lang almost 6 years ago

Btw, I agree that YAML is not the best suited format for a configuration file. Maybe we should switch or support an alternative format easier to use.

#5 Updated by Mark P almost 6 years ago

As far as I know, I never modified that example, simply copied and renamed it to configuration.yml. Regardless, I removed the suspect configuration.yml file, and copied and renamed the example one again. Ran the rake tasks again successfully. The new one based on the example, as you know, has the prod and dev lines enabled. No syntax error.

Also, when I got the syntax error the first time, it did not tell me what file contained the error. I knew it was line 150 in some file, but not the file name. Knowing that would have also helped me troubleshoot.

Regarding the YAML format and the file itself, I did not understand the comments correctly as I assumed the specific config options overriding default ones applied only to the email config due to where that comment resides in the file (toward the top with the other mail config). That was my mis-reading of it. I know very little about YAML file limitations or pros/cons. Given that, I agree that dumbing it down a little more for us kindergartners would be great.

Thank you for your prompt assistance in helping me resolve this.

#6 Updated by Jean-Philippe Lang almost 6 years ago

  • Subject changed from configuration.yml issues to Error about configuration.yml validness should mention file path
  • Status changed from New to Resolved
  • Target version set to 1.3.0

I've added a specific error message with the path to the yml file in r8112.

#7 Updated by Jean-Philippe Lang almost 6 years ago

  • Status changed from Resolved to Closed
  • Assignee set to Jean-Philippe Lang
  • Resolution set to Fixed

Merged in 1.3-stable.

Also available in: Atom PDF