Sha256: 5c495b4e343efcc78f94dff9e37437f2a77162628ee8fe510edf3b4f74b8e080

Contents?: true

Size: 1.15 KB

Versions: 14

Compression:

Stored size: 1.15 KB

Contents

module Veewee
  module Provider
    module Virtualbox
      module BoxCommand

        def forwarding(name)
          command="#{@vboxcmd} showvminfo --details --machinereadable \"#{self.name}\""
          shell_results=shell_exec("#{command}")
          rules=shell_results.stdout.split(/\n/).grep(/^Forward/)
          result=nil
          rules.each do |rule|
            #Forwarding(0)
            nr=rule.split('=')[0].split('(')[1].split(')')[0].to_i + 1
            #  guestssh,tcp,,2222,,22
            details=rule.split('=')[1].split('"')[1].split(',')
            result = {
              :nr => nr,
              :name => details[0],
              :protocol => details[1],
              :host_ip => details[2],
              :host_port => details[3],
              :guest_ip => details[4],
              :guest_port => details[5]
            }
          end
          return result
        end

        def delete_forwarding(name)
          forward=self.forwarding(name)
          command="#{@vboxcmd} controlvm \"#{self.name}\" natpf#{self.natinterface} delete #{name}"
          shell_results=shell_exec("#{command}")
        end

      end
    end
  end
end

Version data entries

14 entries across 14 versions & 2 rubygems

Version Path
veewee-atlassian-0.3.11 lib/veewee/provider/virtualbox/box/helper/forwarding.rb
veewee-0.3.7 lib/veewee/provider/virtualbox/box/helper/forwarding.rb
veewee-0.3.6 lib/veewee/provider/virtualbox/box/helper/forwarding.rb
veewee-0.3.5 lib/veewee/provider/virtualbox/box/helper/forwarding.rb
veewee-0.3.4 lib/veewee/provider/virtualbox/box/helper/forwarding.rb
veewee-0.3.3 lib/veewee/provider/virtualbox/box/helper/forwarding.rb
veewee-0.3.2 lib/veewee/provider/virtualbox/box/helper/forwarding.rb
veewee-0.3.1 lib/veewee/provider/virtualbox/box/helper/forwarding.rb
veewee-0.3.0.beta2 lib/veewee/provider/virtualbox/box/helper/forwarding.rb
veewee-0.3.0.beta1 lib/veewee/provider/virtualbox/box/helper/forwarding.rb
veewee-0.3.0.alpha9 lib/veewee/provider/virtualbox/box/helper/forwarding.rb
veewee-0.3.0.alpha8 lib/veewee/provider/virtualbox/box/helper/forwarding.rb
veewee-0.3.0.alpha7 lib/veewee/provider/virtualbox/box/helper/forwarding.rb
veewee-0.3.0.alpha6 lib/veewee/provider/virtualbox/box/helper/forwarding.rb