Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
hirenko-v committed Sep 26, 2024
1 parent 755fea4 commit 0c5f635
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions cmd/job/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,9 @@ func (e *MsgExecutor) Execute(ctx context.Context, in executor.ExecuteInput) (ex
case "run":
fields := strings.Fields(value)
args := fields[2:]
// runCmd := fmt.Sprintf("kubectl get cronjob %s -n %s -ojson", fields[0], fields[1])
// out, _ := plugin.ExecuteCommand(ctx, runCmd, plugin.ExecuteCommandEnvs(envs))
// var cronJobJson map[string]interface{}
runCmd := fmt.Sprintf("kubectl get cronjob %s -n %s -ojson", fields[0], fields[1])
out, _ := plugin.ExecuteCommand(ctx, runCmd, plugin.ExecuteCommandEnvs(envs))
// var cronJobJson map[string]interface{}
// json.Unmarshal([]byte(out.Stdout), &cronJobJson)
// cronJobJson["spec"].(map[string]interface{})["template"].(map[string]interface{})["spec"].(map[string]interface{})["containers"].([]interface{})[0].(map[string]interface{})["args"] = args
// // Prepare the patch JSON
Expand All @@ -157,10 +157,10 @@ func (e *MsgExecutor) Execute(ctx context.Context, in executor.ExecuteInput) (ex
// }

// // Save the patched JSON to a file
// err = os.WriteFile("/tmp/patched_cronjob.json", patchData, 0644) // Create or overwrite the file
// if err != nil {
// log.Fatalf("error writing patched JSON to file: %w", err)
// }
err = os.WriteFile("/tmp/patched_cronjob.json", []byte(out.Stdout), 0644) // Create or overwrite the file
if err != nil {
log.Fatalf("error writing patched JSON to file: %w", err)
}
return executor.ExecuteOutput{
Message: api.NewCodeBlockMessage(fmt.Sprintf("saved, %s",args), true),
}, nil
Expand Down

0 comments on commit 0c5f635

Please sign in to comment.