Skip to content

Commit

Permalink
added validator ip address #119
Browse files Browse the repository at this point in the history
  • Loading branch information
jadilet committed Oct 1, 2018
1 parent f12a86a commit f35804a
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 f35804a

Please sign in to comment.