)]}'
{"nova/utils.py":[{"author":{"_account_id":13404,"name":"Alberto Planas","email":"aplanas@gmail.com","username":"aplanas"},"change_message_id":"98609e2197366f362d8f41fb6aac94ef0db5d110","unresolved":false,"context_lines":[{"line_number":682,"context_line":"       \"\"\""},{"line_number":683,"context_line":""},{"line_number":684,"context_line":"    def truncate_hostname(name):"},{"line_number":685,"context_line":"        if CONF.dhcp_domain !\u003d \u0027\u0027:"},{"line_number":686,"context_line":"            _name \u003d name + \u0027.\u0027 + CONF.dhcp_domain"},{"line_number":687,"context_line":"        else:"},{"line_number":688,"context_line":"            _name \u003d name"}],"source_content_type":"text/x-python","patch_set":1,"id":"3ac371cc_1814e74a","line":685,"updated":"2016-08-18 14:25:31.000000000","message":"`if CONF.dhcp_domain:`","commit_id":"97464dde8496e506a028e677b4e80e01012534ad"},{"author":{"_account_id":12542,"name":"Johannes Grassler","email":"jgr-launchpad@btw23.de","username":"jgrassler"},"change_message_id":"1c4ae479677f76d32630987b19e980b969a02465","unresolved":false,"context_lines":[{"line_number":682,"context_line":"       \"\"\""},{"line_number":683,"context_line":""},{"line_number":684,"context_line":"    def truncate_hostname(name):"},{"line_number":685,"context_line":"        if CONF.dhcp_domain !\u003d \u0027\u0027:"},{"line_number":686,"context_line":"            _name \u003d name + \u0027.\u0027 + CONF.dhcp_domain"},{"line_number":687,"context_line":"        else:"},{"line_number":688,"context_line":"            _name \u003d name"}],"source_content_type":"text/x-python","patch_set":1,"id":"3ac371cc_3b98bd69","line":685,"in_reply_to":"3ac371cc_1814e74a","updated":"2016-08-18 15:59:31.000000000","message":"Done","commit_id":"97464dde8496e506a028e677b4e80e01012534ad"},{"author":{"_account_id":22771,"name":"Christopher Martin","email":"cm876n@att.com","username":"cm876n"},"change_message_id":"75b3910f88b819085376045b5fa23dd4939fd324","unresolved":false,"context_lines":[{"line_number":691,"context_line":"            strip_chars \u003d len(_name) - 63"},{"line_number":692,"context_line":"            LOG.warning(_LW(\"Hostname %(hostname)s is longer than 63, \""},{"line_number":693,"context_line":"                            \"truncate it to %(truncated_name)s\"),"},{"line_number":694,"context_line":"                            {\u0027hostname\u0027: _name, \u0027truncated_name\u0027: _name[-63:]})"},{"line_number":695,"context_line":"        else:"},{"line_number":696,"context_line":"            strip_chars \u003d 0"},{"line_number":697,"context_line":"        return name[strip_chars:]"}],"source_content_type":"text/x-python","patch_set":1,"id":"3ac371cc_c060cdd1","line":694,"updated":"2016-08-17 20:54:23.000000000","message":"This code truncates the front of \"_name\" which is counter-intuitive. Instead we should truncate the end before appending CONF.dhcp_domain. Consider doing this: \n\nLOG.warning(_LW(\"Hostname %(hostname)s is longer than 63, \"\n                 \"truncate it to %(truncated_name)s\"),\n        {\u0027hostname\u0027: name, \u0027truncated_name\u0027: name[:53]})","commit_id":"97464dde8496e506a028e677b4e80e01012534ad"},{"author":{"_account_id":13404,"name":"Alberto Planas","email":"aplanas@gmail.com","username":"aplanas"},"change_message_id":"98609e2197366f362d8f41fb6aac94ef0db5d110","unresolved":false,"context_lines":[{"line_number":694,"context_line":"                            {\u0027hostname\u0027: _name, \u0027truncated_name\u0027: _name[-63:]})"},{"line_number":695,"context_line":"        else:"},{"line_number":696,"context_line":"            strip_chars \u003d 0"},{"line_number":697,"context_line":"        return name[strip_chars:]"},{"line_number":698,"context_line":""},{"line_number":699,"context_line":"    if isinstance(hostname, six.text_type):"},{"line_number":700,"context_line":"        # Remove characters outside the Unicode range U+0000-U+00FF"}],"source_content_type":"text/x-python","patch_set":1,"id":"3ac371cc_1bf501ec","line":697,"updated":"2016-08-18 14:25:31.000000000","message":"You are getting the suffix there, but in the original code is getting the prefix. I think that the original code was right:\n\n```\nname \u003d \u0027long.hostname.something\u0027\nname[5:]   # -\u003e \u0027hostname.something\u0027\nname[:5]   # -\u003e \u0027long.\u0027\n```","commit_id":"97464dde8496e506a028e677b4e80e01012534ad"},{"author":{"_account_id":12542,"name":"Johannes Grassler","email":"jgr-launchpad@btw23.de","username":"jgrassler"},"change_message_id":"1c4ae479677f76d32630987b19e980b969a02465","unresolved":false,"context_lines":[{"line_number":694,"context_line":"                            {\u0027hostname\u0027: _name, \u0027truncated_name\u0027: _name[-63:]})"},{"line_number":695,"context_line":"        else:"},{"line_number":696,"context_line":"            strip_chars \u003d 0"},{"line_number":697,"context_line":"        return name[strip_chars:]"},{"line_number":698,"context_line":""},{"line_number":699,"context_line":"    if isinstance(hostname, six.text_type):"},{"line_number":700,"context_line":"        # Remove characters outside the Unicode range U+0000-U+00FF"}],"source_content_type":"text/x-python","patch_set":1,"id":"3ac371cc_d2334312","line":697,"in_reply_to":"3ac371cc_1bf501ec","updated":"2016-08-18 15:59:31.000000000","message":"Under the assumption that people use a fully qualified domain name for their host names, yes. If the host name is just the rightmost bit, I\u0027d argue that the suffix is more interesting. Consider this host name:\n\n```\nname \u003d \u0027my-application-server-001\u0027\nname[5:] # -\u003e \u0027plication-server-001\u0027\nname[:5] # -\u003e \u0027my-application-serve\u0027\n```\n\nArguably, having `name[5:]` in the machine\u0027s shell prompt is more valuable in this case.\n\nAs stated in my previous comment on this, I\u0027d be ok with changing this back to the original behaviour - the main thing about this patch is taking the domain part into account.\n\nAlso, your comment caused me to revisit the line you added it to and I noticed it\u0027s not printing the actual host name as the function returns it. I fixed this. Thank you :-)","commit_id":"97464dde8496e506a028e677b4e80e01012534ad"}]}
