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]
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

moshe weitzman’s picture

Status: Active » Postponed (maintainer needs more info)

Where 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.

greg.1.anderson’s picture

Status: Postponed (maintainer needs more info) » Fixed

If 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.

dkingofpa’s picture

Ugh...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.

Status: Fixed » Closed (fixed)

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