* feat: clean up more jinja default references Signed-off-by: Devin Buhl <devin@buhl.casa> * feat: add additional tls sans force kube-vip on k3s Signed-off-by: Devin Buhl <devin@buhl.casa> --------- Signed-off-by: Devin Buhl <devin@buhl.casa>
28 lines
605 B
Python
28 lines
605 B
Python
import bcrypt
|
|
import netaddr
|
|
|
|
import validation
|
|
|
|
def nthhost(value: str, query: int) -> str:
|
|
value = netaddr.IPNetwork(value)
|
|
try:
|
|
nth = int(query)
|
|
if value.size > nth:
|
|
return str(value[nth])
|
|
except ValueError:
|
|
return False
|
|
return value
|
|
|
|
def encrypt(value: str) -> str:
|
|
return bcrypt.hashpw(value.encode(), bcrypt.gensalt(rounds=10)).decode("ascii")
|
|
|
|
class Loader:
|
|
def __init__(self, data):
|
|
if data.get("skip_tests", False):
|
|
return
|
|
|
|
validation.validate(data)
|
|
|
|
def filters(self):
|
|
return [nthhost, encrypt]
|