Bug 1100743

Summary: The download malformed cartridge is also added to the app even if the command "rhc cartridge add" failed
Product: OpenShift Online Reporter: Guolei Sun <gusun>
Component: ContainersAssignee: Jhon Honce <jhonce>
Status: CLOSED CURRENTRELEASE QA Contact: libra bugs <libra-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 2.xCC: jokerman, mmccomas, xtian
Target Milestone: ---Keywords: Regression
Target Release: 2.x   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1101524 (view as bug list) Environment:
Last Closed: 2014-07-15 10:29:22 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: 1101524    

Description Guolei Sun 2014-05-23 11:34:36 UTC
Description of problem:
The download malformed cartridge is also added to the app even if the command "rhc cartridge add" failed. The app can not be deleted when run the command "rhc app delete" after adding the malformed cartridge failed.

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

How reproducible:
always

Steps to Reproduce:
1. create one app
    rhc app create app1 php-5.3
2. add the download malformed cartridge to the app
    rhc cartridge add https://raw.githubusercontent.com/jhou1/openshift-malformed-cart/master/metadata/manifest.yml -a app1

Actual results:
The cartridge added failed message poped up, but the cartridge is displayed in the app information by the command "rhc apps".
Tha app can not be deleted.

----------------------------------
[gusun@dhcp-10-92 apps]$ rhc cartridge add https://raw.githubusercontent.com/jhou1/openshift-malformed-cart/master/metadata/manifest.yml -a app1
The cartridge
'https://raw.githubusercontent.com/jhou1/openshift-malformed-cart/master/metadata/manifest.yml'
will be downloaded and installed
Adding
https://raw.githubusercontent.com/jhou1/openshift-malformed-cart/master/metadata/manifest.yml
to application 'app1' ...
Unexpected error: can't convert nil into String

[gusun@dhcp-10-92 apps]$ rhc apps
app1 @ http://app1-gusun.int.rhcloud.com/
  (uuid: 537f2cae03ef643dba000017)
-----------------------------------------
  Domain:     gusun
  Created:    7:10 PM
  Gears:      1 (defaults to small)
  Git URL:    ssh://537f2cae03ef643dba000017.rhcloud.com/~/git/app1.git/
  SSH:        537f2cae03ef643dba000017.rhcloud.com
  Deployment: auto (on git push)

  php-5.3 (PHP 5.3)
  -----------------
    Gears: Located with jhou-jhou-mysql-5.1

  jhou-jhou-mysql-5.1 (MySQL Database 5.1)
  ----------------------------------------
    From:    https://raw.githubusercontent.com/jhou1/openshift-malformed-cart/master/metadata/manifest.yml
    Website: http://www.mysql.com
    Gears:   Located with php-5.3

You have access to 1 application.
[gusun@dhcp-10-92 apps]$ rhc app delete app1
This is a non-reversible action! Your application code and data will be
permanently deleted if you continue!

Are you sure you want to delete the application 'app1'? (yes|no): yes

Deleting application 'app1' ... 
+ git clone https://github.com/jhou1/downloadable-mysql.git jhou-mysql
fatal: destination path 'jhou-mysql' already exists and is not an empty
directory.

[gusun@dhcp-10-92 apps]$ 
----------------------------------


Expected results:
The cartridge should NOT be added successfully, and the app should be deleted by the command "rhc app delete".

Additional info:
Regression bug.
https://bugzilla.redhat.com/show_bug.cgi?id=977519

Comment 1 Jhon Honce 2014-05-23 21:47:28 UTC
Node validation of manifest fixed in: 
Fixed in https://github.com/openshift/origin-server/pull/5449

Comment 2 openshift-github-bot 2014-05-23 22:38:51 UTC
Commits pushed to master at https://github.com/openshift/origin-server

https://github.com/openshift/origin-server/commit/cba945eb794a21159f88e3b188283339299d4671
Bug 1100743 - Validate manifest endpoint element

https://github.com/openshift/origin-server/commit/87d07cd8070e2923df20cd31b642c647c535506d
Bug 1100743 - Validate manifest endpoint element

* Add test for empty elements as well

Comment 3 Guolei Sun 2014-05-26 02:27:26 UTC
Verified on the latest devenv_4815.

Pass log:

---log begin---
[guoleis@rhl65 apps]$ rhc cartridge add https://raw.githubusercontent.com/jhou1/openshift-malformed-cart/master/metadata/manifest.yml -a app1
The cartridge
'https://raw.githubusercontent.com/jhou1/openshift-malformed-cart/master/metadata/manifest.yml'
will be downloaded and installed
Adding
https://raw.githubusercontent.com/jhou1/openshift-malformed-cart/master/metadata/manifest.yml
to application 'app1' ...
Unable to complete the requested operation due to: Couldn't parse
endpoints: Couldn't parse endpoint entry '{"Private-IP-Name"=>"DB_HOST",
"Private-Port"=>3306, "Public-Port-Name"=>"DB_PROXY_PORT"}':
Private-Port-Name is a required element
Reference ID: 43ae2af7abbabc84c334160ae68dcd3c
[guoleis@rhl65 apps]$ rhc app delete app1
This is a non-reversible action! Your application code and data will be
permanently deleted if you continue!

Are you sure you want to delete the application 'app1'? (yes|no): yes

Deleting application 'app1' ... deleted

---log end---