Skip to content

Commit

Permalink
Members modify() broken when setting session attribute
Browse files Browse the repository at this point in the history
Issues:
Fixes F5Networks#1137

Problem: Member modify incorrectly checks value of 'state' attribute
when user passes 'session' attribute to modify.

Analysis: patch['state'] is not correct. should be patch['session']

Tests: Added new test, test_session_modify(), to match existing test
test_state_modify().
  • Loading branch information
jlongstaf committed May 23, 2017
1 parent c69eed9 commit c9e632d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion f5/bigip/tm/ltm/pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ def _modify(self, **patch):
"'user-down'" % patch['state']
raise MemberStateModifyUnsupported(msg)
if 'session' in patch:
if patch['session'] != 'user-enabled' and patch['state'] != \
if patch['session'] != 'user-enabled' and patch['session'] != \
'user-disabled':
msg = "The members resource does not support a modify with " \
"the value of the 'session' attribute as %s. " \
Expand Down
10 changes: 10 additions & 0 deletions f5/bigip/tm/ltm/test/functional/test_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,16 @@ def test_update_session_state_kwargs(self, request, bigip):
m2.session = m1.session
m2.state = m1.state

def test_session_modify(self, request, bigip):
m1, pool = setup_member_test(request, bigip, 'membertestpool1',
'Common')
assert m1.session == 'user-enabled'
m1.modify(session='user-disabled')
m2 = pool.members_s.members.load(
name='192.168.15.15:80', partition='Common')
assert m2.session == 'user-disabled'
assert m1.session == m2.session

def test_state_modify(self, request, bigip):
m1, pool = setup_member_test(request, bigip, 'membertestpool1',
'Common')
Expand Down

0 comments on commit c9e632d

Please sign in to comment.