mirror of
https://github.com/rancher/os.git
synced 2025-09-12 13:17:17 +00:00
Only send project event on success
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user