Don't modify AR record attributes in-place during normalisation
Rails 5 now prefers to call #freeze on any string passed in as an attribute during validation, but this means attributes must not be edited in-place with gsub! and similar methods. Some of the pre-validation methods used to normalise hostnames, OS names etc will attempt to modify attributes in-place with gsub!, e.g.
HostsControllerTest::Fog.mock!#test_0001_#process_hostgroup changes compute attributes:
RuntimeError: can't modify frozen String
Prefer instead to retrieve and set the attribute through the regular attribute setter API (
resource.foo = resource.foo.gsub(..)).
https://github.com/rails/rails/issues/24185 and related tickets have more info.