Use hostname for report-host instead of ip in ipv6 environments

Bug #2061984 reported by Federico Bosi
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MySQL Router Charm
In Progress
Undecided
Unassigned

Bug Description

Deploying the charm in an ipv6 only environment fails during bootstrap, saying that the report host option is invalid.

Juju logs:
unit-vault-mysql-router-1: 09:35:39 INFO unit.vault-mysql-router/1.juju-log shared-db:103: Invoking reactive handler: reactive/mysql_router_handlers.py:39:bootstrap_mysqlrouter
unit-vault-mysql-router-1: 09:35:39 ERROR unit.vault-mysql-router/1.juju-log shared-db:103: Failed to bootstrap mysqlrouter: Error: Option --report-host has an invalid value.

The official docs state "Before 8.0.23, validation checked the hostname string for illegal characters where only alphanumeric, '-', '.', and '_' characters were allowed. For example, this meant that IPv6 addresses were not allowed."

Though I don't see this behavior:

ubuntu@giving-seal:~$ mysqlrouter --version
MySQL Router Ver 8.0.36-0ubuntu0.22.04.1 for Linux on x86_64 ((Ubuntu))
ubuntu@giving-seal:~$ mysqlrouter --report-host my-prefix:142:0:1:20
Error: Option --report-host has an invalid value.
ubuntu@giving-seal:~$ mysqlrouter --report-host "my-prefix:142:0:1:20"
Error: Option --report-host has an invalid value.
ubuntu@giving-seal:~$ mysqlrouter --report-host "[my-prefix:142:0:1:20]"
Error: Option --report-host has an invalid value.
ubuntu@giving-seal:~$ mysqlrouter --report-host [my-prefix:142:0:1:20]
Error: Option --report-host has an invalid value.

I'll eventually submit a bug to mysql devs, meanwhile I fixed this by using charmhelpers get_hostname which in my MAAS environment successfully returns a valid hostname and the router is able to bootstrap.
I thought it could be a good idea to check the version and use the hostname if it's <8.0.23, but since it seems broken also on >8.0.23 maybe we can put a warning that deploying "will" fail in case we can't find a valid hostname?

Federico Bosi (rhxto)
description: updated
description: updated
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to charm-mysql-router (master)
Changed in charm-mysql-router:
status: New → In Progress
Federico Bosi (rhxto)
description: updated
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.