Skip to content

Commit aae839f

Browse files
authored
fix: Adjust the container task log (#8025)
1 parent 24cabd2 commit aae839f

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

agent/app/service/container.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import (
1111
"net/url"
1212
"os"
1313
"os/exec"
14-
"path"
1514
"path/filepath"
1615
"sort"
1716
"strconv"
@@ -343,8 +342,7 @@ func (u *ContainerService) ContainerCreateByCommand(req dto.ContainerCreateByCom
343342
}
344343
go func() {
345344
taskItem.AddSubTask(i18n.GetWithName("ContainerCreate", containerName), func(t *task.Task) error {
346-
logPath := path.Join(global.Dir.LogDir, task.TaskScopeContainer, req.TaskID+".log")
347-
return cmd.ExecShell(logPath, 5*time.Minute, "bash", "-c", req.Command)
345+
return cmd.ExecShellWithTask(taskItem, 5*time.Minute, "bash", "-c", req.Command)
348346
}, nil)
349347
_ = taskItem.Execute()
350348
}()
@@ -507,7 +505,6 @@ func (u *ContainerService) ContainerCreate(req dto.ContainerOperate) error {
507505
return err
508506
}
509507
con, err := client.ContainerCreate(ctx, config, hostConf, networkConf, &v1.Platform{}, req.Name)
510-
taskItem.LogWithStatus(i18n.GetMsgByKey("ContainerCreate"), err)
511508
if err != nil {
512509
taskItem.Log(i18n.GetMsgByKey("ContainerCreateFailed"))
513510
_ = client.ContainerRemove(ctx, req.Name, container.RemoveOptions{RemoveVolumes: true, Force: true})

frontend/src/views/terminal/host/operate/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ const rules = reactive({
129129
name: [{ validator: checkName, trigger: 'blur' }],
130130
});
131131
function checkName(rule: any, value: any, callback: any) {
132-
if (value === 'local') {
132+
if (value === 'local' && dialogData.value.title !== 'edit') {
133133
return callback(new Error(i18n.global.t('terminal.localHelper')));
134134
}
135135
callback();

0 commit comments

Comments
 (0)