-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add hints for failing conditions (#172)
* Add hints for failing conditions * Add check-wide hints * Add hint documentation * Update hints.md * add correct hint photo * Fix checkOr/checkAnd to take list of conditions * Better hint example text --------- Co-authored-by: Mobmaker <45888585+Mobmaker55@users.noreply.github.com>
- Loading branch information
1 parent
62ffc8c
commit 352572a
Showing
13 changed files
with
201 additions
and
89 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
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 |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# Check conditions and precedence | ||
|
||
Using multiple conditions for a check can be confusing at first, but can greatly improve the quality of your images by accounting for edge cases and abuse. | ||
|
||
Given no conditions, a check does not pass. | ||
|
||
If any **Fail** conditions succeed, the check does not pass. | ||
|
||
**PassOverride** conditions act as a logical OR. This means that any can succeed for the check to pass. | ||
|
||
**Pass** conditions act as a logical AND with other pass conditions. This means they must ALL be true for a check to pass. | ||
|
||
If the outcome of a check is decided, aeacus will NOT execute the remaining conditions (it will "short circuit"). For example, if a PassOverride succeeds, any Pass conditions are NOT executed. | ||
|
||
So, it's like this: `check_passes = (NOT fails) AND (passoverride OR (AND of all pass checks))`. | ||
|
||
For example: | ||
|
||
``` | ||
[[check]] | ||
# Ensure the scheduled task service is running AND | ||
[[check.fail]] | ||
type = 'ServiceUpNot' | ||
name = 'Schedule' | ||
# Pass if the user runnning those tasks is deleted | ||
[[check.passoverride]] | ||
type = 'UserExistsNot' | ||
name = 'CleanupBot' | ||
# OR pass if both scheduled tasks are deleted | ||
[[check.pass]] | ||
type = 'ScheduledTaskExistsNot' | ||
name = 'Disk Cleanup' | ||
[[check.pass]] | ||
type = 'ScheduledTaskExistsNot' | ||
name = 'Disk Cleanup Backup' | ||
``` | ||
|
||
The evaluation of checks goes like this: | ||
1. Check if any Fail are true. If any Fail checks succeed, then we're done, the check doesn't pass. | ||
2. Check if any PassOverride conditions pass. If they do, we're done, the check passes. | ||
3. Check status of all Pass conditions. If they all succeed, the check passes, otherwise it fails. |
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 |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# Hints | ||
|
||
Hints let you provide information on failing checks. | ||
|
||
![Hint Example](../misc/gh/hint.png) | ||
|
||
Hints are a way to help make images more approachable. | ||
|
||
You can add a conditional hint or a check-wide hint. A conditional hint is printed when that specific condition is executed and fails. Make sure you understand the check precedence; this can be tricky, as sometimes your check is NOT executed ([read about conditions](conditions.md)). | ||
|
||
Example conditional hint: | ||
``` | ||
[[check]] | ||
points = 5 | ||
[[check.pass]] | ||
type = "ProgramInstalledNot" | ||
name = "john" | ||
[[check.pass]] | ||
# This hint will NOT print unless the condition above succeeds. | ||
# Pass conditions are logically AND-- they all need to succeed. | ||
# If one fails, there's no reason to execute the other ones. | ||
hint = "Ensure you're using a package manager to remove all of a tool's files, as well as the main program." | ||
type = "PathExistsNot" | ||
path = "/usr/share/john" | ||
``` | ||
|
||
Check-wide hints are at the top level and always displayed if a check fails. Example check-wide hint: | ||
|
||
``` | ||
[[check]] | ||
hint = "Are there any 'hacking' tools installed?" | ||
points = 5 | ||
[[check.pass]] | ||
type = "ProgramInstalledNot" | ||
name = "john" | ||
[[check.pass]] | ||
type = "PathExistsNot" | ||
path = "/usr/share/john" | ||
``` | ||
|
||
You can combine check-wide and conditional hints. If the check fails, the check-wide hint is ALWAYS displayed, in addition to any conditional hints triggered. |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Oops, something went wrong.