Bug 1127275

Summary: badly formatted yaml prevents hammer from running
Product: Red Hat Satellite Reporter: Lukas Pramuk <lpramuk>
Component: HammerAssignee: Tomas Strachota <tstrachota>
Status: CLOSED ERRATA QA Contact: Lukas Pramuk <lpramuk>
Severity: medium Docs Contact:
Priority: unspecified    
Version: UnspecifiedCC: bbuckingham, bkearney, tstrachota
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
URL: http://projects.theforeman.org/issues/14436
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-02-21 16:49:54 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Lukas Pramuk 2014-08-06 14:04:46 UTC
Description of problem:
Badly formatted yaml prevents hammer from running, without any reasonable message, just traceback

Version-Release number of selected component (if applicable):
rubygem-hammer_cli-0.1.1-10.el6sat.noarch

How reproducible:
100%

Steps to Reproduce:
1. prepare badly formatted yaml file
# echo ":" > /etc/hammer/cli.modules.d/broken.yml

2. try to run hammer
# hammer
/usr/lib/ruby/1.8/yaml.rb:133:in `load': syntax error on line 0, col 1: `:' (ArgumentError)
	from /usr/lib/ruby/1.8/yaml.rb:133:in `load'
	from /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.1/lib/hammer_cli/settings.rb:38:in `load_from_file'
	from /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.1/lib/hammer_cli/settings.rb:25:in `load_from_paths'
	from /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.1/lib/hammer_cli/settings.rb:24:in `each'
	from /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.1/lib/hammer_cli/settings.rb:24:in `load_from_paths'
	from /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.1/lib/hammer_cli/settings.rb:16:in `each'
	from /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.1/lib/hammer_cli/settings.rb:16:in `load_from_paths'
	from /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.1/bin/hammer:39
	from /usr/bin/hammer:19:in `load'
	from /usr/bin/hammer:19


Actual results:
badly formatted yaml prevents hammer from running without any reasonable message to the user

Expected results:
hammer tries to load yaml file and if fails then hammer will notify user about wrong yaml file and will keep running

Comment 1 RHEL Program Management 2014-08-06 14:14:20 UTC
Since this issue was entered in Red Hat Bugzilla, the release flag has been
set to ? to ensure that it is properly evaluated for this release.

Comment 3 Bryan Kearney 2015-10-08 20:42:26 UTC
Created redmine issue http://projects.theforeman.org/issues/12115 from this bug

Comment 4 Bryan Kearney 2016-09-29 12:03:35 UTC
Upstream bug assigned to tstrachota

Comment 5 Bryan Kearney 2016-09-29 12:03:39 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/14436 has been resolved.

Comment 7 Lukas Pramuk 2016-11-21 14:54:20 UTC
VERIFIED.

@satellite-6.3.0-6.1.beta.el7sat.noarch
tfm-rubygem-hammer_cli-0.8.0-1.el7.noarch

by reproducer in comment#0:

1. # echo ":" > /etc/hammer/cli.modules.d/broken.yml

2. # hammer
Warning: Couldn't load configuration file /etc/hammer/cli.modules.d/broken.yml: (<unknown>): did not find expected key while parsing a block mapping at line 1 column 1
Usage:
    hammer [OPTIONS] SUBCOMMAND [ARG] ...
...

>>> hammer issues warning about badly formated yaml and continues working

Comment 8 Satellite Program 2018-02-21 16:49:54 UTC
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA.

For information on the advisory, and where to find the updated files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2018:0336