{"action":"opened","issue":{"url":"https://api.github.com/repos/ansible/ansible/issues/12591","labels_url":"https://api.github.com/repos/ansible/ansible/issues/12591/labels{/name}","comments_url":"https://api.github.com/repos/ansible/ansible/issues/12591/comments","events_url":"https://api.github.com/repos/ansible/ansible/issues/12591/events","html_url":"https://github.com/ansible/ansible/issues/12591","id":109292682,"number":12591,"title":"Ansible service check ignores exit code for status check","user":{"login":"leonard84","id":1151511,"avatar_url":"https://avatars.githubusercontent.com/u/1151511?v=3","gravatar_id":"","url":"https://api.github.com/users/leonard84","html_url":"https://github.com/leonard84","followers_url":"https://api.github.com/users/leonard84/followers","following_url":"https://api.github.com/users/leonard84/following{/other_user}","gists_url":"https://api.github.com/users/leonard84/gists{/gist_id}","starred_url":"https://api.github.com/users/leonard84/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leonard84/subscriptions","organizations_url":"https://api.github.com/users/leonard84/orgs","repos_url":"https://api.github.com/users/leonard84/repos","events_url":"https://api.github.com/users/leonard84/events{/privacy}","received_events_url":"https://api.github.com/users/leonard84/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-10-01T12:49:47Z","updated_at":"2015-10-01T12:49:47Z","closed_at":null,"body":"With 22dbb65b13400db07b537cdfd38926cc03e48dfa the service status detection was changed, this change breaks the status reporting of runit's `sv status`\r\n\r\n```\r\n> sudo /etc/init.d/myservice status\r\nrun: myservice: (pid 30832) 259s; run: log: (pid 18809) 1973s\r\n> echo $?\r\n0\r\n> sudo /etc/init.d/myservice status\r\ndown: myservice: 2s, normally up; run: log: (pid 18809) 1990s\r\n> echo $?\r\n3\r\n```\r\n\r\nThe problem is that the code now checks for and subsequently ignores non-zero return codes.\r\n```\r\n elif \"run\" in cleanout and \"not\" not in cleanout:\r\n                 self.running = True\r\n```\r\nSince runit reports on the service and its log supervisor together this causes problems.\r\n\r\nhttp://smarden.org/runit/sv.8.html\r\nhttp://smarden.org/runit/faq.html#lsb\r\n\r\nI see two possible fixes, first is to add a check for \"down\" in the status line before checking for \"run\", or allow non-zero return codes to override this heuristic.\r\n"}}