From: Vasu Kulkarni Date: Tue, 3 Jan 2017 19:58:41 +0000 (-0800) Subject: [RM-18410] In python3, bytes should be decoded first X-Git-Tag: v1.5.37~2^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=2f79ae78a1dbbaff1b0e48ef0a69465033b829c7;p=ceph-deploy.git [RM-18410] In python3, bytes should be decoded first Signed-off-by: Vasu Kulkarni --- diff --git a/ceph_deploy/hosts/remotes.py b/ceph_deploy/hosts/remotes.py index fc4255b..d0b52f6 100644 --- a/ceph_deploy/hosts/remotes.py +++ b/ceph_deploy/hosts/remotes.py @@ -59,12 +59,16 @@ def write_sources_list(url, codename, filename='ceph.list', mode=0o644): def write_sources_list_content(content, filename='ceph.list', mode=0o644): """add deb repo to /etc/apt/sources.list.d/ from content""" repo_path = os.path.join('/etc/apt/sources.list.d', filename) + if not isinstance(content, str): + content = content.decode('utf-8') write_file(repo_path, content.encode('utf-8'), mode) def write_yum_repo(content, filename='ceph.repo'): """add yum repo file in /etc/yum.repos.d/""" repo_path = os.path.join('/etc/yum.repos.d', filename) + if not isinstance(content, str): + content = content.decode('utf-8') write_file(repo_path, content.encode('utf-8'))