sourcebroker / deployer-extended-database

Deployer tasks to manage database synchronization between application instances.
MIT License
39 stars 13 forks source link

Dp:push Error "bad variable name" #6

Closed tazeverywhere closed 3 years ago

tazeverywhere commented 4 years ago

Hi @kszymukowicz ,

Sorry, I have again an error and didn't found the answer.

When I do to do a dep db:push staging -vv (or dep db:copy development --options=target:staging),

Executing task db:push
[localhost] > ./vendor/bin/dep db:export --options=dumpcode:b9735c1c53ddb188dcd98105d314046c  -vv
[localhost] > ./vendor/bin/dep db:upload staging --options=dumpcode:b9735c1c53ddb188dcd98105d314046c  -vv
[localhost] > ./vendor/bin/dep db:process staging --options=dumpcode:b9735c1c53ddb188dcd98105d314046c  -vv
[localhost] > ./vendor/bin/dep db:import staging --options=dumpcode:b9735c1c53ddb188dcd98105d314046c  -vv

I have an error :

Exit Code: 1 (General error)                                                                                                                                         

Host Name: staging                                                                                                                                                   

================                                                                                                                                                     

In Process.php line 239:           

[Symfony\Component\Process\Exception\ProcessFailedException]                                                                                                       

The command "export $(cat .env | xargs) && ./vendor/bin/dep db:import:post_command:wp_domains --options=dumpcode:b9735c1c53ddb188dcd98105d314046c" failed.                                                                                                                                                               

Exit Code: 2(Misuse of shell builtins)         

Error Output:                                                                                                                                                      
================                                                                                                                                                   
 sh: 1: export: #: bad variable name

When I do a deb db:pull staging, everything is working fine.

Any idea where the problem could come ? (It was all ok before upgrading to the deployer-extended-wordpress-composer 4.x version that use deployer v.6)

Thanks for your help, cheers, Sylvain

kszymukowicz commented 4 years ago

Sry. I missed your post.

The problem is that you have some comment in your .env file and there is first part of command export $(cat .env | xargs) which exports all vars from .env but it does not support comments.

The fastest solution is to remove comments from your .env file.

kszymukowicz commented 4 years ago

You can also try to export only the var we actually need there which is PATH.

set('db_default', [
    'ignore_tables_out' => [],
    'post_sql_in' => '',
    'post_command' => ['export $(cat .env | grep PATH | xargs) && {{local/bin/deployer}} db:import:post_command:wp_domains']
]);
tazeverywhere commented 4 years ago

Hi, no problem for the miss :) thank you for your help, it makes sense. I will try that ! cheers, Sylvain

tazeverywhere commented 3 years ago

sorry, late feedback, problem solved, thx again for the tips 👍