From 88a9116df175f0d3b9ff3590d90a890975f2d92b Mon Sep 17 00:00:00 2001 From: Aneesh Agrawal Date: Sun, 28 Feb 2016 23:08:02 -0500 Subject: [PATCH] Disable service autostart on package install Debian and its derivatives will autostart services when installing packages. However, often we need to configure installed software before it is ready to run, so it's preferable to use Salt states and requisites to handle package installation or upgrades, configuration changes and service [re]starting. Adding a policy-rc.d file with exit code 101 sets a policy which denies this default behavior. Making this change in the install script also prevents new builders from attempting to contact the Salt master before they have been configured properly. --- .travis/install_salt | 2 ++ top.sls | 4 ++++ ubuntu/files/policy-rc.d | 2 ++ ubuntu/init.sls | 8 ++++++++ 4 files changed, 16 insertions(+) create mode 100644 ubuntu/files/policy-rc.d create mode 100644 ubuntu/init.sls diff --git a/.travis/install_salt b/.travis/install_salt index 8d59a8d04..b92560219 100755 --- a/.travis/install_salt +++ b/.travis/install_salt @@ -8,6 +8,8 @@ install_salt () { if [ "${OS_NAME}" = "linux" ]; then printf "$0: installing salt for Linux\n" # Use Trusty (Ubuntu 14.04) on Travis + # 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 sudo apt-get -y update diff --git a/top.sls b/top.sls index 923564917..7d4f2660e 100644 --- a/top.sls +++ b/top.sls @@ -5,6 +5,10 @@ base: - common - servo-dependencies + 'os:Ubuntu': + - match: grain + - ubuntu + 'servo-head': - buildbot.slave - android-dependencies diff --git a/ubuntu/files/policy-rc.d b/ubuntu/files/policy-rc.d new file mode 100644 index 000000000..0b1556d76 --- /dev/null +++ b/ubuntu/files/policy-rc.d @@ -0,0 +1,2 @@ +#!/bin/sh +exit 101 diff --git a/ubuntu/init.sls b/ubuntu/init.sls new file mode 100644 index 000000000..2c256ea75 --- /dev/null +++ b/ubuntu/init.sls @@ -0,0 +1,8 @@ +# Disable service autostart on package install +# Use Salt to manage service [re-]start on package change +/usr/sbin/policy-rc.d: + file.managed: + - user: root + - group: root + - mode: 755 + - source: salt://{{ tpldir }}/files/policy-rc.d