1
0
mirror of https://github.com/rancher/os.git synced 2025-07-31 06:32:09 +00:00

Only send project event on success

This commit is contained in:
Darren Shepherd 2015-04-07 11:41:30 -07:00
parent 09b0e3f970
commit 252e491286

View File

@ -36,16 +36,14 @@ func (c *containerBasedService) Up() error {
create = true
}
var event project.Event
if create {
container.Create()
c.project.Notify(project.CONTAINER_CREATED, c, map[string]string{
project.CONTAINER_ID: container.Container.ID,
})
event = project.CONTAINER_CREATED
} else {
container.StartAndWait()
c.project.Notify(project.CONTAINER_STARTED, c, map[string]string{
project.CONTAINER_ID: container.Container.ID,
})
event = project.CONTAINER_STARTED
}
if container.Err != nil {
@ -56,6 +54,12 @@ func (c *containerBasedService) Up() error {
return project.ErrRestart
}
if container.Container != nil {
c.project.Notify(event, c, map[string]string{
project.CONTAINER_ID: container.Container.ID,
})
}
return container.Err
}