Fixes #7038: No error when hostgroup name exceeds 245 characters

This PR replaces https://github.com/theforeman/foreman/pull/1686
sorry, should pass now