mirror of
https://gitea.elkins.co/Networking/ccl.git
synced 2025-03-09 04:31:38 -05:00
output formatting
This commit is contained in:
parent
94c29f9d6e
commit
c5917ff102
@ -140,10 +140,10 @@ func (c Command) Execute(output io.Writer, fake bool) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Fprintln(output, c.Type, "sh", "-c", cmd)
|
||||
fmt.Fprintf(output, "%s sh -c \"%s\"\n", c.Type, cmd)
|
||||
if !fake {
|
||||
out, err := exec.Command("sh", "-c", cmd).CombinedOutput()
|
||||
fmt.Fprintln(output, string(out))
|
||||
fmt.Fprint(output, string(out))
|
||||
return err
|
||||
}
|
||||
case CT_REF:
|
||||
|
@ -236,19 +236,19 @@ func (c *Container) initCommands() {
|
||||
command.NewFunc("assure_netns", func() string {
|
||||
netns_b, err := exec.Command("podman", "inspect", "-f", "{{.NetworkSettings.SandboxKey}}", c.Name).CombinedOutput()
|
||||
if err != nil {
|
||||
return fmt.Sprintf("%s is not running\n", c.Name)
|
||||
return fmt.Sprintf("%s is not running", c.Name)
|
||||
}
|
||||
netns := strings.TrimRight(string(netns_b), "\n")
|
||||
err = exec.Command("rm", "-f", "/var/run/netns/"+c.Name).Run()
|
||||
if err != nil {
|
||||
return fmt.Sprintln("Error:", err)
|
||||
return fmt.Sprintf("Error: %s", err)
|
||||
}
|
||||
err = exec.Command("ln", "-sf", netns, "/var/run/netns/"+c.Name).Run()
|
||||
if err != nil {
|
||||
fmt.Fprintln(os.Stderr, "Warning: could not establish network namespace", err)
|
||||
return fmt.Sprintln("Error:", err)
|
||||
return fmt.Sprintf("Error: %s", err)
|
||||
}
|
||||
return ""
|
||||
return fmt.Sprintf("Created /var/run/netns/%s", c.Name)
|
||||
}),
|
||||
}
|
||||
if len(c.Networks) > 0 && !*c.Networks[0].IPv6 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user