Skip to content
This repository has been archived by the owner on Jun 29, 2022. It is now read-only.

Commit

Permalink
properly catch CIDR format input as an error. Closes #239.
Browse files Browse the repository at this point in the history
  • Loading branch information
chambridge committed Aug 30, 2017
1 parent 7e21ba3 commit 41b2e17
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 1 addition & 4 deletions rho/utilities.py
Expand Up @@ -239,10 +239,7 @@ def check_range_validity(range_list):
'[0-9]*.[0-9]*.\[[0-9]*:[0-9]*\].\[[0-9]*:[0-9]*\]',
'[a-zA-Z0-9-\.]+',
'[a-zA-Z0-9-\.]*\[[0-9]*:[0-9]*\]*[a-zA-Z0-9-\.]*',
'[a-zA-Z0-9-\.]*\[[a-zA-Z]*:[a-zA-Z]*\][a-zA-Z0-9-\.]*',
'^(([0-9]|[1-9][0-9]|1[0-9]'
'{2}|2[0-4][0-9]|25[0-5])\.)'
'{3}']
'[a-zA-Z0-9-\.]*\[[a-zA-Z]*:[a-zA-Z]*\][a-zA-Z0-9-\.]*']

for reg_item in range_list:
match = False
Expand Down
5 changes: 5 additions & 0 deletions test/test_utilities.py
Expand Up @@ -95,3 +95,8 @@ def testcheck_range_validity_error(self):
'my-rhel[a:400].company.com']
with self.assertRaises(SystemExit):
utilities.check_range_validity(valid_range_list)

def testcheck_range_cidr_error(self):
valid_range_list = ['192.168.124.0/25']
with self.assertRaises(SystemExit):
utilities.check_range_validity(valid_range_list)

0 comments on commit 41b2e17

Please sign in to comment.