mirror of
				https://github.com/1Panel-dev/1Panel.git
				synced 2025-11-04 07:17:39 +08:00 
			
		
		
		
	fix: Adjust the container task log (#8025)
This commit is contained in:
		
							parent
							
								
									24cabd214b
								
							
						
					
					
						commit
						aae839f921
					
				
					 2 changed files with 2 additions and 5 deletions
				
			
		| 
						 | 
				
			
			@ -11,7 +11,6 @@ import (
 | 
			
		|||
	"net/url"
 | 
			
		||||
	"os"
 | 
			
		||||
	"os/exec"
 | 
			
		||||
	"path"
 | 
			
		||||
	"path/filepath"
 | 
			
		||||
	"sort"
 | 
			
		||||
	"strconv"
 | 
			
		||||
| 
						 | 
				
			
			@ -343,8 +342,7 @@ func (u *ContainerService) ContainerCreateByCommand(req dto.ContainerCreateByCom
 | 
			
		|||
	}
 | 
			
		||||
	go func() {
 | 
			
		||||
		taskItem.AddSubTask(i18n.GetWithName("ContainerCreate", containerName), func(t *task.Task) error {
 | 
			
		||||
			logPath := path.Join(global.Dir.LogDir, task.TaskScopeContainer, req.TaskID+".log")
 | 
			
		||||
			return cmd.ExecShell(logPath, 5*time.Minute, "bash", "-c", req.Command)
 | 
			
		||||
			return cmd.ExecShellWithTask(taskItem, 5*time.Minute, "bash", "-c", req.Command)
 | 
			
		||||
		}, nil)
 | 
			
		||||
		_ = taskItem.Execute()
 | 
			
		||||
	}()
 | 
			
		||||
| 
						 | 
				
			
			@ -507,7 +505,6 @@ func (u *ContainerService) ContainerCreate(req dto.ContainerOperate) error {
 | 
			
		|||
				return err
 | 
			
		||||
			}
 | 
			
		||||
			con, err := client.ContainerCreate(ctx, config, hostConf, networkConf, &v1.Platform{}, req.Name)
 | 
			
		||||
			taskItem.LogWithStatus(i18n.GetMsgByKey("ContainerCreate"), err)
 | 
			
		||||
			if err != nil {
 | 
			
		||||
				taskItem.Log(i18n.GetMsgByKey("ContainerCreateFailed"))
 | 
			
		||||
				_ = client.ContainerRemove(ctx, req.Name, container.RemoveOptions{RemoveVolumes: true, Force: true})
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -129,7 +129,7 @@ const rules = reactive({
 | 
			
		|||
    name: [{ validator: checkName, trigger: 'blur' }],
 | 
			
		||||
});
 | 
			
		||||
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')));
 | 
			
		||||
    }
 | 
			
		||||
    callback();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue