lang: core: sys, engine: resource: Update hostname functionality

We didn't have a solid resource and sys.hostname() didn't have events!
This commit is contained in:
James Shubin
2024-11-06 20:00:54 -05:00
parent 83fd8b7e54
commit 59a20f53eb
4 changed files with 210 additions and 40 deletions

View File

@@ -1,3 +1,4 @@
import "sys"
import "util"
$m = {
@@ -7,6 +8,12 @@ $m = {
"aa:bb:cc:dd:ee:ff" => "hostname2",
}
print "mapper" {
msg => util.hostname_mapper($m),
$h = util.hostname_mapper($m)
print "hostname_mapper" {
msg => $h,
}
if $h != "" and sys.hostname() != $h {
hostname "${h}" {} # set it correctly!
}