supervisorctl task: why does state=restarted error out if it isn't running?

These lines of codes caused me a lot of angst earlier today:

elif not running and state == ‘restarted’:
module.fail_json(msg=‘Could not restart %s because it is not running’ % name)

I’m curious as to why this decision was made. To my mind, “restart” means “restart if it’s already running, otherwise start it”. It’s the sort of thing you run as a notify after a config change or code change. In my opinion it shouldn’t care if the process isn’t already started, because the first time a deploy is run after a new server install the task won’t be running.

To workaround this I have to explicitly stop the app, then start the app. Not a huge deal but it isn’t what I expected at all. Is it a philosophical thing?

Regards,
-scott

I agree, it's a bug.

Please submit a pull request to fix it or file a bug.

I don't use supervisorctl, so it would be nice if someone who does
could fit it and test.

I will do so.

-scott