Skip to content

Commit 6fc4933

Browse files
author
Josh VanDeraa
committed
Adds based on updates
1 parent 40e6eaf commit 6fc4933

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

netbox_onboarding/onboard.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,9 @@ def check_ip(self):
220220
# An AddrFormatError exception means that there is not an IP address in the field, and should continue on
221221
except AddrFormatError:
222222
pass
223+
# Catch when someone has put in a prefix address
224+
except ValueError:
225+
pass
223226

224227
# An IP address was not detected in the IP address field, attempt to find DNS
225228
try:

netbox_onboarding/tests/test_onboard.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,6 @@ def test_check_ip(self, mock_get_hostbyname):
205205
self.assertTrue(ndk4.check_ip())
206206

207207
# Run the check to change the IP address
208-
ndk4.check_ip()
209208
self.assertEqual(ndk4.ot.ip_address, "192.0.2.1")
210209

211210
@mock.patch("netbox_onboarding.onboard.socket.gethostbyname")
@@ -216,3 +215,4 @@ def test_failed_check_ip(self, mock_get_hostbyname):
216215
ndk5 = NetdevKeeper(self.onboarding_task5)
217216

218217
self.assertFalse(ndk5.check_ip())
218+
self.assertEqual(ndk5.ot.ip_address, "bad.local")

0 commit comments

Comments
 (0)