Project

General

Profile

Bug #14436

Hammer should provide more informative message for config file syntax errors

Added by Tomáš Strachota about 5 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Normal
Category:
Hammer core
Target version:
-
Team Backlog:
Fixed in Releases:
Found in Releases:
In Kanboard:

Description

When one of yaml config files has wrong syntax (for example tab instead of space indentation) hammer fails without telling the user what actually happened and which file the issue is in:

/home/vagrant/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/psych.rb:370:in `parse': (<unknown>): did not find expected key while parsing a block mapping at line 2 column 1 (Psych::SyntaxError)
    from /home/vagrant/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/psych.rb:370:in `parse_stream'
    from /home/vagrant/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/psych.rb:318:in `parse'
    from /home/vagrant/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/psych.rb:245:in `load'
    from /home/vagrant/hammer/hammer-cli/lib/hammer_cli/settings.rb:37:in `load_from_file'
    from /home/vagrant/hammer/hammer-cli/lib/hammer_cli/settings.rb:20:in `block in load_from_paths'
    from /home/vagrant/hammer/hammer-cli/lib/hammer_cli/settings.rb:16:in `each'
    from /home/vagrant/hammer/hammer-cli/lib/hammer_cli/settings.rb:16:in `load_from_paths'
    from ./bin/hammer:49:in `<main>'

Hammer should print more informative message, for example:

Couldn't load configuration file '/home/vagrant/.hammer/cli_config.yml', please check the file syntax.


Related issues

Has duplicate Hammer CLI - Bug #12115: badly formatted yaml prevents hammer from runningDuplicate2015-10-08

Associated revisions

Revision ebfac63d (diff)
Added by Abhijeet Kasurde almost 5 years ago

Fixes #14436 - added exception handling while parsing configuration file.

Notifies user about syntax error in given configuration file
provided.

Signed-off-by: Abhijeet Kasurde <>

Revision 502031b6 (diff)
Added by Tomáš Strachota almost 5 years ago

Refs #14436 - preserve original exception message

History

#1 Updated by The Foreman Bot about 5 years ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/hammer-cli/pull/206 added

#2 Updated by The Foreman Bot almost 5 years ago

  • Assignee set to Tomáš Strachota
  • Pull request https://github.com/theforeman/hammer-cli/pull/211 added

#3 Updated by Abhijeet Kasurde almost 5 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

#4 Updated by Tomáš Strachota over 4 years ago

  • Has duplicate Bug #12115: badly formatted yaml prevents hammer from running added

#5 Updated by Tomáš Strachota over 4 years ago

  • Bugzilla link set to 1127275

Also available in: Atom PDF