-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: migrate to python for data validation (#1214)
* feat: migrate to python for data validation Signed-off-by: Devin Buhl <[email protected]> * fix: address PR comments Signed-off-by: Devin Buhl <[email protected]> * fix: add unused kwargs to validate functions Signed-off-by: Devin Buhl <[email protected]> * chore: update renovate pip and ansible regex Signed-off-by: Devin Buhl <[email protected]> * feat: add bootstrap_nodes test Signed-off-by: Devin Buhl <[email protected]> * fix: update taskfiles Signed-off-by: Devin Buhl <[email protected]> --------- Signed-off-by: Devin Buhl <[email protected]>
- Loading branch information
Showing
33 changed files
with
340 additions
and
537 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
--- | ||
ci_test: true | ||
skip_tests: true | ||
|
||
bootstrap_distribution: k0s | ||
bootstrap_github_username: onedr0p | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
--- | ||
ci_test: true | ||
skip_tests: true | ||
|
||
bootstrap_distribution: k3s | ||
bootstrap_github_username: onedr0p | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
--- | ||
ci_test: true | ||
skip_tests: true | ||
|
||
bootstrap_distribution: k3s | ||
bootstrap_github_username: onedr0p | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
--- | ||
ci_test: true | ||
skip_tests: true | ||
|
||
bootstrap_distribution: k3s | ||
bootstrap_github_username: onedr0p | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
--- | ||
ci_test: true | ||
skip_tests: true | ||
|
||
bootstrap_distribution: talos | ||
bootstrap_github_username: onedr0p | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,40 @@ | ||
import netaddr, bcrypt | ||
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_python_version() | ||
validation.validate_cli_tools(data) | ||
validation.validate_distribution(data) | ||
validation.validate_github(data) | ||
validation.validate_age(data) | ||
validation.validate_timezone(data) | ||
validation.validate_acme_email(data) | ||
validation.validate_flux_github_webhook_token(data) | ||
validation.validate_cloudflare(data) | ||
validation.validate_host_network(data) | ||
validation.validate_bootstrap_dns_server(data) | ||
validation.validate_cilium_loadbalancer_mode(data) | ||
validation.validate_local_storage_path(data) | ||
validation.validate_cluster_cidrs(data) | ||
validation.validate_nodes(data) | ||
|
||
def filters(self): | ||
return [nthhost, encrypt] |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.