From be563616e5cd4f049afdb2cc8fdf5bd362a851c6 Mon Sep 17 00:00:00 2001 From: Alfredo Deza Date: Fri, 26 Sep 2014 10:18:13 -0400 Subject: [PATCH] add a remote helper to pin repos Signed-off-by: Alfredo Deza --- ceph_deploy/hosts/remotes.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ceph_deploy/hosts/remotes.py b/ceph_deploy/hosts/remotes.py index 26c4100..c000c2f 100644 --- a/ceph_deploy/hosts/remotes.py +++ b/ceph_deploy/hosts/remotes.py @@ -57,6 +57,13 @@ def write_yum_repo(content, filename='ceph.repo'): write_file(repo_path, content) +def set_apt_priority(fqdn, path='/etc/apt/preferences.d/ceph.pref'): + template = "Package: *\nPin: origin {fqdn}\nPin-Priority: 999\n" + content = template.format(fqdn=fqdn) + with open(path, 'wb') as fout: + fout.write(content) + + def set_repo_priority(sections, path='/etc/yum.repos.d/ceph.repo', priority='1'): Config = ConfigParser.ConfigParser() Config.read(path) -- 2.47.3