Bug 1919888

Summary: Global Registration: Unable to re-register with satellite using the Curl Command
Product: Red Hat Satellite Reporter: Jaskaran Singh Narula <janarula>
Component: RegistrationAssignee: Leos Stejskal <lstejska>
Status: CLOSED DUPLICATE QA Contact: Stephen Wadeley <swadeley>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.9.0CC: ahumbe, lstejska
Target Milestone: UnspecifiedKeywords: 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-02-12 09:01:35 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:

Description Jaskaran Singh Narula 2021-01-25 11:26:44 UTC
Description of problem:
When trying to re-register a system using the generated curl command it throws the error mentioning that the system is already registered and it would need to use the option --force. 

Error: 
--------
This system is already registered. Use --force to override
---------

When --force option is using the below error is the output. 

Error: 
================================================================================================
[root@localhost ~]# curl -X GET "https://satellite.example.com:9090/register?activation_key=new&hostgroup_id=3&location_id=2&operatingsystem_id=3&organization_id=1" -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjo0LCJpYXQiOjE2MTE1Njk4ODEsImp0aSI6ImUxMzJkOGU1OGQ2MTc4YTc4ODM3ZjU2ZjY0MzJiZmZhYTZjYmI2OWY0ODFmMGFiYmFjNTJkOGZhZWVlN2JjMDMiLCJleHAiOjE2MTE1ODQyODF9.fLNNZqN_7HNYFcCyspX6Usqt6AN3u5oOUA3DIdEB6Pk' | bash --force
bash: --force: invalid option
Usage:	bash [GNU long option] [option] ...
	bash [GNU long option] [option] script-file ...
GNU long options:
	--debug
	--debugger
	--dump-po-strings
	--dump-strings
	--help
	--init-file
	--login
	--noediting
	--noprofile
	--norc
	--posix
	--rcfile
	--rpm-requires
	--restricted
	--verbose
	--version
Shell options:
	-ilrsD or -c command or -O shopt_option		(invocation only)
	-abefhkmnptuvxBCHP or -o option
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 10369  100 10369    0     0  20017      0 --:--:-- --:--:-- --:--:-- 20017
curl: (23) Failed writing body (0 != 10369)
================================================================================================

Version-Release number of selected component (if applicable):
[root@localhost ~]# rpm -qa | grep -i satellite 
satellite-6.9.0-0.3.beta.el7sat.noarch
ansiblerole-satellite-receptor-installer-0.6.13-1.el7sat.noarch
satellite-maintain-0.0.1-1.el7sat.noarch
satellite-common-6.9.0-0.3.beta.el7sat.noarch
satellite-installer-6.9.0.6-1.el7sat.noarch
tfm-rubygem-foreman_theme_satellite-7.0.1.4-1.el7sat.noarch
satellite-cli-6.9.0-0.3.beta.el7sat.noarch


How reproducible:
100% 

Steps to Reproduce:
1. Register a client system using the generated curl command 
2. Do NOT un-register the system and then run the same curl command again. It will ask to use the --force option. 
3. Run the same curl command with the --force option. 

Actual results:
Do not register the system the second time. 

Expected results:
[1] It should use the option or --force 
[2] Curl command should process any additional parameters supported for subscription-manager. 



Additional info:

Comment 3 Leos Stejskal 2021-02-04 16:07:16 UTC
Created redmine issue https://projects.theforeman.org/issues/31810 from this bug

Comment 4 Peter Ondrejka 2021-02-11 14:39:20 UTC
I'd say better approach to re-registration would be to run sub-man clean, overall feels like a duplicate of https://bugzilla.redhat.com/show_bug.cgi?id=1900664

Comment 5 Leos Stejskal 2021-02-12 09:01:35 UTC

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