Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
My policy.drush.inc file in my user's .drush folder:
function drush_policy_sql_sync_validate($source = NULL, $destination = NULL) {
return drush_set_error(dt('Not allowed'));
}
Output when not explicitly including .drush (see attached for full debug output):
vagrant@ubuntu-10:/srv/www$ drush sql-sync @prod @local --no-cache
You will destroy data from drupal and replace with data from test.org/testorg_prod.
You might want to make a backup first, using the sql-dump command.
Do you really want to continue? (y/n): n
Aborting. [cancel]
Output when explicitly including .drush (see attached for full debug output):
vagrant@ubuntu-10:/srv/www$ drush --include=~/.drush sql-sync @prod @local --no-cache
Not allowed [error]
Comment | File | Size | Author |
---|---|---|---|
policy_included_debug.txt | 2.92 KB | dkingofpa | |
policy_not_included_debug.txt | 3.74 KB | dkingofpa |
Comments
Comment #1
moshe weitzman CreditAttribution: moshe weitzman commentedWhere did you put the policy file? At @local or at @prod? I think it needs to be @prod. Not sure where though. try running
drush @prod status
and review the list of config files that are mentioned at the bottom.Comment #2
greg.1.anderson CreditAttribution: greg.1.anderson commentedIf you have
$options['include'][] = "/some/path/that/does/not/exist";
, then it prevented Drush from searching for any further paths in the list, including $HOME/.drush. Putting --include= on the cli increases the priority of this location, working around this bug.Fix committed. 262047a.
Comment #3
dkingofpa CreditAttribution: dkingofpa commentedUgh...I believe my ultimate problem with this was that after I added my policy.drush.inc, I never cleared drush's cache. Dang it. But at least it seems like a bug was squashed in the mean time.