Skip to content

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
advornic committed Jan 13, 2015
1 parent 98cd825 commit fa52ebc
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions ztpserver/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,15 +244,23 @@ def validate_node(self):
if not self.data:
return

if not self.data.get('node', None):
node = self.data.get('node', None)
if not node:
return
else:
if isinstance(node, int):
node = str(node)

if not isinstance(node, str):
raise ValidationError('invalid value for \'node\' (%s)' %
str(node))

# if system MAC is used
if runtime.default.identifier == 'systemmac':
node = str(self.data['node']).replace(':', '').replace('.', '')
node = node.replace(':', '').replace('.', '')
if re.search(ANTINODE_PATTERN, node):
raise ValidationError('invalid value for \'node\' (%s)' %
self.data['node'])
node)

def validate_variables(self):
if not self.data:
Expand Down

0 comments on commit fa52ebc

Please sign in to comment.