hashbangcode / vlad

Vlad - Vagrant LAMP Ansible Drupal
173 stars 53 forks source link

mailcatcher - couldn't connect to host #138

Closed nlisgo closed 9 years ago

nlisgo commented 9 years ago

Here is the output:

TASK: [mailcatcher | kill mailcatcher] ****************************************
failed: [vlad] => {"changed": false, "cmd": ["curl", "-s", "-i", "-v", "-X", "DELETE", "http://127.0.0.1:1080"], "delta": "0:00:00.007036", "end": "2015-02-05 22:24:24.994528", "failed": true, "failed_when_result": true, "rc": 7, "start": "2015-02-05 22:24:24.987492", "stdout_lines": []}
stderr: * About to connect() to 127.0.0.1 port 1080 (#0)
*   Trying 127.0.0.1... Connection refused
* couldn't connect to host
* Closing connection #0
...ignoring

TASK: [mailcatcher | kill mailcatcher (via pid)] ******************************
failed: [vlad] => {"changed": false, "cmd": "pidof ruby | xargs sudo kill -9", "delta": "0:00:00.015255", "end": "2015-02-05 22:24:25.129102", "failed": true, "failed_when_result": true, "rc": 123, "start": "2015-02-05 22:24:25.113847", "stdout_lines": []}
stderr: Usage:
  kill pid ...              Send SIGTERM to every process listed.
  kill signal pid ...       Send a signal to every process listed.
  kill -s signal pid ...    Send a signal to every process listed.
  kill -l                   List all signal names.
  kill -L                   List all signal names in a nice table.
  kill -l signal            Convert between signal numbers and names.
...ignoring
dixhuit commented 9 years ago

Ansible's been instructed to ignore these errors (hence the ...ignoring parts). In short, the errors are undesirable but expected :)

philipnorton42 commented 9 years ago

Sorry, Wednesday morning label mistakes :(

I did see this different output for the kill task last night when doing some testing. It is meant to ignore the error but the output of the kill command makes me think that something odd is going on. Thanks for reporting this.

philipnorton42 commented 9 years ago

I've found the problem here and pushed a fix for it.

The command being run was:

pidof ruby | xargs sudo kill -9

But when first run there is no output from the pidof command, which caused an error from the kill command complaining about missing arguments. The solution was to add the -r flag to xargs to prevent it from running when no output was found. Here is the new command.

pidof ruby | xargs -r sudo kill -9