Bug 1316352

Summary: oc edit fails when oc is prefixed with path
Product: OKD Reporter: Xingxing Xia <xxia>
Component: ocAssignee: Michail Kargakis <mkargaki>
Status: CLOSED CURRENTRELEASE QA Contact: Wei Sun <wsun>
Severity: low Docs Contact:
Priority: medium    
Version: 3.xCC: aos-bugs, ffranz, mkargaki, mmccomas
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1336289 (view as bug list) Environment:
Last Closed: 2016-09-19 13:50:49 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:
Bug Depends On:    
Bug Blocks: 1336289    

Description Xingxing Xia 2016-03-10 02:45:07 UTC
Description of problem:
When testing with different version of client, we may specify path/to/oc. But for edit, it fails.

Version-Release number of selected component (if applicable):
openshift/oc v1.1.3-553-g19dbf2a
kubernetes v1.2.0-alpha.7-703-gbc4550d

How reproducible:
Always

Steps to Reproduce:
/bin/oc get dc
/bin/oc edit dc database
error: open /tmp/bin/oc-edit-sa0n5.yaml: no such file or directory
cd /
bin/oc edit dc database
error: open /tmp/bin/oc-edit-0pcd4.yaml: no such file or directory

Actual results:
Fail as above.

Expected results:
Should edit well when oc is prefixed with path

Additional info:
`./oc edit ...` works
Other similar software like crontab can edit well: /bin/crontab -e   # edit /tmp/crontab.TMJMNj

Comment 1 Fabiano Franz 2016-03-10 18:53:09 UTC
Michail, can you confirm this is fixed upstream and coming in the rebase in progress?

Comment 2 Michail Kargakis 2016-03-11 09:17:57 UTC
Yes, this is fixed in https://github.com/kubernetes/kubernetes/pull/22373 and we will have it with the rebase.

Comment 3 Michail Kargakis 2016-03-17 10:31:37 UTC
Rebase landed, this should be fixed.

Comment 4 Xingxing Xia 2016-03-17 11:19:40 UTC
Verified against:
openshift/oc v1.1.4-87-g16c0e72
kubernetes v1.2.0-beta.1-28-g148dd34

/bin/oc, bin/oc works now

Comment 5 Xingxing Xia 2016-04-18 07:38:50 UTC
Windows has similar issue (sorry, did not try Windows last time):
$ dir origin
04/18/2016  07:13 AM        64,314,880 oc.exe

$ origin\oc version
oc v1.1.6-132-g0a5b12b
kubernetes v1.2.0-36-g4a3f9c5

$ origin\oc edit dc database
error: open C:\Users\OPPENS~1\AppData\Local\Temp\origin\oc.exe-edit-evm56.yaml: The system cannot find the path specified.

(Similarly, .\oc edit works:
cd origin
.\oc edit dc database
)

Comment 6 Michail Kargakis 2016-04-30 17:02:53 UTC
https://github.com/openshift/origin/pull/8541 was merged in Origin

Comment 7 Xingxing Xia 2016-05-03 05:43:52 UTC
@Michail
Met error when run `hack/build-release.sh` to get windows oc.exe:
[root@ip-172-18-10-4 origin]# hack/build-release.sh
++ Building release v1.3.0-alpha.0-267-gcd62e58
++ Building go targets for linux/amd64: cmd/openshift cmd/oc
++ Building go targets for darwin/amd64: cmd/openshift cmd/oc
++ Building go targets for windows/amd64: cmd/openshift cmd/oc
Godeps/_workspace/src/github.com/docker/go-connections/sockets/sockets_windows.go:7:2: cannot find package "github.com/Microsoft/go-winio" in any of:
	/usr/local/go/src/github.com/Microsoft/go-winio (from $GOROOT)
	/go/src/github.com/openshift/origin/Godeps/_workspace/src/github.com/Microsoft/go-winio (from $GOPATH)
	/go/src/github.com/Microsoft/go-winio
!!! Error in hack/../hack/common.sh:301
	'GOOS=${platform%/*} GOARCH=${platform##*/} go install "${goflags[@]:+${goflags[@]}}" -ldflags "${version_ldflags}" "${nonstatics[@]}"' exited with status 1
Call stack:
	1: hack/../hack/common.sh:301 os::build::build_binaries(...)
	2: hack/build-cross.sh:28 main(...)
Exiting with status 1
!!! Error in hack/../hack/common.sh:253
	'os::build::build_binaries "${OS_CROSS_COMPILE_TARGETS[@]}"' exited with status 1
Call stack:
	1: hack/../hack/common.sh:253 os::build::build_binaries(...)
	2: hack/build-cross.sh:28 main(...)
Exiting with status 1
!!! Error in hack/build-release.sh:45
	'docker run -e "OS_ONLY_BUILD_PLATFORMS=${OS_ONLY_BUILD_PLATFORMS-}" -i --cidfile="${context}/cid" openshift/origin-release' exited with status 0 1
Call stack:
	1: hack/build-release.sh:45 main(...)
Exiting with status 1

(Not meet this error in the past. How to resolve it? I tried git clone the GH microsoft/go-winio under /usr/local/go/src/github.com/Microsoft/, the error still happens)

Comment 8 Xingxing Xia 2016-05-04 07:42:34 UTC
Verified in oc.exe v1.3.0-alpha.0-282-g8f127d7. Fixed.