661e8c957cc30b0cde19b66bed17296f965dce17
[packages/precise/mcollective.git] / plugins / mcollective / validator / ipv6address_validator.rb
1 module MCollective
2   module Validator
3     class Ipv6addressValidator
4       require 'ipaddr'
5
6       def self.validate(validator)
7         begin
8           ip = IPAddr.new(validator)
9           raise ValidatorError, "value should be an ipv6 adddress" unless ip.ipv6?
10         rescue
11           raise ValidatorError, "value should be an ipv6 address"
12         end
13       end
14     end
15   end
16 end