lib/veewee/provider/virtualbox/box/helper/forwarding.rb in veewee-0.3.7 vs lib/veewee/provider/virtualbox/box/helper/forwarding.rb in veewee-0.3.9

- old
+ new

@@ -26,10 +26,14 @@ return result end def delete_forwarding(name) forward=self.forwarding(name) - command="#{@vboxcmd} controlvm \"#{self.name}\" natpf#{self.natinterface} delete #{name}" + if self.running? + command="#{@vboxcmd} controlvm \"#{self.name}\" natpf#{self.natinterface} delete \"#{name}\"" + else + command="#{@vboxcmd} modifyvm \"#{self.name}\" --natpf#{self.natinterface} delete \"#{name}\"" + end shell_results=shell_exec("#{command}") end end end