provision-deploy fails with: Failed to extract the contents of /var/aegir/backups/xxxx.tar.gz to (The target directory could not be written to)

The command executed as aegir user:

drush --platform='/var/aegir/drupal-6.19' --uri='model.example.org' provision-deploy /var/aegir/backups/modelgruppen.tar.gz

The full output:

Failed to extract the contents of                                    [error]
/var/aegir/backups/modelgruppen.tar.gz to  (The target directory
could not be written to)
An error occurred at function :                                      [error]
drush_provision_drupal_pre_provision_deploy
aegir@node:~/drupal-6.19$ drush --platform='/var/aegir/drupal-6.19' --uri='model.example.org' provision-deploy /var/aegir/backups/modelgruppen.tar.gz
Failed to extract the contents of                                    [error]
/var/aegir/backups/modelgruppen.tar.gz to  (The target directory
could not be written to)
An error occurred at function :                                      [error]
drush_provision_drupal_pre_provision_deploy

Notice the lack of a destination in the error messages. I believe the extract path is set in drush_provision_drupal_provision_deploy_validate:
(deploy.provision.inc line 38)

drush_set_option('extract_path', d()->site_path);

But where is site_path comming from? From the provisionSite class? (provision.environment.inc line 566) But do we have a Site Enviroment at this time? Or am I just giving the wrong parameters to provision-deply?
I must admit, I'm not that familiar with the provison code base to know that???

Running the same command with --debug gives this output:

Drush bootstrap phase : _drush_bootstrap_drupal_root() [0.24 sec,    [bootstrap]
4.15 MB]
Loading drushrc "/var/aegir/drupal-6.19/drushrc.php" into "drupal"   [bootstrap]
scope. [0.24 sec, 4.15 MB]
Initialized Drupal 6.19 root directory at /var/aegir/drupal-6.19        [notice]
[0.25 sec, 4.89 MB]
Found command: provision-deploy (commandfile=provision) [0.27 sec,   [bootstrap]
4.88 MB]
Initializing drush commandfile: drush_make [0.27 sec, 4.88 MB]       [bootstrap]
Initializing drush commandfile: drush_make_d_o [0.27 sec, 4.88 MB]   [bootstrap]
Initializing drush commandfile: provision [0.27 sec, 4.88 MB]        [bootstrap]
Load alias @self [0.27 sec, 4.88 MB]                                    [notice]
Load alias @server_master [0.27 sec, 4.88 MB]                           [notice]
Loading mysql driver for the db service [0.27 sec, 4.89 MB]             [notice]
Loading apache driver for the http service [0.27 sec, 4.89 MB]          [notice]
Including /var/aegir/.drush/provision/db/deploy.provision.inc [0.27  [bootstrap]
sec, 4.89 MB]
Including /var/aegir/.drush/provision/http/deploy.provision.inc [0.27[bootstrap]
sec, 4.89 MB]
Including /var/aegir/.drush/provision/platform/deploy.provision.inc  [bootstrap]
[0.27 sec, 4.9 MB]
Deploying site from /var/aegir/backups/modelgruppen.tar.gz [0.28 sec,  [message]
4.95 MB]
Failed to extract the contents of                                    [error]
/var/aegir/backups/modelgruppen.tar.gz to  (The target directory
could not be written to) [0.28 sec, 4.95 MB]
An error occurred at function :                                      [error]
drush_provision_drupal_pre_provision_deploy [0.28 sec, 4.96 MB]
Changes for drush_provision_drupal_pre_provision_deploy module have   [rollback]
been rolled back. [0.28 sec, 4.96 MB]
Changes for drush_db_pre_provision_deploy module have been rolled     [rollback]
back. [0.28 sec, 4.96 MB]
Command dispatch complete [0.28 sec, 4.96 MB]                           [notice]
Peak memory usage was 5.4 MB [0.28 sec, 4.96 MB]                        [memory]

aegir version: 0.4-alpha12
Drush: 6.x-3.3
PHP: 5.2.4
Ubuntu 8.04

Please advice

Thanks
Hans Henrik

Comments

hhg’s picture

Well, sometimes it just a matter of finding the rigth documentation. Adrians Excelent Blog at http://developmentseed.org/blog/2010/jul/06/aegir-support-multi-server-s... tells HOW to use provision from the commandline:

First, setup an alias for the new site:

drush/drush.php provision-save @modelgrp --context_type=site --platform=@platform_Drupal619 --uri=model.example.org

Then deploy the backup:

drush/drush.php @modelgrp provision-deploy /var/aegir/backups/modelgruppen.tar.gz

I'm getting some warnings, but the site is created:

Created modelgrpcmsddsdk database                                    [success]
array_keys(): The first argument should be an array                  [warning]
deploy.provision.inc:84
array_merge(): Argument #2 is not an array deploy.provision.inc:88   [warning]
Invalid argument supplied for foreach() deploy.provision.inc:89      [warning]
No database updates required                                         [success]
'all' cache was cleared                                              [success]
Finished performing updates.                                         [ok]

Maybe I'm still missing something in the alias setup?

adrinux’s picture

I'm trying to deploy some sites form an alpha8 backup to a freshly installed alpha13 and getting the same error. as is mrfelton on IRC.

It looks like a permissions error, mrfelton gets around the issue by setting permissions on files.

We're both using Ubuntu 10.04.

php /var/aegir/drush/drush.php provision-deploy --debug /var/aegir/platforms/sphop.perlucida.com-20100911.010303.tar.gz sphop-stage.perlucida.com 
Drush bootstrap phase : _drush_bootstrap_drupal_root() [0.07 sec, 4.2 MB]            [bootstrap]
Loading drushrc "/var/aegir/platforms/d6/drushrc.php" into "drupal" scope. [0.07 sec,[bootstrap]
4.2 MB]
Initialized Drupal 6.19 root directory at /var/aegir/platforms/d6 [0.09 sec, 6.08 MB]   [notice]
Found command: provision-deploy (commandfile=provision) [0.1 sec, 6.08 MB]           [bootstrap]
Initializing drush commandfile: drush_make [0.1 sec, 6.08 MB]                        [bootstrap]
Initializing drush commandfile: drush_make_d_o [0.1 sec, 6.08 MB]                    [bootstrap]
Initializing drush commandfile: provision [0.1 sec, 6.09 MB]                         [bootstrap]
Load alias @self [0.1 sec, 6.09 MB]                                                     [notice]
Load alias @server_master [0.1 sec, 6.09 MB]                                            [notice]
Loading mysql driver for the db service [0.1 sec, 6.1 MB]                               [notice]
Loading apache driver for the http service [0.1 sec, 6.11 MB]                           [notice]
Including /var/aegir/.drush/provision/db/deploy.provision.inc [0.1 sec, 6.12 MB]     [bootstrap]
Including /var/aegir/.drush/provision/http/deploy.provision.inc [0.1 sec, 6.12 MB]   [bootstrap]
Including /var/aegir/.drush/provision/platform/deploy.provision.inc [0.1 sec, 6.13   [bootstrap]
MB]
Deploying site from /var/aegir/platforms/sphop.perlucida.com-20100911.010303.tar.gz    [message]
[0.11 sec, 6.17 MB]
Failed to extract the contents of                                                    [error]
/var/aegir/platforms/sphop.perlucida.com-20100911.010303.tar.gz to  (The target
directory could not be written to) [0.11 sec, 6.18 MB]
An error occurred at function : drush_provision_drupal_pre_provision_deploy [0.11    [error]
sec, 6.18 MB]
Changes for drush_provision_drupal_pre_provision_deploy module have been rolled back. [rollback]
[0.11 sec, 6.18 MB]
Changes for drush_db_pre_provision_deploy module have been rolled back. [0.11 sec,    [rollback]
6.18 MB]
Command dispatch complete [0.11 sec, 6.16 MB]                                           [notice]
Peak memory usage was 6.67 MB [0.11 sec, 6.16 MB]                                       [memory]
adrinux’s picture

I also had success creating the alias first:

php /var/aegir/drush/drush.php provision-save @sphop.perlucida.com --context_type=site --platform=@platform_d6 --uri=sphop.perlucida.com

And then running the provision-deploy:

php /var/aegir/drush/drush.php @sphop.perlucida.com provision-deploy /var/aegir/platforms/sphop.perlucida.com-20100911.010303.tar.gz

Note that you specify the destination url via the alias, not with the deploy as was previously the case.

DanielJohnston’s picture

I tried the suggested solution here without success. Continue to get a permissions error, and can't find any folders with permissions problems. Running command as user aegir generates the error below, running as root can't find settings.php.

janieluk:~/drupal-7.0-alpha7$ php /var/aegir/drush/drush.php provision-save @danieljohnston.co.uk --context_type=site --platform='/var/aegir/drupal-7.0-alpha7' --uri='danieljohnston.co.uk'
janieluk:~/drupal-7.0-alpha7$ php /var/aegir/drush/drush.php @danieljohnston.co.uk provision-deploy /var/aegir/danieljohnston.co.uk-20101007.144006.tar.gz
array_map(): Argument #2 should be an array db.drush.inc:236                                                      [warning]
array_unique(): The argument should be an array db.drush.inc:236                                                  [warning]
Invalid argument supplied for foreach() db.drush.inc:97                                                           [warning]
Created danieljohnstonco database                                                                                 [success]
Failed to extract the contents of /var/aegir/danieljohnston.co.uk-20101007.144006.tar.gz to                       [error]
/sites/danieljohnston.co.uk (The target directory could not be written to)
An error occurred at function : drush_provision_drupal_pre_provision_deploy                                       [error]
array_map(): Argument #2 should be an array db.drush.inc:236                                                      [warning]
array_unique(): The argument should be an array db.drush.inc:236                                                  [warning]
Invalid argument supplied for foreach() db.drush.inc:137                                                          [warning]

As an aside, the reason I'm trying to deploy a site through this in the first place is that Aegir would not allow me to restore a backup of a site - that broke during migration - to its previous platform.

DanielJohnston’s picture

OK I seem to have got to the bottom of this. I didn't know the name of the variable for the platform so I just used the platform's path instead. Luckily someone posted the solution on a random part of the internet yesterday at http://pastie.org/pastes/1212973 - the variable name is found in /var/aegir/config/server_master/apache/platform.d as the first part of the filename for the relevant platform config file. Using the method above with the platform variable name from there has done the trick. Good lord that wasn't as simple as I'd hoped.

adrinux’s picture

That was my pastie, but the info is a bit wrong, you'll actually find the alias in /var/aegir/.drush, so for the platform mentioned in #3 above, which is called d6, you should find:

/var/aegir/.drush/platform_d6.alias.drushrc.php

and the alias is thus platform_d6

sime’s picture

I had success with #3, and created a page that describes a workable process for migrating sites from Aegir to new Aegir0.4a15. Could be improved, but it's useful I hope.

http://community.aegirproject.org/node/117

Anonymous’s picture

Status: Active » Fixed
janieluk:~/drupal-7.0-alpha7$ php /var/aegir/drush/drush.php provision-save @danieljohnston.co.uk --context_type=site --platform='/var/aegir/drupal-7.0-alpha7' --uri='danieljohnston.co.uk'

The --platform there should be an alias and not a path to the platform. Per #3.

Closing this as it works as designed (if implemented correctly per #3 and #7).

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.