예제 #1
0
파일: main.go 프로젝트: tasdomas/juju-nat
func (c *NatOutboundCommand) printNatScripts(pending []natcmd.UnitContainment) {
	for _, uc := range pending {
		fmt.Printf("%s:\n", uc.GatewayMachine.Id)
		natcmd.WriteScriptStart(os.Stdout)
		natcmd.WriteScriptOutbound(os.Stdout, uc)
		fmt.Fprintln(os.Stdout)
	}
}
예제 #2
0
파일: main.go 프로젝트: tasdomas/juju-nat
func (c *NatExposeCommand) printNatScripts() {
	for machineId, fwds := range c.forwards {
		fmt.Printf("%s:\n", machineId)
		natcmd.WriteScriptStart(os.Stdout)
		for _, fwd := range fwds {
			fwd.Write(os.Stdout)
			fmt.Println()
		}
	}
}
예제 #3
0
파일: main.go 프로젝트: tasdomas/juju-nat
func (c *NatOutboundCommand) execNatScripts(pending []natcmd.UnitContainment) {
	for _, uc := range pending {
		var natScript bytes.Buffer
		natcmd.WriteScriptStart(&natScript)
		natcmd.WriteScriptOutbound(&natScript, uc)
		err := c.ExecSsh(uc.GatewayMachine, natScript.String())
		if err != nil {
			log.Println("nat script failed on", uc.GatewayMachine.Id(), ":", err)
		}
	}
}
예제 #4
0
파일: main.go 프로젝트: tasdomas/juju-nat
func (c *NatExposeCommand) execNatScripts() {
	for machineId, fwds := range c.forwards {
		machine, ok := c.MachineMap[machineId]
		if !ok {
			log.Println("machine", machineId, "not found")
			continue
		}
		var natScript bytes.Buffer
		natcmd.WriteScriptStart(&natScript)
		for _, fwd := range fwds {
			fwd.Write(&natScript)
			fmt.Fprintln(&natScript)
		}
		err := c.ExecSsh(machine, natScript.String())
		if err != nil {
			log.Println("nat script failed on", machine.Id(), ":", err)
		}
	}
}