]> review.fuel-infra Code Review - openstack-build/heat-build.git/commitdiff
Log when cfn-hup couldn't restart a service
authorTomas Sedovic <tomas@sedovic.cz>
Wed, 25 Apr 2012 14:34:59 +0000 (16:34 +0200)
committerTomas Sedovic <tomas@sedovic.cz>
Wed, 25 Apr 2012 14:34:59 +0000 (16:34 +0200)
`service.restarted` hooks are not run when the restart failed.

Signed-off-by: Tomas Sedovic <tomas@sedovic.cz>
heat/cfntools/cfn_helper.py

index 2267646fd9219b4e54965437fd8e4357d2c58086..475d1e7e1629544e26b3584961194ac107cec77e 100644 (file)
@@ -533,7 +533,11 @@ class ServicesHandler(object):
             running = command.status == 0
             if ensure_running and not running:
                 logging.info("Restarting service %s" % service)
-                handler(self, service, "start")
+                start_cmd = handler(self, service, "start")
+                if start_cmd.status != 0:
+                    logging.warning('Service %s did not start. STDERR: %s' %
+                                    (service, start_cmd.stderr))
+                    return
                 for h in self.hooks:
                     self.hooks[h].event('service.restarted',
                                         service, self.resource)