Make image removal contingent upon image existence, remove iptables output logging
This commit is contained in:
parent
08864049a9
commit
aed7c7c565
@ -154,12 +154,14 @@ func (me *DropletHandler) Spinup(name string) (string, error) {
|
||||
|
||||
// delete the image
|
||||
log.Println("Spinup: Deleting image " + name)
|
||||
if image.ID > -1 {
|
||||
_, err = me.client.Images.Delete(image.ID)
|
||||
if err != nil {
|
||||
log.Println("Spinup: Could not delete image: ", err)
|
||||
} else {
|
||||
log.Println("Spinup: Deleted image " + name)
|
||||
}
|
||||
}
|
||||
|
||||
// get the private IP and return it
|
||||
|
||||
|
@ -19,14 +19,12 @@ func addPortForward(ruleName, gatewayInt, localIp, targetIp, port string) {
|
||||
if err != nil {
|
||||
log.Println("iptables error:", err)
|
||||
}
|
||||
log.Println(cmdOut)
|
||||
|
||||
cmdOut, err = exec.Command("iptables", "-A", "FORWARD", "-p", "tcp", "-d", targetIp, "--dport", port, "-j", "ACCEPT").Output()
|
||||
log.Println("iptables", "-A", "FORWARD", "-p", "tcp", "-d", targetIp, "--dport", port, "-j", "ACCEPT")
|
||||
if err != nil {
|
||||
log.Println("iptables error:", err)
|
||||
}
|
||||
log.Println(cmdOut)
|
||||
}
|
||||
|
||||
func rmPortForward(ruleName string) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user