diff --git a/NEWS b/NEWS index 3e465cb56c10fe64462fbfa7c81a371e8cd1c082..79d0631f91ebcc01619b74ef1704106b4073d462 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,7 @@ unreleased (207x-xx-xx) + [os] motd.erb needs to handle case when there is no swap. + [several] change 'crit "stuff"' to 'crit("stuff")' to make Puppet 5 happy. [adamhl] diff --git a/templates/os/motd.erb b/templates/os/motd.erb index 77f8e49b19e3d425c491d1b75b4a4124445156ca..fc9d031388a65f705f463f424f20abbfedca1d3d 100644 --- a/templates/os/motd.erb +++ b/templates/os/motd.erb @@ -33,12 +33,17 @@ end memory = memory.gsub(/\s+/, '') - swap = @swapsize - if swap.match(/\./) - swap = swap.sub(/0+ /, ' ') - swap = swap.sub(/\. /, ' ') + # Not every server has a swap disk + if (@swapsize) then + swap = @swapsize + if swap.match(/\./) + swap = swap.sub(/0+ /, ' ') + swap = swap.sub(/\. /, ' ') + end + swap = swap.gsub(/\s+/, '') + else + swap = 'No' end - swap = swap.gsub(/\s+/, '') -%> <%= host %> - <%= os %>, <%= @architecture %> <%= @processorcount %>-core <%= processor %> (<%= product %>); <%= memory %> RAM, <%= swap %> swap