Fixes for bigip monitors and profiles (#34524)

Fixed incorrect parent comparison. Fixed old fqdn_name usage.
Fixed incorrect default parents
This commit is contained in:
Tim Rupp 2018-01-05 15:53:26 -08:00 committed by GitHub
parent 803e4124b6
commit e5d77c7782
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 46 additions and 28 deletions

View file

@ -232,6 +232,11 @@ class Parameters(AnsibleF5Parameters):
# If the mapped value is not a @property
self._values[map_key] = v
def _fqdn_name(self, value):
if value is not None and not value.startswith('/'):
return '/{0}/{1}'.format(self.partition, value)
return value
def to_return(self):
result = {}
try:
@ -316,11 +321,7 @@ class Parameters(AnsibleF5Parameters):
def parent(self):
if self._values['parent'] is None:
return None
if self._values['parent'].startswith('/'):
parent = os.path.basename(self._values['parent'])
result = '/{0}/{1}'.format(self.partition, parent)
else:
result = '/{0}/{1}'.format(self.partition, self._values['parent'])
result = self._fqdn_name(self._values['parent'])
return result
@property
@ -355,7 +356,7 @@ class Difference(object):
@property
def parent(self):
if self.want.parent != self.want.parent:
if self.want.parent != self.have.parent:
raise F5ModuleError(
"The parent monitor cannot be changed"
)
@ -569,7 +570,7 @@ class ArgumentSpec(object):
self.supports_check_mode = True
self.argument_spec = dict(
name=dict(required=True),
parent=dict(default='http'),
parent=dict(default='/Common/http'),
send=dict(),
receive=dict(),
receive_disable=dict(required=False),

View file

@ -221,6 +221,11 @@ class Parameters(AnsibleF5Parameters):
# If the mapped value is not a @property
self._values[map_key] = v
def _fqdn_name(self, value):
if value is not None and not value.startswith('/'):
return '/{0}/{1}'.format(self.partition, value)
return value
def to_return(self):
result = {}
try:
@ -313,11 +318,7 @@ class Parameters(AnsibleF5Parameters):
def parent(self):
if self._values['parent'] is None:
return None
if self._values['parent'].startswith('/'):
parent = os.path.basename(self._values['parent'])
result = '/{0}/{1}'.format(self.partition, parent)
else:
result = '/{0}/{1}'.format(self.partition, self._values['parent'])
result = self._fqdn_name(self._values['parent'])
return result
@property
@ -340,7 +341,7 @@ class Difference(object):
@property
def parent(self):
if self.want.parent != self.want.parent:
if self.want.parent != self.have.parent:
raise F5ModuleError(
"The parent monitor cannot be changed"
)
@ -551,7 +552,7 @@ class ArgumentSpec(object):
self.supports_check_mode = True
self.argument_spec = dict(
name=dict(required=True),
parent=dict(default='https'),
parent=dict(default='/Common/https'),
send=dict(),
receive=dict(),
receive_disable=dict(required=False),

View file

@ -292,6 +292,11 @@ class Parameters(AnsibleF5Parameters):
# If the mapped value is not a @property
self._values[map_key] = v
def _fqdn_name(self, value):
if value is not None and not value.startswith('/'):
return '/{0}/{1}'.format(self.partition, value)
return value
def to_return(self):
result = {}
try:
@ -338,11 +343,7 @@ class Parameters(AnsibleF5Parameters):
def parent(self):
if self._values['parent'] is None:
return None
if self._values['parent'].startswith('/'):
parent = os.path.basename(self._values['parent'])
result = '/{0}/{1}'.format(self.partition, parent)
else:
result = '/{0}/{1}'.format(self.partition, self._values['parent'])
result = self._fqdn_name(self._values['parent'])
return result
@property
@ -406,7 +407,7 @@ class Difference(object):
@property
def parent(self):
if self.want.parent != self.want.parent:
if self.want.parent != self.have.parent:
raise F5ModuleError(
"The parent monitor cannot be changed"
)
@ -622,7 +623,7 @@ class ArgumentSpec(object):
self.argument_spec = dict(
name=dict(required=True),
description=dict(),
parent=dict(),
parent=dict(default='/Common/snmp_dca'),
ip=dict(),
interval=dict(type='int'),
timeout=dict(type='int'),

View file

@ -194,6 +194,11 @@ class Parameters(AnsibleF5Parameters):
# If the mapped value is not a @property
self._values[map_key] = v
def _fqdn_name(self, value):
if value is not None and not value.startswith('/'):
return '/{0}/{1}'.format(self.partition, value)
return value
def to_return(self):
result = {}
try:
@ -289,7 +294,7 @@ class Difference(object):
@property
def parent(self):
if self.want.parent != self.want.parent:
if self.want.parent != self.have.parent:
raise F5ModuleError(
"The parent monitor cannot be changed"
)
@ -486,7 +491,7 @@ class ArgumentSpec(object):
self.supports_check_mode = True
self.argument_spec = dict(
name=dict(required=True),
parent=dict(default='tcp_echo'),
parent=dict(default='/Common/tcp_echo'),
ip=dict(),
interval=dict(type='int'),
timeout=dict(type='int'),

View file

@ -213,6 +213,11 @@ class Parameters(AnsibleF5Parameters):
# If the mapped value is not a @property
self._values[map_key] = v
def _fqdn_name(self, value):
if value is not None and not value.startswith('/'):
return '/{0}/{1}'.format(self.partition, value)
return value
def to_return(self):
result = {}
try:
@ -324,7 +329,7 @@ class Difference(object):
@property
def parent(self):
if self.want.parent != self.want.parent:
if self.want.parent != self.have.parent:
raise F5ModuleError(
"The parent monitor cannot be changed"
)
@ -533,7 +538,7 @@ class ArgumentSpec(object):
self.supports_check_mode = True
self.argument_spec = dict(
name=dict(required=True),
parent=dict(default='tcp_half_open'),
parent=dict(default='/Common/tcp_half_open'),
ip=dict(),
port=dict(type='int'),
interval=dict(type='int'),

View file

@ -214,6 +214,11 @@ class Parameters(AnsibleF5Parameters):
# If the mapped value is not a @property
self._values[map_key] = v
def _fqdn_name(self, value):
if value is not None and not value.startswith('/'):
return '/{0}/{1}'.format(self.partition, value)
return value
def to_return(self):
result = {}
try:
@ -329,7 +334,7 @@ class Difference(object):
@property
def parent(self):
if self.want.parent != self.want.parent:
if self.want.parent != self.have.parent:
raise F5ModuleError(
"The parent monitor cannot be changed"
)
@ -539,7 +544,7 @@ class ArgumentSpec(object):
self.supports_check_mode = True
self.argument_spec = dict(
name=dict(required=True),
parent=dict(default='udp'),
parent=dict(default='/Common/udp'),
send=dict(),
receive=dict(),
receive_disable=dict(required=False),

View file

@ -340,7 +340,7 @@ class Difference(object):
@property
def parent(self):
if self.want.parent != self.want.parent:
if self.want.parent != self.have.parent:
raise F5ModuleError(
"The parent profile cannot be changed"
)