|
|
@ -226,20 +226,20 @@ class IscsiInterface(object):
|
|
|
|
self.module.fail_json(msg="The provided mtu is invalid, it must be > 1500 and < 9000 bytes.")
|
|
|
|
self.module.fail_json(msg="The provided mtu is invalid, it must be > 1500 and < 9000 bytes.")
|
|
|
|
|
|
|
|
|
|
|
|
if self.config_method == 'dhcp' and any([self.address, self.subnet_mask, self.gateway]):
|
|
|
|
if self.config_method == 'dhcp' and any([self.address, self.subnet_mask, self.gateway]):
|
|
|
|
self.module.fail_json(
|
|
|
|
self.module.fail_json(msg='A config_method of dhcp is mutually exclusive with the address,'
|
|
|
|
'A config_method of dhcp is mutually exclusive with the address, subnet_mask, and gateway options.')
|
|
|
|
' subnet_mask, and gateway options.')
|
|
|
|
|
|
|
|
|
|
|
|
# A relatively primitive regex to validate that the input is formatted like a valid ip address
|
|
|
|
# A relatively primitive regex to validate that the input is formatted like a valid ip address
|
|
|
|
address_regex = re.compile(r'\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}')
|
|
|
|
address_regex = re.compile(r'\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}')
|
|
|
|
|
|
|
|
|
|
|
|
if self.address and not address_regex.match(self.address):
|
|
|
|
if self.address and not address_regex.match(self.address):
|
|
|
|
self.module.fail_json("An invalid ip address was provided for address.")
|
|
|
|
self.module.fail_json(msg="An invalid ip address was provided for address.")
|
|
|
|
|
|
|
|
|
|
|
|
if self.subnet_mask and not address_regex.match(self.subnet_mask):
|
|
|
|
if self.subnet_mask and not address_regex.match(self.subnet_mask):
|
|
|
|
self.module.fail_json("An invalid ip address was provided for subnet_mask.")
|
|
|
|
self.module.fail_json(msg="An invalid ip address was provided for subnet_mask.")
|
|
|
|
|
|
|
|
|
|
|
|
if self.gateway and not address_regex.match(self.gateway):
|
|
|
|
if self.gateway and not address_regex.match(self.gateway):
|
|
|
|
self.module.fail_json("An invalid ip address was provided for gateway.")
|
|
|
|
self.module.fail_json(msg="An invalid ip address was provided for gateway.")
|
|
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
@property
|
|
|
|
def interfaces(self):
|
|
|
|
def interfaces(self):
|
|
|
|