Skip to content

Commit

Permalink
Merge pull request #125 from subutai-io/fix
Browse files Browse the repository at this point in the history
added validator ip address #119
  • Loading branch information
jadilet authored Oct 1, 2018
2 parents f12a86a + f35804a commit 7f9c0d4
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/vagrant-subutai/registration.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
require_relative '../vagrant-subutai'

require 'ipaddr'

module VagrantSubutai
class Registration < Vagrant.plugin(2, :provisioner)
Expand Down Expand Up @@ -70,7 +70,7 @@ def provision
exit
end

SubutaiConfig.put(:_IP_HYPERV, ip, true)
SubutaiConfig.put(:_IP_HYPERV, ip, true) if is_ip?(ip)
end
end

Expand All @@ -79,5 +79,9 @@ def provision
# to be cleaned up.
def cleanup
end

def is_ip?(ip)
!!IPAddr.new(ip) rescue false
end
end
end

0 comments on commit 7f9c0d4

Please sign in to comment.