This is a giant refactor to move functions into a hierarchial module layout. While this isn't entirely implemented yet, it should work correctly once all the import bits have landed. What's broken at the moment is the template function, which currently doesn't understand the period separator.
18 lines
557 B
Plaintext
18 lines
557 B
Plaintext
import "datetime"
|
|
import "sys"
|
|
|
|
$secplusone = datetime.now() + $ayear
|
|
|
|
# note the order of the assignment (year can come later in the code)
|
|
$ayear = 60 * 60 * 24 * 365 # is a year in seconds (31536000)
|
|
|
|
$tmplvalues = struct{year => $secplusone, load => $theload, vumeter => $vumeter,}
|
|
|
|
$theload = structlookup(sys.load(), "x1")
|
|
|
|
$vumeter = vumeter("====", 10, 0.9)
|
|
|
|
file "/tmp/mgmt/datetime" {
|
|
content => template("Now + 1 year is: {{ .year }} seconds, aka: {{ datetime_print .year }}\n\nload average: {{ .load }}\n\nvu: {{ .vumeter }}\n", $tmplvalues),
|
|
}
|