Skip to content

Commit

Permalink
remove default value in internal method
Browse files Browse the repository at this point in the history
  • Loading branch information
narrieta committed Nov 8, 2023
1 parent c2ab99b commit 07548d9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions azurelinuxagent/common/protocol/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ def _clear_wireserver_endpoint(self):
return
logger.error("Failed to clear wiresever endpoint: {0}", e)

def _detect_protocol(self, init_goal_state=True, save_to_history=False):
def _detect_protocol(self, save_to_history, init_goal_state=True):
"""
Probe protocol endpoints in turn.
"""
Expand Down Expand Up @@ -296,7 +296,7 @@ def get_protocol(self, init_goal_state=True, save_to_history=False):

logger.info("Detect protocol endpoint")

protocol = self._detect_protocol(init_goal_state=init_goal_state, save_to_history=save_to_history)
protocol = self._detect_protocol(save_to_history=save_to_history, init_goal_state=init_goal_state)

IOErrorCounter.set_protocol_endpoint(endpoint=protocol.get_endpoint())
self._save_protocol(WIRE_PROTOCOL_NAME)
Expand Down
4 changes: 2 additions & 2 deletions tests/common/protocol/test_protocol_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,14 @@ def test_detect_protocol_no_dhcp(self, WireProtocol, mock_get_lib_dir, _):
endpoint_file = protocol_util._get_wireserver_endpoint_file_path() # pylint: disable=unused-variable

# Test wire protocol when no endpoint file has been written
protocol_util._detect_protocol()
protocol_util._detect_protocol(save_to_history=False)
self.assertEqual(KNOWN_WIRESERVER_IP, protocol_util.get_wireserver_endpoint())

# Test wire protocol on dhcp failure
protocol_util.osutil.is_dhcp_available.return_value = True
protocol_util.dhcp_handler.run.side_effect = DhcpError()

self.assertRaises(ProtocolError, protocol_util._detect_protocol)
self.assertRaises(ProtocolError, lambda: protocol_util._detect_protocol(save_to_history=False))

@patch("azurelinuxagent.common.protocol.util.WireProtocol")
def test_get_protocol(self, WireProtocol, _):
Expand Down

0 comments on commit 07548d9

Please sign in to comment.