Bug 1447619

Summary: incremental backup with no source dir specified fails with no implicit conversion of nil into String (TypeError)
Product: Red Hat Satellite Reporter: Peter Ondrejka <pondrejk>
Component: Backup & RestoreAssignee: Christine Fouant <cfouant>
Status: CLOSED ERRATA QA Contact: Bruno Rocha <rochacbruno>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.2.9CC: bbuckingham, bkearney, egolov, ehelms, rochacbruno
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: katello-3.4.5 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-02-21 17:06:24 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 Peter Ondrejka 2017-05-03 10:44:29 UTC
katello-backup /tmp/ --incremental
/usr/bin/katello-backup:18:in `directory?': no implicit conversion of nil into String (TypeError)
	from /usr/bin/katello-backup:18:in `block (2 levels) in <main>'
	from /usr/share/ruby/optparse.rb:1364:in `call'
	from /usr/share/ruby/optparse.rb:1364:in `block in parse_in_order'
	from /usr/share/ruby/optparse.rb:1351:in `catch'
	from /usr/share/ruby/optparse.rb:1351:in `parse_in_order'
	from /usr/share/ruby/optparse.rb:1345:in `order!'
	from /usr/share/ruby/optparse.rb:1437:in `permute!'
	from /usr/share/ruby/optparse.rb:1459:in `parse!'
	from /usr/bin/katello-backup:30:in `block in <main>'
	from /usr/share/ruby/optparse.rb:885:in `initialize'
	from /usr/bin/katello-backup:10:in `new'
	from /usr/bin/katello-backup:10:in `<main>'


fixed in upstream 
https://github.com/Katello/katello-packaging/commit/4f6d966db0ae2603dd1a7485805076ed1dab4afa

Comment 1 Satellite Program 2017-05-09 15:51:36 UTC
Connecting redmine issue http://projects.theforeman.org/issues/18756 from this bug

Comment 2 Satellite Program 2017-05-09 16:02:28 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/18756 has been resolved.

Comment 5 Evgeni Golov 2017-08-09 13:46:30 UTC
FAILED_QA

Version Tested:
Satellite-6.3 Snap 10
katello-common-3.4.4-2.el7sat.noarch

While the original error is gone, you still end up with a quite unfriendly traceback when no directory is given:
# katello-backup /tmp/ --incremental
/sbin/katello-backup:72:in `block in <main>': missing argument: --incremental (OptionParser::MissingArgument)
	from /sbin/katello-backup:22:in `new'
	from /sbin/katello-backup:22:in `<main>'

I was expecting to see:
# katello-backup /tmp/ --incremental
katello-backup: Please specify the previous backup directory.

This is due to the change that went in later:
-  opts.on("--incremental [PREVIOUS_BACKUP_DIR]", String, "Backup changes since previous backup") do |dir_path|
+  opts.on("--incremental PREVIOUS_BACKUP_DIR", String, "Backup changes since previous backup") do |dir_path|

Removing the brackets made the value required, but now Ruby's OptionParser outputs the traceback and I can't find a way to tell it to output a friendly message :(

Comment 6 Bruno Rocha 2017-09-21 21:43:00 UTC
During the verification of other BZ I had the chance to verify this one, so taking and moving to verified:


Verified with snap 16:

[root@cloud-qe-15 v2]# rpm -q satellite
satellite-6.3.0-18.0.beta.el7sat.noarch

Steps:

[root@cloud-qe-15 v2]# katello-backup /tmp/ --incremental
missing argument: --incremental
Usage: katello-backup /path/to/dir [options]
 eg: $ katello-backup /tmp/katello-backup
        --skip-pulp-content          Create backup without Pulp content for debugging only
        --incremental PREVIOUS_BACKUP_DIR
                                     Backup changes since previous backup
        ....
        ....
        ....


Help message states very clearly that `--incremental` requires a `PREVIOUS_BACKUP_DIR`

Comment 7 Bryan Kearney 2018-02-21 17:06:24 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