Skip to content

Commit 6515441

Browse files
committed
Issues:
Fixes #492 Problem: Inheriting from the Resource class overrides the inheritence for the load method in UnnamedResourceMixin The result is that when using the ntp endpoint and loading the information, an exception is raised. Analysis: The change corrects the order of inheritence Tests: na
1 parent 6d14bf7 commit 6515441

2 files changed

Lines changed: 13 additions & 12 deletions

File tree

f5/bigip/tm/sys/ntp.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,10 @@
3030
from f5.bigip.mixins import UnnamedResourceMixin
3131
from f5.bigip.resource import Collection
3232
from f5.bigip.resource import Resource
33+
from f5.bigip.resource import ResourceBase
3334

3435

35-
class Ntp(UnnamedResourceMixin, Resource):
36+
class Ntp(UnnamedResourceMixin, ResourceBase):
3637
"""BIG-IP® system NTP unnamed resource
3738
3839
.. note::
@@ -47,6 +48,7 @@ def __init__(self, sys):
4748
self._meta_data['attribute_registry'] = {
4849
'tm:sys:ntp:restrict:restrictcollectionstate': Restricts
4950
}
51+
self._meta_data['allowed_lazy_attributes'] = [Restricts]
5052

5153

5254
class Restricts(Collection):

test/functional/tm/sys/test_ntp.py

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,29 +14,28 @@
1414
#
1515

1616

17-
def setup_ntp_test(request, bigip):
17+
def setup_ntp_test(request, mgmt_root):
1818
def teardown():
19-
n.servers = servers
19+
n.servers = []
2020
n.update()
2121
request.addfinalizer(teardown)
22-
n = bigip.sys.ntp.load()
23-
servers = n.servers
24-
return n, servers
22+
n = mgmt_root.tm.sys.ntp.load()
23+
return n
2524

2625

27-
class iTestGlobal_Setting(object):
28-
def itest_RUL(self, request, bigip):
26+
class TestGlobal_Setting(object):
27+
def test_RUL(self, request, mgmt_root):
2928
# Load
3029
ip = '192.168.1.1'
31-
ntp1, orig_servers = setup_ntp_test(request, bigip)
32-
ntp2 = bigip.sys.ntp.load()
33-
assert len(ntp1.servers) == len(ntp2.servers)
30+
ntp1 = setup_ntp_test(request, mgmt_root)
31+
ntp2 = mgmt_root.tm.sys.ntp.load()
3432

3533
# Update
3634
ntp1.servers = [ip]
3735
ntp1.update()
36+
3837
assert ip in ntp1.servers
39-
assert ip not in ntp2.servers
38+
assert not hasattr(ntp2, 'servers')
4039

4140
# Refresh
4241
ntp2.refresh()

0 commit comments

Comments
 (0)