[Bug 1601972] Re: Import failed because apt_install() was assumed to have worked
David Ames
david.ames at canonical.com
Mon Jul 18 17:20:03 UTC 2016
This required a charm-sync and a change to the install hook for most of
the charms.
https://review.openstack.org/#/q/topic:bug/1601972
--
You received this bug notification because you are a member of Ubuntu
OpenStack, which is subscribed to cinder in Juju Charms Collection.
Matching subscriptions: charm-bugs
https://bugs.launchpad.net/bugs/1601972
Title:
Import failed because apt_install() was assumed to have worked
Status in Charm Helpers:
Fix Committed
Status in cinder package in Juju Charms Collection:
In Progress
Bug description:
This code:
def ns_query(address):
try:
import dns.resolver
except ImportError:
apt_install('python-dnspython')
import dns.resolver
Failed like this:
2016-07-09 06:25:01 INFO juju-log Installing python-dnspython with options: ['--option=Dpkg::Options::=--force-confold']
2016-07-09 06:25:01 INFO install E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)
2016-07-09 06:25:01 INFO install E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?
2016-07-09 06:25:01 INFO install Traceback (most recent call last):
2016-07-09 06:25:01 INFO install File "/var/lib/juju/agents/unit-cinder-0/charm/hooks/install.real", line 579, in <module>
2016-07-09 06:25:01 INFO install assess_status(CONFIGS)
2016-07-09 06:25:01 INFO install File "/var/lib/juju/agents/unit-cinder-0/charm/hooks/cinder_utils.py", line 886, in assess_status
2016-07-09 06:25:01 INFO install assess_status_func(configs)()
2016-07-09 06:25:01 INFO install File "/var/lib/juju/agents/unit-cinder-0/charm/hooks/charmhelpers/contrib/openstack/utils.py", line 1530, in _assess_status_func
2016-07-09 06:25:01 INFO install state, message = _determine_os_workload_status(*args, **kwargs)
2016-07-09 06:25:01 INFO install File "/var/lib/juju/agents/unit-cinder-0/charm/hooks/charmhelpers/contrib/openstack/utils.py", line 930, in _determine_os_workload_status
2016-07-09 06:25:01 INFO install configs, required_interfaces)
2016-07-09 06:25:01 INFO install File "/var/lib/juju/agents/unit-cinder-0/charm/hooks/charmhelpers/contrib/openstack/utils.py", line 984, in _ows_check_generic_interfaces
2016-07-09 06:25:01 INFO install required_interfaces)
2016-07-09 06:25:01 INFO install File "/var/lib/juju/agents/unit-cinder-0/charm/hooks/charmhelpers/contrib/openstack/utils.py", line 1265, in incomplete_relation_data
2016-07-09 06:25:01 INFO install complete_ctxts = configs.complete_contexts()
2016-07-09 06:25:01 INFO install File "/var/lib/juju/agents/unit-cinder-0/charm/hooks/charmhelpers/contrib/openstack/templating.py", line 295, in complete_contexts
2016-07-09 06:25:01 INFO install for i in six.itervalues(self.templates)]
2016-07-09 06:25:01 INFO install File "/var/lib/juju/agents/unit-cinder-0/charm/hooks/charmhelpers/contrib/openstack/templating.py", line 120, in complete_contexts
2016-07-09 06:25:01 INFO install self.context()
2016-07-09 06:25:01 INFO install File "/var/lib/juju/agents/unit-cinder-0/charm/hooks/charmhelpers/contrib/openstack/templating.py", line 105, in context
2016-07-09 06:25:01 INFO install _ctxt = context()
2016-07-09 06:25:01 INFO install File "/var/lib/juju/agents/unit-cinder-0/charm/hooks/charmhelpers/contrib/openstack/context.py", line 592, in __call__
2016-07-09 06:25:01 INFO install addr = get_host_ip(unit_get('private-address'))
2016-07-09 06:25:01 INFO install File "/var/lib/juju/agents/unit-cinder-0/charm/hooks/charmhelpers/contrib/network/ip.py", line 443, in get_host_ip
2016-07-09 06:25:01 INFO install ip_addr = ns_query(hostname)
2016-07-09 06:25:01 INFO install File "/var/lib/juju/agents/unit-cinder-0/charm/hooks/charmhelpers/contrib/network/ip.py", line 420, in ns_query
2016-07-09 06:25:01 INFO install import dns.resolver
2016-07-09 06:25:01 INFO install ImportError: No module named dns.resolver
2016-07-09 06:25:01 ERROR juju.worker.uniter.operation runhook.go:107 hook "install" failed: exit status 1
This code structure is used all over the place in
charmhelpers/contrib/network/ip.py. Specificlaly, for python-netifaces
and python-netaddr. And twice for python-dnspython: one like above,
the other in get_hostname() in the same file.
We should either pass fatal=True to *all* apt_install() invocations,
or just maybe bite the bullet and flip the default from fatal=False to
fatal=True in charmhelpers/fetch/__init__.py's apt_install(). Or even
do it in _run_apt_command().
One silly case this change would make worse is if the specified
package does not exist. It would keep uselessly retrying until the
retry_count limit is hit. But then again we could improve the code to
check what actually failed, and exit the retry loop if the error is
"unknown package".
To manage notifications about this bug go to:
https://bugs.launchpad.net/charm-helpers/+bug/1601972/+subscriptions
More information about the Ubuntu-openstack-bugs
mailing list