mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Add hostname sanitiser
This commit is contained in:
parent
3ae086aff4
commit
f2571fc8bf
1 changed files with 9 additions and 0 deletions
|
@ -45,6 +45,15 @@ class InputSanitizer(object):
|
|||
'''
|
||||
return re.sub('[^a-zA-Z0-9.-_ ]', '', os.path.basename(InputSanitizer.trim(value)))
|
||||
|
||||
@staticmethod
|
||||
def hostname(value):
|
||||
'''
|
||||
Clean value for RFC1123.
|
||||
|
||||
:param value:
|
||||
:return:
|
||||
'''
|
||||
return re.sub(r'[^a-zA-Z0-9.-]', '', InputSanitizer.trim(value))
|
||||
|
||||
|
||||
clean = InputSanitizer()
|
||||
|
|
Loading…
Add table
Reference in a new issue