1
0
mirror of https://github.com/rancher/os.git synced 2025-08-07 17:54:12 +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 create = true
} }
var event project.Event
if create { if create {
container.Create() container.Create()
c.project.Notify(project.CONTAINER_CREATED, c, map[string]string{ event = project.CONTAINER_CREATED
project.CONTAINER_ID: container.Container.ID,
})
} else { } else {
container.StartAndWait() container.StartAndWait()
c.project.Notify(project.CONTAINER_STARTED, c, map[string]string{ event = project.CONTAINER_STARTED
project.CONTAINER_ID: container.Container.ID,
})
} }
if container.Err != nil { if container.Err != nil {
@ -56,6 +54,12 @@ func (c *containerBasedService) Up() error {
return project.ErrRestart return project.ErrRestart
} }
if container.Container != nil {
c.project.Notify(event, c, map[string]string{
project.CONTAINER_ID: container.Container.ID,
})
}
return container.Err return container.Err
} }