mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-02-28 19:14:13 +08:00
fix: Adjust the container task log (#8025)
This commit is contained in:
parent
24cabd214b
commit
aae839f921
@ -11,7 +11,6 @@ import (
|
|||||||
"net/url"
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"path"
|
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"sort"
|
"sort"
|
||||||
"strconv"
|
"strconv"
|
||||||
@ -343,8 +342,7 @@ func (u *ContainerService) ContainerCreateByCommand(req dto.ContainerCreateByCom
|
|||||||
}
|
}
|
||||||
go func() {
|
go func() {
|
||||||
taskItem.AddSubTask(i18n.GetWithName("ContainerCreate", containerName), func(t *task.Task) error {
|
taskItem.AddSubTask(i18n.GetWithName("ContainerCreate", containerName), func(t *task.Task) error {
|
||||||
logPath := path.Join(global.Dir.LogDir, task.TaskScopeContainer, req.TaskID+".log")
|
return cmd.ExecShellWithTask(taskItem, 5*time.Minute, "bash", "-c", req.Command)
|
||||||
return cmd.ExecShell(logPath, 5*time.Minute, "bash", "-c", req.Command)
|
|
||||||
}, nil)
|
}, nil)
|
||||||
_ = taskItem.Execute()
|
_ = taskItem.Execute()
|
||||||
}()
|
}()
|
||||||
@ -507,7 +505,6 @@ func (u *ContainerService) ContainerCreate(req dto.ContainerOperate) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
con, err := client.ContainerCreate(ctx, config, hostConf, networkConf, &v1.Platform{}, req.Name)
|
con, err := client.ContainerCreate(ctx, config, hostConf, networkConf, &v1.Platform{}, req.Name)
|
||||||
taskItem.LogWithStatus(i18n.GetMsgByKey("ContainerCreate"), err)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
taskItem.Log(i18n.GetMsgByKey("ContainerCreateFailed"))
|
taskItem.Log(i18n.GetMsgByKey("ContainerCreateFailed"))
|
||||||
_ = client.ContainerRemove(ctx, req.Name, container.RemoveOptions{RemoveVolumes: true, Force: true})
|
_ = client.ContainerRemove(ctx, req.Name, container.RemoveOptions{RemoveVolumes: true, Force: true})
|
||||||
|
@ -129,7 +129,7 @@ const rules = reactive({
|
|||||||
name: [{ validator: checkName, trigger: 'blur' }],
|
name: [{ validator: checkName, trigger: 'blur' }],
|
||||||
});
|
});
|
||||||
function checkName(rule: any, value: any, callback: any) {
|
function checkName(rule: any, value: any, callback: any) {
|
||||||
if (value === 'local') {
|
if (value === 'local' && dialogData.value.title !== 'edit') {
|
||||||
return callback(new Error(i18n.global.t('terminal.localHelper')));
|
return callback(new Error(i18n.global.t('terminal.localHelper')));
|
||||||
}
|
}
|
||||||
callback();
|
callback();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user