31 lines
		
	
	
		
			633 B
		
	
	
	
		
			Go
		
	
	
	
	
	
		
		
			
		
	
	
			31 lines
		
	
	
		
			633 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| 
								 | 
							
								package helm
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								import (
							 | 
						||
| 
								 | 
							
								    "fmt"
							 | 
						||
| 
								 | 
							
								    "strings"
							 | 
						||
| 
								 | 
							
								    "errors"
							 | 
						||
| 
								 | 
							
								    "os/exec"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    log "oc-deploy/log_wrapper"
							 | 
						||
| 
								 | 
							
								)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								func (this RealHelmCommand) Status(name string) (string, error) {
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    helm_bin := this.Bin
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    msg := fmt.Sprintf("%s status %s --show-resources -o json", helm_bin, name)
							 | 
						||
| 
								 | 
							
								    log.Log().Debug().Msg(msg)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    cmd_args := strings.Split(msg, " ")
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    cmd := exec.Command(cmd_args[0], cmd_args[1:]...)
							 | 
						||
| 
								 | 
							
								    stdout, err := cmd.CombinedOutput()
							 | 
						||
| 
								 | 
							
								    if err != nil {
							 | 
						||
| 
								 | 
							
								        log.Log().Debug().Msg(string(stdout))
							 | 
						||
| 
								 | 
							
								        return "", errors.New(string(stdout))
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    return string(stdout), nil
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								
							 |