Bring ceph-osd to Python 3

* Synced version of charm-helpers
* Synced version of charms.ceph to bring in Py3 compatible library
  methods.

Change-Id: I5ac45740f48a71d9cb0c5943472fc8590a723514
This commit is contained in:
Alex Kavanagh
2017-11-17 08:57:20 +00:00
parent 7d20f7e37a
commit 4e1ecd55b8
44 changed files with 778 additions and 281 deletions

View File

@@ -44,14 +44,14 @@ TEMPLATES_DIR = 'templates'
try:
import jinja2
except ImportError:
apt_install(filter_installed_packages(['python-jinja2']),
apt_install(filter_installed_packages(['python3-jinja2']),
fatal=True)
import jinja2
try:
import dns.resolver
except ImportError:
apt_install(filter_installed_packages(['python-dnspython']),
apt_install(filter_installed_packages(['python3-dnspython']),
fatal=True)
import dns.resolver
@@ -65,9 +65,9 @@ def render_template(template_name, context, template_dir=TEMPLATES_DIR):
def enable_pocket(pocket):
apt_sources = "/etc/apt/sources.list"
with open(apt_sources, "r") as sources:
with open(apt_sources, "rt", encoding='UTF-8') as sources:
lines = sources.readlines()
with open(apt_sources, "w") as sources:
with open(apt_sources, "wt", encoding='UTF-8') as sources:
for line in lines:
if pocket in line:
sources.write(re.sub('^# deb', 'deb', line))