diff --git a/lib/ohai/plugins/linux/hostnamectl.rb b/lib/ohai/plugins/linux/hostnamectl.rb index 8f16e2467..cfc729264 100644 --- a/lib/ohai/plugins/linux/hostnamectl.rb +++ b/lib/ohai/plugins/linux/hostnamectl.rb @@ -27,6 +27,10 @@ if hostnamectl_path shell_out(hostnamectl_path).stdout.split("\n").each do |line| key, val = line.split(": ", 2) + + # strip visual icons produced by newer versions of systemd + val.gsub!(/ [^[:ascii]]*$/, "") + hostnamectl[key.chomp.lstrip.tr(" ", "_").downcase] = val end end