Sha256: 337abff7024287d4bea304aadd1e0fb075f6db4fffb0059df67304eb06da1302

Contents?: true

Size: 1.59 KB

Versions: 26

Compression:

Stored size: 1.59 KB

Contents

module Veewee
  module Provider
    module Vmfusion
      module BoxCommand

        def vnc_port
           lines=File.readlines(vmx_file_path)
           matches=lines.grep(/^RemoteDisplay.vnc.port/)
           if matches.length==0
              raise Veewee::Error,"No VNC port found, maybe it is not enabled?"
           else
              value=matches.first.split("\"")[1].to_i
              return value
           end
        end

        # This tries to guess a port for the VNC Display
        def guess_vnc_port
          min_port=5920
          max_port=6000
          guessed_port=nil

          for port in (min_port..max_port)
            unless is_tcp_port_open?("127.0.0.1", port)
              guessed_port=port
              break
            end
          end

          if guessed_port.nil?
            env.ui.info "No free VNC port available: tried #{min_port}..#{max_port}"
            raise Veewee::Error, "No free VNC port available: tried #{min_port}..#{max_port}"
          else
            env.ui.info "Found VNC port #{guessed_port} available"
          end

          return guessed_port
        end

        def vnc_display_port
          self.vnc_port - 5900
        end

        def vnc_enabled?
           lines=File.readlines(vmx_file_path)
           matches=lines.grep(/^RemoteDisplay.vnc.enabled/)
           if matches.length==0
              return false
           else
              if matches.first.split("\"")[1].downcase == 'true'
                return true
              else
                return false
              end
           end
        end

      end
    end
  end
end

Version data entries

26 entries across 26 versions & 2 rubygems

Version Path
veewee-0.5.0.alpha4 lib/veewee/provider/vmfusion/box/helper/vnc.rb
veewee-0.5.0.alpha3 lib/veewee/provider/vmfusion/box/helper/vnc.rb
veewee-0.5.0.alpha2 lib/veewee/provider/vmfusion/box/helper/vnc.rb
veewee-0.5.0.alpha1 lib/veewee/provider/vmfusion/box/helper/vnc.rb
veewee-0.4.5.1 lib/veewee/provider/vmfusion/box/helper/vnc.rb
veewee-0.4.5 lib/veewee/provider/vmfusion/box/helper/vnc.rb
veewee-0.4.5.pre1 lib/veewee/provider/vmfusion/box/helper/vnc.rb
veewee-0.4.4 lib/veewee/provider/vmfusion/box/helper/vnc.rb
veewee-0.4.3 lib/veewee/provider/vmfusion/box/helper/vnc.rb
veewee-0.4.2 lib/veewee/provider/vmfusion/box/helper/vnc.rb
veewee-0.4.1 lib/veewee/provider/vmfusion/box/helper/vnc.rb
veewee-0.4.0 lib/veewee/provider/vmfusion/box/helper/vnc.rb
veewee-0.3.12 lib/veewee/provider/vmfusion/box/helper/vnc.rb
veewee-0.3.11 lib/veewee/provider/vmfusion/box/helper/vnc.rb
veewee-0.3.10 lib/veewee/provider/vmfusion/box/helper/vnc.rb
veewee-0.3.9 lib/veewee/provider/vmfusion/box/helper/vnc.rb
veewee-atlassian-0.3.11 lib/veewee/provider/vmfusion/box/helper/vnc.rb
veewee-0.3.7 lib/veewee/provider/vmfusion/box/helper/vnc.rb
veewee-0.3.6 lib/veewee/provider/vmfusion/box/helper/vnc.rb
veewee-0.3.5 lib/veewee/provider/vmfusion/box/helper/vnc.rb