From 0794ea5bb96707944fd189bf2edf75ea78cf2500 Mon Sep 17 00:00:00 2001 From: Aneesh Agrawal Date: Sat, 12 Mar 2016 01:17:35 -0500 Subject: [PATCH 1/2] Standardize pkgrepo usage This changes our workaround to be more verbose with no-op states but more robust in the case of pkrepo failures: the directory will not be cleaned until after all of the pkgrepo states complete succesfully. This also cleans up the MS TTF core fonts, and should help with #186. --- longview/init.sls | 6 +++++- servo-dependencies.sls | 21 +++++++++++++-------- ubuntu/init.sls | 10 ++++++---- 3 files changed, 24 insertions(+), 13 deletions(-) diff --git a/longview/init.sls b/longview/init.sls index 104d3f717..7c2be174d 100644 --- a/longview/init.sls +++ b/longview/init.sls @@ -3,6 +3,10 @@ longview: - name: 'deb http://apt-longview.linode.com/ trusty main' - file: /etc/apt/sources.list.d/longview.list - key_url: https://apt-longview.linode.com/linode.gpg + +/etc/apt/sources.list.d/longview.list: + file.exists: - require: + - pkgrepo: longview + - require_in: - file: /etc/apt/sources.list.d - diff --git a/servo-dependencies.sls b/servo-dependencies.sls index 33b16013c..34f03f2e2 100644 --- a/servo-dependencies.sls +++ b/servo-dependencies.sls @@ -64,21 +64,26 @@ homebrew-link-openssl: - require: - pkg: servo-dependencies {% else %} -FIX enable multiverse: - pkgrepo.absent: - - name: deb http://archive.ubuntu.com/ubuntu trusty multiverse - -enable multiverse: +multiverse: pkgrepo.managed: - - name: deb http://archive.ubuntu.com/ubuntu trusty multiverse + - name: 'deb http://archive.ubuntu.com/ubuntu trusty multiverse' + - file: /etc/apt/sources.list.d/multiverse.list + - require_in: + - pkg: ttf-mscorefonts-installer + +/etc/apt/sources.list.d/multiverse.list: + file.exists: + - require: + - pkgrepo: multiverse + - require_in: + - file: /etc/apt/sources.list.d ttf-mscorefonts-installer: debconf.set: - - name: ttf-mscorefonts-installer - data: { 'msttcorefonts/accepted-mscorefonts-eula': { 'type': 'boolean', 'value': True } } pkg.installed: - pkgs: - ttf-mscorefonts-installer - - requires: + - require: - debconf: ttf-mscorefonts-installer {% endif %} diff --git a/ubuntu/init.sls b/ubuntu/init.sls index 36f27b426..54ae17b66 100644 --- a/ubuntu/init.sls +++ b/ubuntu/init.sls @@ -7,14 +7,16 @@ - mode: 755 - source: salt://{{ tpldir }}/files/policy-rc.d -# Workaround for https://github.com/saltstack/salt/issues/26605 -# Clean the directory first, and require it in all pkgrepo states -# which add repositories to the sources.list.d folder (instead of -# the main /etc/apt/sources.list file) +# Workaround for https://github.com/saltstack/salt/issues/26605: +# For each pkgrepo state which adds any repositories to the sources.list.d +# folder (instead of the main /etc/apt/sources.list file), create an extra, +# no-op file.exists state which requires the pkgrepo state and require_ins +# this state /etc/apt/sources.list.d: file.directory: - user: root - group: root + - file_mode: 644 - dir_mode: 755 - recurse: - user From 483d9a12b2ad7c8e66f23ed5c57dfc7d8fc18eb2 Mon Sep 17 00:00:00 2001 From: Aneesh Agrawal Date: Sat, 12 Mar 2016 02:37:03 -0500 Subject: [PATCH 2/2] Use pkgrepo for Salt This is part of a patch series to standardize our Salt installations. --- .travis/install_salt | 2 +- salt/common.sls | 16 ++++++++++++++++ salt/map.jinja | 10 ++++++++++ top.sls | 1 + 4 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 salt/common.sls create mode 100644 salt/map.jinja diff --git a/.travis/install_salt b/.travis/install_salt index 1f4d0d920..e96331bd5 100755 --- a/.travis/install_salt +++ b/.travis/install_salt @@ -11,7 +11,7 @@ install_salt () { # Don't autostart services printf '#!/bin/sh\nexit 101\n' | sudo install -m 755 /dev/stdin /usr/sbin/policy-rc.d curl https://repo.saltstack.com/apt/ubuntu/14.04/amd64/archive/2015.5.8/SALTSTACK-GPG-KEY.pub | sudo apt-key add - - printf 'deb http://repo.saltstack.com/apt/ubuntu/14.04/amd64/archive/2015.5.8 trusty main\n' | sudo tee -a /etc/apt/sources.list >/dev/null + printf 'deb http://repo.saltstack.com/apt/ubuntu/14.04/amd64/archive/2015.5.8 trusty main\n' | sudo tee /etc/apt/sources.list.d/saltstack.list >/dev/null sudo apt-get -y update sudo apt-get -y install salt-minion=2015.5.8+ds-1 elif [ "${OS_NAME}" = "osx" ]; then diff --git a/salt/common.sls b/salt/common.sls new file mode 100644 index 000000000..8f29f501d --- /dev/null +++ b/salt/common.sls @@ -0,0 +1,16 @@ +{% from tpldir ~ '/map.jinja' import salt %} + +{% if grains['os'] == 'Ubuntu' %} +salt: + pkgrepo.managed: + - name: 'deb http://repo.saltstack.com/apt/ubuntu/14.04/amd64/archive/{{ salt.version }} trusty main' + - file: /etc/apt/sources.list.d/saltstack.list + - key_url: https://repo.saltstack.com/apt/ubuntu/14.04/amd64/archive/{{ salt.version }}/SALTSTACK_GPG_KEY.pub + +/etc/apt/sources.list.d/saltstack.list: + file.exists: + - require: + - pkgrepo: salt + - require_in: + - file: /etc/apt/sources.list.d +{% endif %} diff --git a/salt/map.jinja b/salt/map.jinja new file mode 100644 index 000000000..6404f29eb --- /dev/null +++ b/salt/map.jinja @@ -0,0 +1,10 @@ +{% + set salt = salt.grains.filter_by({ + 'defaults': { + 'version': '2015.5.8' + }, + }, + base='defaults', + merge=salt.pillar.get('salt', {}) + ) +%} diff --git a/top.sls b/top.sls index 9d197fe72..c25cc6119 100644 --- a/top.sls +++ b/top.sls @@ -4,6 +4,7 @@ base: '*': - common - servo-dependencies + - salt.common 'os:Ubuntu': - match: grain