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:
parent
09b0e3f970
commit
252e491286
@ -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
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user