Bug 1347512
| Summary: | Meet error 'unable to load template file "openshift/...' when run oc new-app openshift/image-name:latest under a directory which contains the 'openshift' binary | ||
|---|---|---|---|
| Product: | OpenShift Container Platform | Reporter: | zhou ying <yinzhou> |
| Component: | Build | Assignee: | Martin Milata <mmilata> |
| Status: | CLOSED ERRATA | QA Contact: | Wenjing Zheng <wzheng> |
| Severity: | low | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 3.2.1 | CC: | aos-bugs, bparees, ffranz, jokerman, mmccomas, tdawson |
| Target Milestone: | --- | Keywords: | Regression |
| Target Release: | --- | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | Bug Fix | |
| Doc Text: |
Cause: oc new-app tries to interpret its argument as a path and exits with an error when a component of this path exists but is not a directory.
Consequence: Running oc new-app X/Y with file named X in the current directory exits with an error even though X/Y denotes valid docker image.
Fix: When oc new-app tries to interpret input component as a directory and object with that name exists on a filesystem but is not a directory, try another possible interpretation instead of exiting with an error.
Result: Running oc new-app X/Y creates new app based on docker image X/Y even in the case when file X exists in the current directory.
|
Story Points: | --- |
| Clone Of: | Environment: | ||
| Last Closed: | 2017-04-12 19:05:43 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: | |||
Pull request: https://github.com/openshift/origin/pull/11918 (I mixed up the BZ number, the one in commit message is wrong) Commit: https://github.com/openshift/origin/commit/b94313c00c053eaebf3f2183f15bd61b6516a7fd Should be included in OCP 3.5 This has been merged into ocp and is in OCP v3.5.0.7 or newer. Confirmed with latest OCP, the issue has fixed:
[root@zhouy testjson]# ll openshift
-rwxr-xr-x. 1 root root 213234440 Jan 22 13:42 openshift
[root@zhouy testjson]# oc new-app openshift/deployment-example
--> Found Docker image 1c839d8 (18 months old) from Docker Hub for "openshift/deployment-example"
* An image stream will be created as "deployment-example:latest" that will track this image
* This image will be deployed in deployment config "deployment-example"
* Port 8080/tcp will be load balanced by service "deployment-example"
* Other containers can access this service through the hostname "deployment-example"
* WARNING: Image "openshift/deployment-example" runs as the 'root' user which may not be permitted by your cluster administrator
--> Creating resources ...
imagestream "deployment-example" created
deploymentconfig "deployment-example" created
service "deployment-example" created
--> Success
Run 'oc status' to view your app.
[root@zhouy testjson]# oc get po
NAME READY STATUS RESTARTS AGE
deployment-example-1-2mlwv 1/1 Running 0 1m
[root@zhouy testjson]# oc version
oc v3.5.0.7+390ef18
kubernetes v1.5.2+43a9be4
features: Basic-Auth GSSAPI Kerberos SPNEGO
openshift v3.5.0.7+390ef18
kubernetes v1.5.2+43a9be4
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/RHBA-2017:0884 |
Description of problem: Meet error 'unable to load template file "unable to load template file "openshift/hello-openshift": the path "openshift/hello-openshift" cannot be accessed: stat openshift/hello-openshift: not a directory' when run oc new-app openshift/hello-openshift:latest under a directory which contains the 'openshift' binary. Delete the openshift binary, or change to a nother directory without the openshift binary, oc new-app works well. Version-Release number of selected component (if applicable): oc v3.2.1.2-1-g64665fc kubernetes v1.2.0-36-g4a3f9c5 How reproducible: always Steps to Reproduce: 1. Login OpenShift and create project; 2. Suppose you have copied 'openshift' binary to a directory 'mydir' [root@pc ~]$ mkdir mydir [root@pc ~]$ cp /usr/bin/openshift mydir/ [root@pc ~]$ cd mydir/ [root@pc mydir] oc new-app openshift/hello-openshift:latest error: unable to load template file "openshift/hello-openshift:latest": the path "openshift/hello-openshift:latest" cannot be accessed: stat openshift/hello-openshift:latest: not a directory 3. Remove 'openshift' binary from 'mydir', then try oc new-app again [root@pc mydir] rm -f openshift [root@pc mydir] oc new-app openshift/hello-openshift:latest --> Found Docker image 3c55d5d (5 hours old) from Docker Hub for "openshift/hello-openshift:latest" * An image stream will be created as "hello-openshift:latest" that will track this image * This image will be deployed in deployment config "hello-openshift" * [WARNING] Image "hello-openshift" runs as the 'root' user which may not be permitted by your cluster administrator * Ports 8080/tcp, 8888/tcp will be load balanced by service "hello-openshift" --> Creating resources with label app=hello-openshift ... ... Actual results: 2. [root@pc mydir] oc new-app openshift/hello-openshift:latest error: unable to load template file "openshift/hello-openshift:latest": the path "openshift/hello-openshift:latest" cannot be accessed: stat openshift/hello-openshift:latest: not a directory Expected results: Create app successfully. Additional info: As far as I tried, old version of oc does not have the problem, e.g. oc v3.1.1.6-35-g0742c54, but oc v3.2.0.5 does have.