Skip to content

Commit

Permalink
fix: removes unneeded code
Browse files Browse the repository at this point in the history
  • Loading branch information
faiq committed Sep 6, 2024
1 parent 8dc7fd4 commit 8e564b2
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions cmd/konvoy-image-wrapper/cmd/wrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,6 @@ func (r *Runner) mountFileEnv(envName string, containerPath string) error {
if containerPath == "" {
containerPath = absFilePath
}

r.env[envName] = containerPath
r.addBindVolume(absFilePath, containerPath, "readonly")
return nil
Expand All @@ -305,8 +304,9 @@ func (r *Runner) setHTTPProxyEnv() {
}
}

func (r *Runner) setAnsibleHostKeyChecking() {
func (r *Runner) setAnsibleEnvs() {
r.env["ANSIBLE_HOST_KEY_CHECKING"] = "false"
r.env["ANSIBLE_LOCAL_TEMP"] = containerWorkingDir
}

func (r *Runner) setupSSHAgent() {
Expand Down Expand Up @@ -337,7 +337,6 @@ func (r *Runner) dockerRun(args []string) error {

if runtime.GOOS != windows && r.containerEngine == containerEngineDocker {
cmd.Args = append(cmd.Args, "-u", r.usr.Uid+":"+r.usr.Gid)
r.addBindVolume(r.tempDir, r.homeDir)
}

for _, gid := range r.supplementaryGroupIDs {
Expand Down Expand Up @@ -517,7 +516,10 @@ func (r *Runner) Run(args []string) error {
}
defer func() {
fmt.Println("Removing temporary directory", r.tempDir)
os.RemoveAll(r.tempDir)
err := os.RemoveAll(r.tempDir)
if err != nil {
fmt.Println("error removing directory", err)
}
}()

// Setup the user and group mappings in the container so that uid and
Expand Down Expand Up @@ -560,7 +562,7 @@ func (r *Runner) Run(args []string) error {
return fmt.Errorf("failed to load image %w", err)
}

r.setAnsibleHostKeyChecking()
r.setAnsibleEnvs()
r.setupSSHAgent()
// Run the command in the konvoy docker container.
return r.dockerRun(args)
Expand Down

0 comments on commit 8e564b2

Please sign in to comment.