web-dev-qa-db-ja.com

「drush rsync」が「aliases.drushrc.php」の「exclude-paths」で指定されたパスを除外しない

私は、drush-rsyncに、エイリアス定義で指定されたファイル/パスを除外させようとしています。

/etc/drush/aliases.drushrc.phpで、私は定義しました

$aliases['site_A'] = array(
    'root'   => '/home/test/site_A',
    'uri'    => 'site_A.loc',
    'path-aliases' => array( '%files' => 'sites/default/files', '%dump' => '/home/test/site_A-dump.sql',),
    'command-specific' => array(
        'sql-sync' => array('no-cache' => TRUE,'structure-tables' => array(
        'custom' => array('cache','cache_filter','cache_menu','cache_page','history','sessions','watchdog'),),),
    ),
    'rsync' => array ('simulate' => '0', 'no-cache' => TRUE, 'mode' => 'rlptDz', 'exclude-paths' => 'BLAH:',
    ),
);
$aliases['site_B'] = array(
    'root'   => '/home/test/site_B', 'uri'    => 'site_B.loc',
    'path-aliases' => array(%files' => 'sites/default/files', '%dump' => '/home/test/site_B-dump.sql',),
    'command-specific' => array(
        'sql-sync' => array('no-cache' => TRUE,'structure-tables' => array(
        'custom' => array('cache','cache_filter','cache_menu','cache_page','history','sessions','watchdog'),),),
    ),
    'rsync' => array ('simulate' => '0', 'no-cache' => TRUE, 'mode' => 'rlptDz', 'exclude-paths' => 'BLAH:',
    ),
);

Rsyncステップをテストすると、

drush --debug --simulate rsync @site_A @site_B
    Bootstrap to phase 0. [0.01 sec, 4.41 MB]                            [bootstrap]
    Drush bootstrap phase : _drush_bootstrap_drush() [0.02 sec, 4.67 MB] [bootstrap]
    Loading drushrc "/etc/drush/drushrc.php" into "system" scope. [0.02 sec, 4.68 MB]                         [bootstrap]
    Cache HIT cid: 5.0-dev-commandfiles-0-f008e6f6337e0f66b073976a381b26a6 [0.03 sec, 4.69 MB]                    [debug]
    Bootstrap to phase 0. [0.12 sec, 9.76 MB]                                                                 [bootstrap]
    Bootstrap to phase 0. [0.14 sec, 9.76 MB]                                                                 [bootstrap]
    Found command: core-rsync (commandfile=core) [0.15 sec, 9.76 MB]                                          [bootstrap]
    Including /usr/local/drush/commands/core/rsync.core.inc [0.19 sec, 9.77 MB]                        [bootstrap]
    Load alias @site_A [0.2 sec, 9.87 MB]                                                                       [notice]
    Load alias @site_B [0.34 sec, 9.89 MB]                                                                    [notice]
    Calling system(rsync -e 'ssh ' -akzv --exclude=".git" --exclude=".gitignore" --exclude=".hg" --exclude=".hgignore" --exclude=".hgrags" --exclude=".bzr" --exclude=".bzrignore" --exclude=".bzrtags" --exclude=".svn" --exclude="settings.php" --stats --progress /home/test/site_A// /home/test/site_B/);
    Command dispatch complete [0.75 sec, 10.05 MB]                                                               [notice]
    Peak memory usage was 11.42 MB [0.75 sec, 10.05 MB]                                                          [memory]

「BLAH」の除外はどこにもありません。

コマンドラインだけでなく、設定ファイルの使用を除外するにはどうすればよいですか?


編集#1

私はこの例 http://emspace.com.au/article/drush-aliases-primer-live-dev-syncing に従い、ネストレベルを誤ってカウントしました:-/

私のエイリアスのdefsを修正し、

$aliases['site_A'] = array(
    'root'   => '/home/test/site_A', 'uri' => 'site_A.loc',
    'path-aliases' => array( '%files' => 'sites/default/files', '%dump' => '/home/test/site_A-dump.sql',),
    'command-specific' => array(
        'sql-sync' => array(
            'no-cache' => TRUE,
            'structure-tables' => array(
                'custom' => array('cache','cache_filter','cache_menu','cache_page','history','sessions','watchdog'),
            ),
        ),
        'rsync' => array (
            'no-cache' => TRUE,
            'mode' => 'rlptDz',
            'exclude-paths' => 'BLAH:',
        ),
    ),
);
$aliases['site_B'] = array(
    'root'   => '/home/test/site_B', 'uri' => 'site_B.loc',
    'path-aliases' => array(%files' => 'sites/default/files', '%dump' => '/home/test/site_B-dump.sql',),
    'command-specific' => array(
        'sql-sync' => array(
            'no-cache' => TRUE,
            'structure-tables' => array(
                'custom' => array('cache','cache_filter','cache_menu','cache_page','history','sessions','watchdog'),
            ),
        ),
        'rsync' => array (
            'no-cache' => TRUE,
            'mode' => 'rlptDz',
            'exclude-paths' => 'BLAH:',
        ),
    ),
);

そして 'drush rsync'コマンドを再実行し、

drush --debug --simulate rsync @site_A @site_B
    Bootstrap to phase 0. [0.01 sec, 4.41 MB]                            [bootstrap]
    Drush bootstrap phase : _drush_bootstrap_drush() [0.02 sec, 4.67 MB] [bootstrap]
    Loading drushrc "/etc/drush/drushrc.php" into "system" scope. [0.02 sec, 4.68 MB]                         [bootstrap]
    Cache HIT cid: 5.0-dev-commandfiles-0-f008e6f6337e0f66b073976a381b26a6 [0.04 sec, 4.69 MB]                    [debug]
    Bootstrap to phase 0. [0.12 sec, 9.76 MB]                                                                 [bootstrap]
    Bootstrap to phase 0. [0.14 sec, 9.76 MB]                                                                 [bootstrap]
    Found command: core-rsync (commandfile=core) [0.14 sec, 9.76 MB]                                          [bootstrap]
    Including /usr/local/drush/commands/core/rsync.core.inc [0.19 sec, 9.78 MB]                        [bootstrap]
    Load alias @site_A [0.19 sec, 9.88 MB]                                                                      [notice]
    Load alias @site_B [0.33 sec, 9.89 MB]                                                                    [notice]
    Calling system(rsync -e 'ssh ' -akzv --exclude=".git" --exclude=".gitignore" --exclude=".hg" --exclude=".hgignore" --exclude=".hgrags" --exclude=".bzr" --exclude=".bzrignore" --exclude=".bzrtags" --exclude=".svn" --exclude="settings.php" --stats --progress --no-cache /home/test/site_A// /home/test/site_B/);
    Command dispatch complete [0.73 sec, 10.05 MB]                                                               [notice]
    Peak memory usage was 11.42 MB [0.73 sec, 10.05 MB]

除外リストに表示される「BLAH」はありません。

念のために "--simulate"を削除すると(どうすればrsyncを "試用"できますか?これで "--simulate"を使用しない場合は?)、同期は機能しますが、同じ問題-いいえexlcusionリストの「BLAH」、

drush --debug rsync @site_A @site_B
    Bootstrap to phase 0. [0.01 sec, 4.41 MB]                            [bootstrap]
    Drush bootstrap phase : _drush_bootstrap_drush() [0.02 sec, 4.67 MB] [bootstrap]
    Loading drushrc "/etc/drush/drushrc.php" into "system" scope. [0.02 sec, 4.68 MB]                         [bootstrap]
    Cache HIT cid: 5.0-dev-commandfiles-0-f008e6f6337e0f66b073976a381b26a6 [0.04 sec, 4.69 MB]                    [debug]
    Bootstrap to phase 0. [0.13 sec, 9.76 MB]                                                                 [bootstrap]
    Bootstrap to phase 0. [0.15 sec, 9.76 MB]                                                                 [bootstrap]
    Found command: core-rsync (commandfile=core) [0.16 sec, 9.76 MB]                                          [bootstrap]
    Including /usr/local/drush/commands/core/rsync.core.inc [0.2 sec, 9.77 MB]                         [bootstrap]
    Load alias @site_A [0.21 sec, 9.87 MB]                                                                      [notice]
    Load alias @site_B [0.35 sec, 9.89 MB]                                                                    [notice]
    You will destroy data from /home/test/site_B/ and replace with data from /home/test/site_A//
    Do you really want to continue? (y/n): y
    Calling system(rsync -e 'ssh ' -akzv --exclude=".git" --exclude=".gitignore" --exclude=".hg" --exclude=".hgignore" --exclude=".hgrags" --exclude=".bzr" --exclude=".bzrignore" --exclude=".bzrtags" --exclude=".svn" --exclude="settings.php" --stats --progress /home/test/site_A// /home/test/site_B/);
    sending incremental file list
    ./
    sites/default/
    sites/default/files/ctools/
    sites/default/files/ctools/css/

    Number of files: 4118
    Number of files transferred: 0
    Total file size: 29639208 bytes
    Total transferred file size: 0 bytes
    Literal data: 0 bytes
    Matched data: 0 bytes
    File list size: 83532
    File list generation time: 0.004 seconds
    File list transfer time: 0.000 seconds
    Total bytes sent: 94536
    Total bytes received: 11003

    sent 94536 bytes  received 11003 bytes  70359.33 bytes/sec
    total size is 29639208  speedup is 280.84
    Command dispatch complete [3.21 sec, 10.05 MB]                                                               [notice]
    Peak memory usage was 11.43 MB [3.21 sec, 10.05 MB]                                                          [memory]
4
user6023

Rsyncコマンド固有のオプションを誤って「コマンド固有」配列の外に配置しました。

厳密なオプション処理を使用するrsyncなどのコマンドでは、Drushグローバルオプション(「シミュレート」など)がサポートされているとは思いません。コマンド固有のオプションで問題が発生する場合は、「シミュレート」を削除します。

以下のコメント#4を編集:

これが私の変更したエイリアスです:

$aliases['dev'] = array (
  'root' => '/srv/www/wherever',
  'uri' => 'wherever.net',
    'command-specific' => array(
        'sql-sync' => array(
            'no-cache' => TRUE,
            'structure-tables-list' => array('cache','cache_filter','cache_menu','cache_page','history','sessions','watchdog'),
        ),
        'rsync' => array (
            'no-cache' => TRUE,
            'mode' => 'rlptDz',
            'exclude-paths' => 'BLAH:',
        ),
    ), 
);

これを使用するコマンドは次のとおりです。

$ drush -s rsync @live @dev 
Calling system(rsync -e 'ssh ' -rlptDz --exclude=".git" --exclude=".gitignore" --exclude=".hg" --exclude=".hgignore" --exclude=".hgrags" --exclude=".bzr" --exclude=".bzrignore" --exclude=".bzrtags" --exclude=".svn" --exclude="BLAH" --exclude="settings.php" --rsync-version=2.6.8 --no-cache=1 [email protected]:/srv/www/wherever/ /srv/www/wherever/);

--exclude = "BLAH"がそこにあり、私があなたと違ってしていることを私は見ることができません。問題を追跡して頑張ってください。

5
greg_1_anderson