From: Travis Rhoden Date: Tue, 4 Aug 2015 19:21:51 +0000 (-0700) Subject: [RM-12553] Allow a file mode when writing apt repo X-Git-Tag: v1.5.27~4^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=64934e9097a4c82cdb04c60ddd3777c837c23e0f;p=ceph-deploy.git [RM-12553] Allow a file mode when writing apt repo Signed-off-by: Travis Rhoden --- diff --git a/ceph_deploy/hosts/remotes.py b/ceph_deploy/hosts/remotes.py index 573b10f..b17fcb2 100644 --- a/ceph_deploy/hosts/remotes.py +++ b/ceph_deploy/hosts/remotes.py @@ -41,14 +41,14 @@ def machine_type(): return platform.machine() -def write_sources_list(url, codename, filename='ceph.list'): +def write_sources_list(url, codename, filename='ceph.list', mode=0644): """add deb repo to /etc/apt/sources.list.d/""" repo_path = os.path.join('/etc/apt/sources.list.d', filename) - with file(repo_path, 'w') as f: - f.write('deb {url} {codename} main\n'.format( - url=url, - codename=codename, - )) + content = 'deb {url} {codename} main\n'.format( + url=url, + codename=codename, + ) + write_file(repo_path, content, mode) def write_yum_repo(content, filename='ceph.repo'):