pantheon-deprecated / terminus-deprecated

Deprecated CLI for Pantheon. Do not install. Current project:
https://github.com/pantheon-systems/cli
83 stars 24 forks source link

Pantheon aliases disappear when paliases fails #187

Open cboyden-ucb opened 9 years ago

cboyden-ucb commented 9 years ago

Sometimes when running drush paliases, I get this error:

$ drush paliases
Unable to fetch the aliases. Try again?

When that happens, the pantheon.aliases.drushrc.php is truncated:

$ ll pantheon.aliases.drushrc.php
-rw-------@  1 cboyden  staff     0 Oct 10 12:41 pantheon.aliases.drushrc.php

So all of the aliases disappear.

joshkoenig commented 9 years ago

That's unexpected. If it's not able to fetch the aliases nothing should be written:

https://github.com/pantheon-systems/terminus/blob/master/terminus.drush.inc#L3628

However, we might be able to guard against that further by not initializing any file handler until aliases are successfully fetched.

This would require verifying alias writability differently here:

https://github.com/pantheon-systems/terminus/blob/master/terminus.drush.inc#L3593

cboyden-ucb commented 9 years ago

paliases has been failing more often than not lately, and it still truncates the file every time.

labboy0276 commented 9 years ago

I can confirm this is happening as well:

vagrant@kala:/etc/drush$ drush ta
Unable to fetch the aliases. Try again?                                                                                               [error]
vagrant@kala:/etc/drush$ ls -la
total 40
drwxrwxrwx  2 root    root     4096 Nov 20 16:38 .
drwxr-xr-x 90 root    root     4096 Nov 20 16:31 ..
-rwxrwxrwx  1 root    vagrant 15621 Oct 12 23:41 drushrc.php
-rw-rw-r--  1 vagrant vagrant  9968 Nov 20 11:58 kalastack.aliases.drushrc.php
-rw-r-----  1 vagrant vagrant     0 Nov 20 16:37 pantheon.aliases.drushrc.php
-rw-rw-r--  1 vagrant vagrant    47 Nov 20 16:38 terminatur.aliases.drushrc.php
joshkoenig commented 9 years ago

Hey guys,

We can try escalating this to guard against the file being wiped by a failed request. Sorry for the trouble.

ghost commented 9 years ago

I am experiencing the same issue. I also had trouble getting aliases in the past and the only thing that helps is waiting. Just now I had to try for almost an hour.

mikevanwinkle commented 9 years ago

I think the answer here is probably to write to a temporary resource first and then mv to the destination after the fclose.