Skip to content

Commit cceafcb

Browse files
committed
check_tasksched: add default values of arguments in their descriptions
hidden arg is default false in the script as well fix some other typos/dead code
1 parent 27fab87 commit cceafcb

4 files changed

Lines changed: 12 additions & 10 deletions

File tree

pkg/snclient/check_tasksched.go

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,16 @@ func (l *CheckTasksched) Build() *CheckData {
4242
State: CheckExitOK,
4343
},
4444
args: map[string]CheckArgument{
45-
"timezone": {description: "Sets the timezone for time metrics (default is local time)"},
46-
"title": {value: &l.TaskTitle, description: "Sets the task to check. This corresonds to the title of the scheduled task, called TaskName in Powershell output."},
47-
"folder": {value: &l.Folder, description: "The folder where the scheduled task is saved. This is used for exact matches, unless recurisive option is enabled."},
48-
"recursive": {value: &l.Recursive, description: "Include the subfolders of the specified folder as well when searching for scheduled tasks."},
49-
"hidden": {value: &l.Hidden, description: "Include hidden tasks."},
45+
"timezone": {description: "Sets the timezone for time metrics (default is local time)"},
46+
"title": {value: &l.TaskTitle,
47+
description: fmt.Sprintf("Sets the task to check. This corresonds to the title of the scheduled task. Default: '%s'", CheckTaskschedDefaultTaskTitle)},
48+
"folder": {value: &l.Folder,
49+
description: fmt.Sprintf("The folder where the scheduled task is saved. This is used for exact matches, unless recurisive option is enabled. Default: '%s'",
50+
CheckTaskschedDefaultFolder)},
51+
"recursive": {value: &l.Recursive,
52+
description: fmt.Sprintf("Include the subfolders of the specified folder as well when searching for scheduled tasks. Default: '%t'", CheckTaskschedDefaultRecursive)},
53+
"hidden": {value: &l.Hidden,
54+
description: fmt.Sprintf("Include hidden tasks. Default: '%t'", CheckTaskschedDefaultHidden)},
5055
},
5156
defaultFilter: "enabled = true",
5257
defaultCritical: "exit_code < 0",

pkg/snclient/condition.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -841,7 +841,6 @@ func (c *Condition) expandUnitByType(str string) error {
841841
c.unit = ""
842842

843843
return nil
844-
default:
845844
}
846845

847846
match := reConditionValueUnit.FindStringSubmatch(str)
@@ -887,8 +886,6 @@ func (c *Condition) expandUnitByType(str string) error {
887886
c.unit = "s"
888887

889888
return nil
890-
case UBool:
891-
return nil // handled before the regex check
892889
case UPercent:
893890
return nil
894891
case UNone:

pkg/snclient/embed/scripts/windows/scheduled_tasks.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ if ($args) {
3636
if (!$title) { $title = '*' }
3737
if (!$folder) { $folder = '\' }
3838
if (!$recursive) { $recursive = 'true' }
39-
if (!$hidden) { $hidden = 'true' }
39+
if (!$hidden) { $hidden = 'false' }
4040

4141
# debug the parameters/arguments
4242
[Console]::Error.WriteLine(('title: ' + $title ))

pkg/utils/utils.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ func ParseAndReplaceBoolAttributes(val string) (newVal, oldVal string, err error
133133
})
134134

135135
if foundValues == 0 {
136-
err = fmt.Errorf("ParseAndReplaceBoolAttributes: did not find any truthy or falsely values in boolean attribute value: '%s' , lowercase needs to be one of falsely: '%s' or truthy: '%s' values",
136+
err = fmt.Errorf("ParseAndReplaceBoolAttributes: did not find any truthy or falsey values in boolean attribute value: '%s' , lowercase needs to be one of falsey: '%s' or truthy: '%s' values",
137137
val, strings.Join(falseyValues, " "), strings.Join(truthyValues, " "))
138138
}
139139

0 commit comments

Comments
 (0)