Bug 1020782 - Unable to restore Drupal backup
Summary: Unable to restore Drupal backup
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: OpenShift Online
Classification: Red Hat
Component: Containers
Version: 2.x
Hardware: x86_64
OS: Mac OS
unspecified
urgent
Target Milestone: ---
: ---
Assignee: Michal Fojtik
QA Contact: libra bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-10-18 09:27 UTC by Kevin Munro
Modified: 2015-05-14 23:30 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-01-24 03:25:17 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Kevin Munro 2013-10-18 09:27:16 UTC
Description of problem:

I'm able to back up my drupal website but not restore it, even to a new application.

I get a permission denied and then this in the log file:

Restoring from snapshot drupal.tar.gz... Removing old git repo: ~/git/drupal.git/ Removing old data dir: ~/app-root/data/* Restoring ~/git/drupal.git and ~/app-root/data /bin/tar: app-root/data/sites/default/settings.php: Cannot open: Permission denied /bin/tar: Exiting with failure status due to previous errors /opt/rh/ruby193/root/usr/share/gems/gems/openshift-origin-node-1.15.11/lib/openshift-origin-node/utils/shell_exec.rb:133:in block (2 levels) in oo_spawn': Shell command '/bin/tar --strip=2 --overwrite -xmz ./*/app-root/data ./*/git --transform="s|${OPENSHIFT_GEAR_NAME}/data|app-root/data|" --transform="s|git/.*\.git|git/${OPENSHIFT_GEAR_NAME}.git|" --exclude="./*/app-root/runtime/data" --exclude="./*/mysql/data" --exclude="./*/php/data" --exclude="./*/git/*.git/hooks" 1>&2' returned an error. rc=2 (OpenShift::Runtime::Utils::ShellExecutionException) from /opt/rh/ruby193/root/usr/share/gems/gems/openshift-origin-node-1.15.11/lib/openshift-origin-node/utils/shell_exec.rb:96:inpipe' from /opt/rh/ruby193/root/usr/share/gems/gems/openshift-origin-node-1.15.11/lib/openshift-origin-node/utils/shell_exec.rb:96:in block in oo_spawn' from /opt/rh/ruby193/root/usr/share/gems/gems/openshift-origin-node-1.15.11/lib/openshift-origin-node/utils/shell_exec.rb:95:inpipe' from /opt/rh/ruby193/root/usr/share/gems/gems/openshift-origin-node-1.15.11/lib/openshift-origin-node/utils/shell_exec.rb:95:in oo_spawn' from /opt/rh/ruby193/root/usr/share/gems/gems/openshift-origin-container-selinux-0.2.3/lib/openshift/runtime/containerization/selinux_container.rb:327:inrun_in_container_context' from /opt/rh/ruby193/root/usr/share/gems/gems/openshift-origin-node-1.15.11/lib/openshift-origin-node/model/application_container.rb:650:in run_in_container_context' from /opt/rh/ruby193/root/usr/share/gems/gems/openshift-origin-node-1.15.11/lib/openshift-origin-node/model/application_container_ext/snapshots.rb:208:inextract_restore_archive' from /opt/rh/ruby193/root/usr/share/gems/gems/openshift-origin-node-1.15.11/lib/openshift-origin-node/model/application_container_ext/snapshots.rb:148:in restore' from /usr/bin/gear:307:inblock (2 levels) in ' from /opt/rh/ruby193/root/usr/share/gems/gems/commander-4.0.3/lib/commander/command.rb:180:in call' from /opt/rh/ruby193/root/usr/share/gems/gems/commander-4.0.3/lib/commander/command.rb:180:incall' from /opt/rh/ruby193/root/usr/share/gems/gems/commander-4.0.3/lib/commander/command.rb:155:in run' from /opt/rh/ruby193/root/usr/share/gems/gems/commander-4.0.3/lib/commander/runner.rb:385:inrun_active_command' from /opt/rh/ruby193/root/usr/share/gems/gems/commander-4.0.3/lib/commander/runner.rb:62:in run!' from /opt/rh/ruby193/root/usr/share/gems/gems/commander-4.0.3/lib/commander/delegates.rb:11:inrun!' from /opt/rh/ruby193/root/usr/share/gems/gems/commander-4.0.3/lib/commander/import.rb:10:in `block in ' Error in trying to restore snapshot. You can try to restore manually by running: cat 'drupal.tar.gz' | ssh xxxx 'restore INCLUDE_GIT'


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


How reproducible:


Steps to Reproduce:
1.  Backup drupal site
2.  Create new app, restore to that app
3.

Actual results:

Restore failure

Expected results:

Restore success


Additional info:

Comment 4 Michal Fojtik 2013-10-23 16:01:26 UTC
Something must change the permissions of the settings.php. From:

https://github.com/openshift/drupal-quickstart/blob/master/.openshift/action_hooks/deploy#L66

I can see that the perms are u+w, however on my devenv the permissions are wrong:

-r--r--r--. 1 5267dbf59b1d09a7d700007c 5267dbf59b1d09a7d700007c 24K Oct 23 10:24 app-root/data/sites/default/settings.php

Comment 5 Michal Fojtik 2013-10-24 11:44:52 UTC
After some investigation I found what cause this problem and I made a PR to fix it:

https://github.com/mfojtik/drupal-quickstart/commit/a5a54a45f54b3a17a6ee07e5de30fbbdb02e7388

 ~ → rhc snapshot save drupal
Pulling down a snapshot to drupal.tar.gz...
Creating and sending tar.gz

RESULT:
Success
 ~ → rhc snapshot restore drupal
Restoring from snapshot drupal.tar.gz...
Removing old git repo: ~/git/drupal.git/
Removing old data dir: ~/app-root/data/*
Restoring ~/git/drupal.git and ~/app-root/data
# ... 
RESULT:
Success

Question:

Jhon, I'm not a Drupal/PHP guru, but do we really need to prevent users to access their own files? The settings.php file is generated in 'deploy' hook and stored inside the 'app-root/data' and so, users should have permissions to change whatever they want inside this directory. Or am I wrong?

Comment 8 chunchen 2013-10-29 05:46:30 UTC
It's fixed, verified on devenv_3958, migration test on from devenv_stage_528 to devenv_3958, please refer to the following results:

1. For the migration test
1) Create drupal quickstart
rhc app create drupal php-5.3 mysql-5 cron --from-code=git://github.com/openshift/drupal-quickstart.git --no-git
2) Backup the drupal
rhc snapshot save drupal
3) Do upgrade and migrate
4) Create a new php app with mysql and cron
rhc app create cphp php-5.3 mysql-5.1 cron-1 --no-git
5) Restore this app from drupal backup
rhc snapshot restore -f ./drupal.tar.gz -a cphp
6) Access this app

at Step 6: show drupal page

2. For normal test
1) Create drupal quickstart
rhc app create drupal php-5.3 mysql-5 cron --from-code=git://github.com/openshift/drupal-quickstart.git --no-git
2) Backup the drupal
3) Create a new php app with mysql and cron
rhc app create cphp00 php-5.3 mysql-5.1 cron-1 --no-git
4) Restore this app from drupal backup
rhc snapshot restore -f ./drupal.tar.gz -a cphp00
5) Access this app

at Step 5: show drupal page

Comment 9 Jhon Honce 2014-06-09 15:38:22 UTC
clearing needinfo request


Note You need to log in before you can comment on or make changes to this bug.