2016-12-20 16:43:52 +00:00
|
|
|
#!/usr/bin/env python
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
#
|
|
|
|
|
2019-06-24 06:23:29 +00:00
|
|
|
from django.utils import timezone
|
|
|
|
from django.core.cache import cache
|
2017-12-11 09:08:43 +00:00
|
|
|
from django.core.exceptions import ValidationError
|
2019-06-24 06:23:29 +00:00
|
|
|
from django.utils.translation import ugettext_lazy as _
|
|
|
|
|
2017-12-11 09:08:43 +00:00
|
|
|
from common.utils import validate_ssh_private_key
|
|
|
|
|
2016-12-20 16:43:52 +00:00
|
|
|
|
2019-06-24 06:23:29 +00:00
|
|
|
__all__ = [
|
2022-08-17 03:54:18 +00:00
|
|
|
'private_key_validator',
|
2019-06-24 06:23:29 +00:00
|
|
|
]
|
2016-12-20 16:43:52 +00:00
|
|
|
|
|
|
|
|
2017-12-11 09:08:43 +00:00
|
|
|
def private_key_validator(value):
|
|
|
|
if not validate_ssh_private_key(value):
|
|
|
|
raise ValidationError(
|
|
|
|
_('%(value)s is not an even number'),
|
|
|
|
params={'value': value},
|
|
|
|
)
|