gluon-core: util: avoid unintended second return value from gsub()
gsub() returns the number of matches as its second return value. This was unintendedly passed through by the util functions trim() and node_id(). It can be presumed that this had no effect in practice, but it can lead to surprising output when passing values to print() for debugging.
This commit is contained in:
parent
daf8a6c18c
commit
0e681d5c37
@ -23,7 +23,7 @@ local function do_filter_prefix(input, output, prefix)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function M.trim(str)
|
function M.trim(str)
|
||||||
return str:gsub("^%s*(.-)%s*$", "%1")
|
return (str:gsub("^%s*(.-)%s*$", "%1"))
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.contains(table, value)
|
function M.contains(table, value)
|
||||||
@ -96,7 +96,7 @@ function M.exec(command)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function M.node_id()
|
function M.node_id()
|
||||||
return string.gsub(sysconfig.primary_mac, ':', '')
|
return (string.gsub(sysconfig.primary_mac, ':', ''))
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.default_hostname()
|
function M.default_hostname()
|
||||||
|
Loading…
Reference in New Issue
Block a user