Bug 1043291

Summary: rhc snapshot restore <app> --filepath <app.tar.gz> does not restore anything for all web cartridges on MacOS
Product: OpenShift Online Reporter: Eric D. Schabell <eschabel>
Component: ocAssignee: Clayton Coleman <ccoleman>
Status: CLOSED CURRENTRELEASE QA Contact: libra bugs <libra-bugs>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 2.xCC: ffranz, jliggitt, wjiang, wsun
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Mac OS   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-01-30 00:53:26 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 Eric D. Schabell 2013-12-15 18:52:18 UTC
Description of problem:
Creating a snapshot of the application quickstart jbpmmigration setup as shown in readme (https://github.com/eschabell/openshift-jbpmmigration) works, but using listed restore achieves nothing.

Version-Release number of selected component (if applicable):
$ rhc --version
rhc 1.18.2

How reproducible:
Created a snapshot with 'rhc snapshot save jbpmmigration', this resulted in jbpmmigration.tar.gz file. Removed app, recreated empth jbossas-7 app with same name of jbpmmigration. Used 'rhc snapshot restore jbpmmigration --filepath jbpmmigration.tar.gz, takes instance offline, applies snapshot it says, and never bring it back up. Manual 'rhc app start jbpmmigration' brings up empty jbpmmigration, no war deployed or in the project. 'git pull' shows no changes to jbpmmigration instance code.

Steps to Reproduce:
1. see above.
2.
3.

Actual results:
No snapshot applied.

Expected results:
Fully restored jbpmmigration app and 'git pull' pulling in changes to vanilla jbossas-7 project.

Additional info:

Comment 1 Wei Sun 2013-12-16 05:31:41 UTC
Could not reproduce this bug on STG(devenv-stage_614) with rhc-1.18.2 and the latest devenv(devenv_4137) with rhc-1.19.1.

Step:
1)Create a quickstart jbpmmigration
rhc app create -t jbossas-7 --from-code git://github.com/eschabell/openshift-jbpmmigration.git jbpmmigration
2)Snapshot save this quickstart app
rhc snapshot-save jbpmmigration
3)Delete the quickstart app 
4)Create a jbossas-7 app
rhc app-create jbpmmigration jbossas-7 
5)Restore the app with jbpmmigration.tar.gz
rhc snapshot-restore jbpmmigration --filepath jbpmmigration.tar.gz

Result:
5)The app could be restored successfully.And access the app's url: $url/bpmmigration_upload-0.5, "Welcome to the jBPM Migration in the Cloud!" is shown.

Comment 2 Wei Sun 2013-12-16 09:24:39 UTC
Could reproduce this bug on MacOS,but could not reproduce this bug on Fedora19,Ubuntu and Windows.

On MacOS:
After restoring app with jbpmmigration.tar.gz,app is shown stopped.

On Fedora19,Ubuntu and Windows:

After restoring app with jbpmmigration.tar.gz,app is shown startted.

(In reply to Wei Sun from comment #1)
> Could not reproduce this bug on STG(devenv-stage_614) with rhc-1.18.2 and
> the latest devenv(devenv_4137) with rhc-1.19.1.
> 
> Step:
> 1)Create a quickstart jbpmmigration
> rhc app create -t jbossas-7 --from-code
> git://github.com/eschabell/openshift-jbpmmigration.git jbpmmigration
> 2)Snapshot save this quickstart app
> rhc snapshot-save jbpmmigration
> 3)Delete the quickstart app 
> 4)Create a jbossas-7 app
> rhc app-create jbpmmigration jbossas-7 
> 5)Restore the app with jbpmmigration.tar.gz
> rhc snapshot-restore jbpmmigration --filepath jbpmmigration.tar.gz
> 
> Result:
> 5)The app could be restored successfully.And access the app's url:
> $url/bpmmigration_upload-0.5, "Welcome to the jBPM Migration in the Cloud!"
> is shown.

Comment 3 Wei Sun 2013-12-16 10:45:10 UTC
Tried this bug for other web cartridges(php-5.3/ruby-1.8/ruby-1.9/perl-5.10/nodejs-0.6/nodejs-0.10/jbossews-1.0/jbossews-2.0/jbosseap-6.0/diy-0.1),after restoring app ,app is stopped.

1.Before restoring app:
dhcp-65-87:test OpenShift$ rhc app-show eapt --state
Cartridge jbosseap-6 is started

2.Restore app:
dhcp-65-87:test OpenShift$ rhc snapshot-restore eapt -d
DEBUG: Using config file /Users/OpenShift/.openshift/express.conf
DEBUG: Git config 'git config --get rhc.app-id' returned ''
DEBUG: Git config 'git config --get rhc.app-name' returned ''
DEBUG: Git config 'git config --get rhc.domain-name' returned ''
DEBUG: Authenticating with RHC::Auth::Token
DEBUG: Connecting to https://ec2-54-234-61-89.compute-1.amazonaws.com/broker/rest/api
DEBUG: Getting all domains
DEBUG: Client supports API versions 1.1, 1.2, 1.3, 1.4, 1.5
DEBUG: Using token authentication
DEBUG: Created new httpclient
DEBUG: Request GET https://ec2-54-234-61-89.compute-1.amazonaws.com/broker/rest/api
DEBUG: SSL Verification failed -- Using self signed cert
DEBUG:    code 200 1175 ms
DEBUG: Server supports API versions 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6
DEBUG:    Using API version 1.5
DEBUG: Client API version 1.5 is not current. Refetching API
DEBUG: Using token authentication
DEBUG: Request GET https://ec2-54-234-61-89.compute-1.amazonaws.com/broker/rest/api
DEBUG:    code 200  292 ms
DEBUG: Using token authentication
DEBUG: Request GET https://ec2-54-234-61-89.compute-1.amazonaws.com/broker/rest/domains
DEBUG:    code 200  313 ms
DEBUG: Using token authentication
DEBUG: Request GET https://ec2-54-234-61-89.compute-1.amazonaws.com/broker/rest/domains/wsundev4137/applications/eapt
DEBUG:    code 200  386 ms
Restoring from snapshot eapt.tar.gz...
DEBUG: cat 'eapt.tar.gz' | ssh 52aed73d646af03b410000c4.rhcloud.com 'restore'
Removing old data dir: ~/app-root/data/*
Restoring ~/app-root/data

RESULT:
Success


3.After restoring app:
dhcp-65-87:test OpenShift$ rhc app-show eapt --state
Cartridge jbosseap-6 is stopped

Comment 4 Wei Sun 2013-12-16 11:04:52 UTC
On other platforms,snapshot-restore command is using  "cat 'phpt.tar.gz' | ssh 52aedbaa2587c87cb8000001.rhcloud.com 'restore INCLUDE_GIT'" , and app will be restored successfully.
But on MacOS, use 'rhc snapshot-restore $appname -d',find it is using "cat 'phpt.tar.gz' | ssh 52aedbaa2587c87cb8000001.rhcloud.com 'restore'".
And after running 'rhc snapshot-restore $appname' on MacOS,my app is stopped,and I try to run 'cat 'phpt.tar.gz' | ssh 52aedbaa2587c87cb8000001.rhcloud.com 'restore INCLUDE_GIT'',it is started again.

Comment 5 Jordan Liggitt 2013-12-16 21:09:15 UTC
That means this utility method is not returning correctly on OS X:

RHC::TarGz.contains(filename, './*/git')

Comment 6 Jordan Liggitt 2013-12-18 13:34:51 UTC
This is the command to detect if the backup has git files in it:
tar --wildcards -tf 'php.tar.gz' './*/git'

The --wildcards option isn't supported in the OOB tar distribution on OS X

Comment 7 Fabiano Franz 2014-01-03 15:29:05 UTC
Fixed in https://github.com/openshift/rhc/pull/530

Comment 8 openshift-github-bot 2014-01-03 19:09:26 UTC
Commit pushed to master at https://github.com/openshift/rhc

https://github.com/openshift/rhc/commit/10937c74f8c91df2e0b604573f79c360b7f27ffd
Bug 1043291 - using ruby to snapshot restore on mac (tar --wildcards not supported)

Comment 9 weiwei jiang 2014-01-06 06:56:14 UTC
Tried on rhc-1.19.3 with devenv_4187, and can not reproduce this issue, so verified this issue.