Bug 2036940

Summary: oc registry login fails if the file is empty or stdout
Product: OpenShift Container Platform Reporter: Filip Krepinsky <fkrepins>
Component: ocAssignee: Filip Krepinsky <fkrepins>
oc sub component: oc QA Contact: zhou ying <yinzhou>
Status: CLOSED ERRATA Docs Contact:
Severity: low    
Priority: low CC: aos-bugs, mfojtik
Version: 4.10   
Target Milestone: ---   
Target Release: 4.10.0   
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: 2022-03-11 18:15:11 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 Filip Krepinsky 2022-01-04 13:34:23 UTC
Description of problem:

taken from upstream issue

Since #893, the command oc registry login --kubeconfig=aaa --to=bbb fails if the file bbb is empty:

+(utils.sh:530): write_pull_secret(): oc registry login --kubeconfig=/tmp/kubeconfig--0dZLmzoYmT --to=/tmp/pullsecret--Sm82grIvD0
info: Using registry public hostname registry.ci.openshift.org
error: 1 error occurred:
	* reading JSON file "/tmp/pullsecret--Sm82grIvD0": unmarshaling JSON at "/tmp/pullsecret--Sm82grIvD0": unexpected end of JSON input



Also, argument "-" doesnt't work for --registry-config / --to options 

How reproducible:
100


Expected results:
1. the file bbb should have valid credentials
2. It should be possible to write to stdout