Bug 1938278

Summary: Error handling wrongly used options with capsule-certs-generate
Product: Red Hat Satellite Reporter: Joniel Pasqualetto <jpasqual>
Component: CertificatesAssignee: Eric Helms <ehelms>
Status: CLOSED DUPLICATE QA Contact: Omkar Khatavkar <okhatavk>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.8.0CC: ahumbe, zhunting
Target Milestone: UnspecifiedKeywords: Regression, Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-05-18 12:28:26 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 Joniel Pasqualetto 2021-03-12 16:51:06 UTC
Description of problem:

When trying to create capsule certificates and the option --certs-update-server-ca is wrongly used, a backtrace is returned instead of a nice message.

Version-Release number of selected component (if applicable):

Observed this on Satellite 6.8. On Satellite 6.7 (didn't have older versions to test) it works fine and return the expected nice message.

How reproducible:
Always

Steps to Reproduce:

1. Try generating capsule certificates using following command line:

~~~
# capsule-certs-generate --foreman-proxy-fqdn capsule.example.com --certs-tar /root/capsule_cert/capsule_certs.tar --certs-update-server --certs-update-server-ca
Traceback (most recent call last):
	14: from /usr/sbin/capsule-certs-generate:31:in `<main>'
	13: from /opt/theforeman/tfm/root/usr/share/gems/gems/kafo-4.1.0/lib/kafo/kafo_configure.rb:162:in `run'
	12: from /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.1.2/lib/clamp/command.rb:132:in `run'
	11: from /opt/theforeman/tfm/root/usr/share/gems/gems/kafo-4.1.0/lib/kafo/kafo_configure.rb:118:in `run'
	10: from /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.1.2/lib/clamp/command.rb:63:in `run'
	 9: from /opt/theforeman/tfm/root/usr/share/gems/gems/kafo-4.1.0/lib/kafo/kafo_configure.rb:155:in `execute'
	 8: from /opt/theforeman/tfm/root/usr/share/gems/gems/kafo-4.1.0/lib/kafo/kafo_configure.rb:424:in `run_installation'
	 7: from /opt/theforeman/tfm/root/usr/share/gems/gems/kafo-4.1.0/lib/kafo/hooking.rb:49:in `execute'
	 6: from /opt/theforeman/tfm/root/usr/share/gems/gems/kafo-4.1.0/lib/kafo/hooking.rb:49:in `each'
	 5: from /opt/theforeman/tfm/root/usr/share/gems/gems/kafo-4.1.0/lib/kafo/hooking.rb:51:in `block in execute'
	 4: from /opt/theforeman/tfm/root/usr/share/gems/gems/kafo-4.1.0/lib/kafo/hook_context.rb:16:in `execute'
	 3: from /opt/theforeman/tfm/root/usr/share/gems/gems/kafo-4.1.0/lib/kafo/hook_context.rb:16:in `instance_exec'
	 2: from /opt/theforeman/tfm/root/usr/share/gems/gems/kafo-4.1.0/lib/kafo/hooking.rb:34:in `block (4 levels) in load'
	 1: from /opt/theforeman/tfm/root/usr/share/gems/gems/kafo-4.1.0/lib/kafo/hooking.rb:34:in `instance_eval'
/usr/share/foreman-installer/katello-certs/hooks/pre/20-certs_update.rb:22:in `block (4 levels) in load': undefined method `fail_and_exit' for #<Kafo::HookContext:0x0000000001bec318> (NoMethodError)
~~~


Actual results:
 Backtrace complaining about method "fail_and_exit" not existing:

/usr/share/foreman-installer/katello-certs/hooks/pre/20-certs_update.rb:22:in `block (4 levels) in load': undefined method `fail_and_exit' for #<Kafo::HookContext:0x0000000001bec318> (NoMethodError)



Expected results:
Nice message saying:

"--certs-update-server-ca needs to be used with katello"

Additional info:

Comment 1 Eric Helms 2021-05-03 15:24:49 UTC
This is related to https://bugzilla.redhat.com/show_bug.cgi?id=1915347 as the fix for that should fix this in 6.8 as well.

Comment 2 Eric Helms 2021-05-18 12:28:26 UTC

*** This bug has been marked as a duplicate of bug 1915347 ***