diff options
Diffstat (limited to 'classes/sota_sanity.bbclass')
-rw-r--r-- | classes/sota_sanity.bbclass | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/classes/sota_sanity.bbclass b/classes/sota_sanity.bbclass index 74973eb..02ca2e7 100644 --- a/classes/sota_sanity.bbclass +++ b/classes/sota_sanity.bbclass | |||
@@ -1,5 +1,12 @@ | |||
1 | # Sanity check the sota setup for common misconfigurations | 1 | # Sanity check the sota setup for common misconfigurations |
2 | 2 | ||
3 | def sota_check_boolean_variable(var, d): | ||
4 | try: | ||
5 | oe.types.boolean(d.getVar(var)) | ||
6 | except: | ||
7 | return False | ||
8 | return True | ||
9 | |||
3 | def sota_check_overrides(status, d): | 10 | def sota_check_overrides(status, d): |
4 | for var in (d.getVar('SOTA_OVERRIDES_BLACKLIST') or "").split(): | 11 | for var in (d.getVar('SOTA_OVERRIDES_BLACKLIST') or "").split(): |
5 | if var in d.getVar('OVERRIDES').split(':'): | 12 | if var in d.getVar('OVERRIDES').split(':'): |
@@ -47,14 +54,14 @@ def sota_check_variables_validity(status, d): | |||
47 | path = os.path.abspath(credentials) | 54 | path = os.path.abspath(credentials) |
48 | if not os.path.exists(path): | 55 | if not os.path.exists(path): |
49 | status.addresult("SOTA_PACKED_CREDENTIALS is not set correctly. The zipped credentials file does not exist.\n") | 56 | status.addresult("SOTA_PACKED_CREDENTIALS is not set correctly. The zipped credentials file does not exist.\n") |
50 | if d.getVar("OSTREE_UPDATE_SUMMARY") and d.getVar("OSTREE_UPDATE_SUMMARY") not in ("0", "1", ""): | 57 | if not sota_check_boolean_variable("OSTREE_UPDATE_SUMMARY", d): |
51 | status.addresult("OSTREE_UPDATE_SUMMARY should be set to 0 or 1.\n") | 58 | status.addresult("OSTREE_UPDATE_SUMMARY (=%s) should be set to yes/y/true/t/1 or no/n/false/f/0.\n" % d.getVar("OSTREE_UPDATE_SUMMARY")) |
52 | if d.getVar("OSTREE_DEPLOY_DEVICETREE") and d.getVar("OSTREE_DEPLOY_DEVICETREE") not in ("0", "1", ""): | 59 | if not sota_check_boolean_variable("OSTREE_DEPLOY_DEVICETREE", d): |
53 | status.addresult("OSTREE_DEPLOY_DEVICETREE should be set to 0 or 1.\n") | 60 | status.addresult("OSTREE_DEPLOY_DEVICETREE (=%s) should be set to yes/y/true/t/1 or no/n/false/f/0.\n" % d.getVar("OSTREE_DEPLOY_DEVICETREE")) |
54 | if d.getVar("GARAGE_SIGN_AUTOVERSION") and d.getVar("GARAGE_SIGN_AUTOVERSION") not in ("0", "1", ""): | 61 | if not sota_check_boolean_variable("GARAGE_SIGN_AUTOVERSION", d): |
55 | status.addresult("GARAGE_SIGN_AUTOVERSION should be set to 0 or 1.\n") | 62 | status.addresult("GARAGE_SIGN_AUTOVERSION (=%s) should be set to yes/y/true/t/1 or no/n/false/f/0.\n" % d.getVar("GARAGE_SIGN_AUTOVERSION")) |
56 | if d.getVar("SOTA_DEPLOY_CREDENTIALS") and d.getVar("SOTA_DEPLOY_CREDENTIALS") not in ("0", "1", ""): | 63 | if not sota_check_boolean_variable("SOTA_DEPLOY_CREDENTIALS", d): |
57 | status.addresult("SOTA_DEPLOY_CREDENTIALS should be set to 0 or 1.\n") | 64 | status.addresult("SOTA_DEPLOY_CREDENTIALS (=%s) should be set to yes/y/true/t/1 or no/n/false/f/0.\n" % d.getVar("SOTA_DEPLOY_CREDENTIALS")) |
58 | 65 | ||
59 | def sota_raise_sanity_error(msg, d): | 66 | def sota_raise_sanity_error(msg, d): |
60 | if d.getVar("SANITY_USE_EVENTS") == "1": | 67 | if d.getVar("SANITY_USE_EVENTS") == "1": |