Install python dependencies early for CH ip.py

When using charmhelpers.contrib.network.ip apt install was quietly
failing. Install python dependencies in the early install hook
(before install.real).

Charm-helpers sync to bring in apt_install with fatal=True

Change-Id: Ic406ed34eb42efd6ca0296f3e29f4eef88b5bdd1
Partial-Bug: 1601972
This commit is contained in:
David Ames 2016-07-18 10:02:21 -07:00
parent 6bfcb9836b
commit acb8b47c74
2 changed files with 3 additions and 3 deletions

View File

@ -414,7 +414,7 @@ def ns_query(address):
try:
import dns.resolver
except ImportError:
apt_install('python-dnspython')
apt_install('python-dnspython', fatal=True)
import dns.resolver
if isinstance(address, dns.name.Name):
@ -458,7 +458,7 @@ def get_hostname(address, fqdn=True):
try:
import dns.reversename
except ImportError:
apt_install("python-dnspython")
apt_install("python-dnspython", fatal=True)
import dns.reversename
rev = dns.reversename.from_address(address)

View File

@ -2,7 +2,7 @@
# Wrapper to deal with newer Ubuntu versions that don't have py2 installed
# by default.
declare -a DEPS=('apt' 'netaddr' 'netifaces' 'pip' 'yaml')
declare -a DEPS=('apt' 'netaddr' 'netifaces' 'pip' 'yaml' 'dnspython')
check_and_install() {
pkg="${1}-${2}"