Relies on DNS to resolve own hostname
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Charm Helpers |
Triaged
|
Medium
|
Unassigned | ||
OpenStack Ceph Charm (Retired) |
Won't Fix
|
Medium
|
Unassigned | ||
OpenStack Cinder Charm |
Triaged
|
Medium
|
Unassigned | ||
OpenStack Neutron Gateway Charm |
Triaged
|
Medium
|
Unassigned | ||
OpenStack Nova Compute Charm |
Triaged
|
Medium
|
Unassigned | ||
ceph (Juju Charms Collection) |
Invalid
|
Medium
|
Unassigned | ||
cinder (Juju Charms Collection) |
Invalid
|
Medium
|
Unassigned | ||
neutron-gateway (Juju Charms Collection) |
Invalid
|
Medium
|
Unassigned | ||
nova-compute (Juju Charms Collection) |
Invalid
|
Medium
|
Unassigned |
Bug Description
In charm/hooks/
@cached
def get_host_
if config(
return get_ipv6_addr()[0]
hostname = hostname or unit_get(
try:
# Test to see if already an IPv4 address
return hostname
except socket.error:
# This may throw an NXDOMAIN exception; in which case
# things are badly broken so just let it kill the hook
answers = dns.resolver.
if answers:
return answers[0].address
Firstly, the dns.resolver.query call strikes me as incredibly silly. What if the other node in not resolvable via DNS, but its name is in /etc/hosts? What if the other node *is* in DNS, but is a CNAME? And, bottom line, why not simply use socket.
Secondly, this currently (as of today) breaks a Ceph deployment. It definitely didn't do so a month ago, so whatever it was that changed in the interim, this is a regression. I don't know if this code path wasn't there earlier, or whether it was just never hit. But it definitely used to work, and no longer does.
Changed in charm-helpers: | |
status: | New → Triaged |
importance: | Undecided → Medium |
Changed in ceph (Juju Charms Collection): | |
status: | New → Triaged |
Changed in cinder (Juju Charms Collection): | |
status: | New → Triaged |
Changed in neutron-gateway (Juju Charms Collection): | |
status: | New → Triaged |
Changed in nova-compute (Juju Charms Collection): | |
status: | New → Triaged |
Changed in ceph (Juju Charms Collection): | |
importance: | Undecided → Medium |
Changed in cinder (Juju Charms Collection): | |
importance: | Undecided → Medium |
Changed in nova-compute (Juju Charms Collection): | |
importance: | Undecided → Medium |
Changed in neutron-gateway (Juju Charms Collection): | |
importance: | Undecided → Medium |
Changed in charm-nova-compute: | |
importance: | Undecided → Medium |
status: | New → Triaged |
Changed in nova-compute (Juju Charms Collection): | |
status: | Triaged → Invalid |
Changed in charm-ceph: | |
importance: | Undecided → Medium |
status: | New → Triaged |
Changed in ceph (Juju Charms Collection): | |
status: | Triaged → Invalid |
Changed in charm-cinder: | |
importance: | Undecided → Medium |
status: | New → Triaged |
Changed in cinder (Juju Charms Collection): | |
status: | Triaged → Invalid |
Changed in charm-neutron-gateway: | |
importance: | Undecided → Medium |
status: | New → Triaged |
Changed in neutron-gateway (Juju Charms Collection): | |
status: | Triaged → Invalid |
So, this works just fine:
@cached ip(hostname= None): 'prefer- ipv6'):
def get_host_
if config(
return get_ipv6_addr()[0]
hostname = hostname or unit_get( 'private- address' )
socket. inet_aton( hostname) gethostbyname( hostname)
try:
# Test to see if already an IPv4 address
return hostname
except socket.error:
return socket.