From e2ec29813a2d113f5685e4bcb858d4de0891973a Mon Sep 17 00:00:00 2001 From: Aneesh Agrawal Date: Wed, 19 Aug 2015 12:54:55 -0400 Subject: [PATCH 01/10] Move state files into respective folders. Take advantage of the init.sls convention to clean up top level folder. --- README.md | 6 +++--- buildbot-master.sls => buildbot/master.sls | 2 +- buildbot/master/public_html/bg_gradient.jpg | Bin 1822 -> 1821 bytes buildbot-slave.sls => buildbot/slave.sls | 2 +- homu.sls => homu/init.sls | 0 nginx/default | 2 +- nginx.sls => nginx/init.sls | 0 top.sls | 8 ++++---- xvfb.sls => xvfb/init.sls | 0 9 files changed, 10 insertions(+), 10 deletions(-) rename buildbot-master.sls => buildbot/master.sls (99%) rename buildbot-slave.sls => buildbot/slave.sls (98%) rename homu.sls => homu/init.sls (100%) rename nginx.sls => nginx/init.sls (100%) rename xvfb.sls => xvfb/init.sls (100%) diff --git a/README.md b/README.md index 10a38fb6..e606d283 100644 --- a/README.md +++ b/README.md @@ -2,12 +2,12 @@ [![Build Status](https://travis-ci.org/servo/saltfs.svg)](https://travis-ci.org/servo/saltfs) -## What's going on? +## What's going on? Salt is a configuration management tool that we use to automate Servo's infrastructure. See [the tutorials](http://docs.saltstack.com/en/latest/topics/tutorials/) to get -started. +started. ## Contributing @@ -19,4 +19,4 @@ into trouble, file [an issue](https://github.com/servo/saltfs/issues/new)! ## Travis TravisCI is set up to test these configurations as described -[here](https://lambdaops.com/automation/travis/travis%20ci/configuration%20management/continuous%20integration/salt/chef/saltstack/salt%20stack/2014/01/29/travis-for-salt-states/). +[here](https://lambdaops.com/automation/travis/travis%20ci/configuration%20management/continuous%20integration/salt/chef/saltstack/salt%20stack/2014/01/29/travis-for-salt-states/). diff --git a/buildbot-master.sls b/buildbot/master.sls similarity index 99% rename from buildbot-master.sls rename to buildbot/master.sls index c718a6a0..a09d31fd 100644 --- a/buildbot-master.sls +++ b/buildbot/master.sls @@ -41,7 +41,7 @@ buildbot-github-listener: service: - running - enable: True - + /usr/local/bin/github_buildbot.py: file.managed: - source: salt://buildbot/github_buildbot.py diff --git a/buildbot/master/public_html/bg_gradient.jpg b/buildbot/master/public_html/bg_gradient.jpg index 6c2e5ddf2fc87743a0794ee59f2a46addd2c3c92..6a9285be3deb36d979fdc1770b3de480fb8c440a 100644 GIT binary patch delta 12 TcmbQoHaBrBuB=1A5fi~u6X1YH0C diff --git a/buildbot-slave.sls b/buildbot/slave.sls similarity index 98% rename from buildbot-slave.sls rename to buildbot/slave.sls index 34344bbc..089509c7 100644 --- a/buildbot-slave.sls +++ b/buildbot/slave.sls @@ -52,7 +52,7 @@ buildbot-slave: - source: salt://buildbot/net.buildbot.buildslave.plist - user: root - group: wheel - - mode: 644 + - mode: 644 launchctl unload /Library/LaunchDaemons/net.buildbot.buildslave.plist: cmd.run diff --git a/homu.sls b/homu/init.sls similarity index 100% rename from homu.sls rename to homu/init.sls diff --git a/nginx/default b/nginx/default index 3d9ac364..6cace48b 100644 --- a/nginx/default +++ b/nginx/default @@ -1,7 +1,7 @@ server { listen 80 default_server; server_name build.servo.org; - + location / { proxy_pass http://localhost:8010/; diff --git a/nginx.sls b/nginx/init.sls similarity index 100% rename from nginx.sls rename to nginx/init.sls diff --git a/top.sls b/top.sls index 3b849666..cf249156 100644 --- a/top.sls +++ b/top.sls @@ -4,13 +4,13 @@ base: - servo-dependencies 'servo-master': - - buildbot-master + - buildbot.master - homu - nginx 'servo-(linux|mac|macpro)\d+': - match: pcre - - buildbot-slave + - buildbot.slave 'servo-linux\d+': - match: pcre @@ -23,11 +23,11 @@ base: 'servo-linux-android\d+': - match: pcre - - buildbot-slave + - buildbot.slave - android-dependencies - gonk-dependencies 'servo-head': - match: pcre - - buildbot-slave + - buildbot.slave - android-dependencies diff --git a/xvfb.sls b/xvfb/init.sls similarity index 100% rename from xvfb.sls rename to xvfb/init.sls From 23d5aab0c150d6282759c641e97cdd1eb6fa7868 Mon Sep 17 00:00:00 2001 From: Aneesh Agrawal Date: Wed, 19 Aug 2015 12:56:39 -0400 Subject: [PATCH 02/10] Remove empty state file. --- builder.sls | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 builder.sls diff --git a/builder.sls b/builder.sls deleted file mode 100644 index e69de29b..00000000 From bf700537f512d0bf64bfaa9a30e4f0bc7a8b7360 Mon Sep 17 00:00:00 2001 From: Aneesh Agrawal Date: Wed, 19 Aug 2015 13:12:12 -0400 Subject: [PATCH 03/10] Reduce redundancy in the common state file with jinja. Factor out common subexpressions based on system type. --- common.sls => common/init.sls | 83 ++++++++--------------------------- common/map.jinja | 15 +++++++ 2 files changed, 34 insertions(+), 64 deletions(-) rename common.sls => common/init.sls (53%) create mode 100644 common/map.jinja diff --git a/common.sls b/common/init.sls similarity index 53% rename from common.sls rename to common/init.sls index 15e17187..b4424351 100644 --- a/common.sls +++ b/common/init.sls @@ -1,19 +1,18 @@ +{% from tpldir ~ '/map.jinja' import config with context %} + {% if grains['kernel'] != 'Darwin' %} -python-pip: - pkg.installed -python-dev: - pkg.installed +python-pkgs: + pkg.installed: + - pkgs: + - python-pip + - python-dev {% endif %} servo: user.present: - fullname: Tom Servo - shell: /bin/bash -{% if grains['kernel'] != 'Darwin' %} - - home: /home/servo -{% else %} - - home: /Users/servo -{% endif %} + - home: {{ config.servo_home }} host.servo-master: host.present: @@ -58,109 +57,65 @@ host.servo-head: sshkey-jack: ssh_auth: - present - {% if grains["kernel"] != "Darwin" %} - - user: root - {% else %} - - user: administrator - {% endif %} + - user: {{ config.root_user }} - source: salt://ssh/jack.pub sshkey-gw: ssh_auth: - present - {% if grains["kernel"] != "Darwin" %} - - user: root - {% else %} - - user: administrator - {% endif %} + - user: {{ config.root_user }} - source: salt://ssh/gw.pub sshkey-jdm: ssh_auth: - present - {% if grains["kernel"] != "Darwin" %} - - user: root - {% else %} - - user: administrator - {% endif %} + - user: {{ config.root_user }} - source: salt://ssh/jdm.pub sshkey-larsberg: ssh_auth: - present - {% if grains["kernel"] != "Darwin" %} - - user: root - {% else %} - - user: administrator - {% endif %} + - user: {{ config.root_user }} - source: salt://ssh/larsberg.pub sshkey-simonsapin: ssh_auth: - present - {% if grains["kernel"] != "Darwin" %} - - user: root - {% else %} - - user: administrator - {% endif %} + - user: {{ config.root_user }} - source: salt://ssh/simonsapin.pub sshkey-pcwalton: ssh_auth: - present - {% if grains["kernel"] != "Darwin" %} - - user: root - {% else %} - - user: administrator - {% endif %} + - user: {{ config.root_user }} - source: salt://ssh/pcwalton.pub sshkey-manishearth: ssh_auth: - present - {% if grains["kernel"] != "Darwin" %} - - user: root - {% else %} - - user: administrator - {% endif %} + - user: {{ config.root_user }} - source: salt://ssh/manishearth.pub sshkey-edunham: ssh_auth: - present - {% if grains["kernel"] != "Darwin" %} - - user: root - {% else %} - - user: administrator - {% endif %} + - user: {{ config.root_user }} - source: salt://ssh/edunham.pub sshkey-mbrubeck: ssh_auth: - present - {% if grains["kernel"] != "Darwin" %} - - user: root - {% else %} - - user: administrator - {% endif %} + - user: {{ config.root_user }} - source: salt://ssh/mbrubeck.pub sshkey-mwu: ssh_auth: - present - {% if grains["kernel"] != "Darwin" %} - - user: root - {% else %} - - user: administrator - {% endif %} + - user: {{ config.root_user }} - source: salt://ssh/mwu.pub sshkey-ms2ger: ssh_auth: - present - {% if grains["kernel"] != "Darwin" %} - - user: root - {% else %} - - user: administrator - {% endif %} + - user: {{ config.root_user }} - source: salt://ssh/Ms2ger.pub diff --git a/common/map.jinja b/common/map.jinja new file mode 100644 index 00000000..84c9565c --- /dev/null +++ b/common/map.jinja @@ -0,0 +1,15 @@ +{% + set config = salt['grains.filter_by']({ + 'defaults': { + 'servo_home': '/home/servo', + 'root_user': 'root' + }, + 'Darwin': { + 'servo_home': '/Users/servo', + 'root_user': 'administrator' + } + }, + base='defaults', + grain='kernel' + ) +%} From d4667c20796503c3f8ee29e348311afd991f35fe Mon Sep 17 00:00:00 2001 From: Aneesh Agrawal Date: Wed, 19 Aug 2015 13:30:28 -0400 Subject: [PATCH 04/10] Use jinja loops to remove more redundancy in the common state file. Combine similar states with templating. Ideally, the variable data (hostnames, ips, usernames) - the 'hosts' and 'ssh_users' fields - would be used via pillar to allow changing the state file less often. --- common/init.sls | 118 +++------------------------- common/map.jinja | 27 ++++++- {ssh => common/ssh}/Ms2ger.pub | 0 {ssh => common/ssh}/edunham.pub | 0 {ssh => common/ssh}/gw.pub | 0 {ssh => common/ssh}/jack.pub | 0 {ssh => common/ssh}/jdm.pub | 0 {ssh => common/ssh}/larsberg.pub | 0 {ssh => common/ssh}/manishearth.pub | 0 {ssh => common/ssh}/mbrubeck.pub | 0 {ssh => common/ssh}/mwu.pub | 0 {ssh => common/ssh}/pcwalton.pub | 0 {ssh => common/ssh}/simonsapin.pub | 0 13 files changed, 38 insertions(+), 107 deletions(-) rename {ssh => common/ssh}/Ms2ger.pub (100%) rename {ssh => common/ssh}/edunham.pub (100%) mode change 100755 => 100644 rename {ssh => common/ssh}/gw.pub (100%) rename {ssh => common/ssh}/jack.pub (100%) rename {ssh => common/ssh}/jdm.pub (100%) rename {ssh => common/ssh}/larsberg.pub (100%) rename {ssh => common/ssh}/manishearth.pub (100%) rename {ssh => common/ssh}/mbrubeck.pub (100%) mode change 100755 => 100644 rename {ssh => common/ssh}/mwu.pub (100%) rename {ssh => common/ssh}/pcwalton.pub (100%) rename {ssh => common/ssh}/simonsapin.pub (100%) diff --git a/common/init.sls b/common/init.sls index b4424351..207d9572 100644 --- a/common/init.sls +++ b/common/init.sls @@ -14,108 +14,16 @@ servo: - shell: /bin/bash - home: {{ config.servo_home }} -host.servo-master: - host.present: - - name: servo-master - - ip: 96.126.125.232 - -host.servo-linux1: - host.present: - - name: servo-linux1 - - ip: 66.228.48.56 - -host.servo-linux2: - host.present: - - name: servo-linux2 - - ip: 173.255.201.95 - -host.servo-linux3: - host.present: - - name: servo-linux3 - - ip: 45.79.167.177 - -host.servo-linux-android1: - host.present: - - name: servo-linux-android1 - - ip: 72.14.176.110 - -host.servo-mac1: - host.present: - - name: servo-mac1 - - ip: 208.52.161.130 - -host.servo-mac3: - host.present: - - name: servo-mac3 - - ip: 63.135.170.19 - -host.servo-head: - host.present: - - name: servo-head - - ip: 96.126.114.185 - -sshkey-jack: - ssh_auth: - - present - - user: {{ config.root_user }} - - source: salt://ssh/jack.pub - -sshkey-gw: - ssh_auth: - - present - - user: {{ config.root_user }} - - source: salt://ssh/gw.pub - -sshkey-jdm: - ssh_auth: - - present - - user: {{ config.root_user }} - - source: salt://ssh/jdm.pub - -sshkey-larsberg: - ssh_auth: - - present - - user: {{ config.root_user }} - - source: salt://ssh/larsberg.pub - -sshkey-simonsapin: - ssh_auth: - - present - - user: {{ config.root_user }} - - source: salt://ssh/simonsapin.pub - -sshkey-pcwalton: - ssh_auth: - - present - - user: {{ config.root_user }} - - source: salt://ssh/pcwalton.pub - -sshkey-manishearth: - ssh_auth: - - present - - user: {{ config.root_user }} - - source: salt://ssh/manishearth.pub - -sshkey-edunham: - ssh_auth: - - present - - user: {{ config.root_user }} - - source: salt://ssh/edunham.pub - -sshkey-mbrubeck: - ssh_auth: - - present - - user: {{ config.root_user }} - - source: salt://ssh/mbrubeck.pub - -sshkey-mwu: - ssh_auth: - - present - - user: {{ config.root_user }} - - source: salt://ssh/mwu.pub - -sshkey-ms2ger: - ssh_auth: - - present - - user: {{ config.root_user }} - - source: salt://ssh/Ms2ger.pub +{% for hostname, ip in config.hosts.items() %} +host-{{ hostname }}: + host.present: + - name: {{ hostname }} + - ip: {{ ip }} +{% endfor %} + +{% for ssh_user in config.ssh_users %} +sshkey-{{ ssh_user }}: + ssh_auth.present: + - user {{ config.root_user }} + - source: salt://{{ tpldir }}/ssh/{{ ssh_user }}.pub +{% endfor %} diff --git a/common/map.jinja b/common/map.jinja index 84c9565c..217825e0 100644 --- a/common/map.jinja +++ b/common/map.jinja @@ -2,8 +2,31 @@ set config = salt['grains.filter_by']({ 'defaults': { 'servo_home': '/home/servo', - 'root_user': 'root' - }, + 'root_user': 'root', + 'hosts': [ + 'servo-master': '96.126.125.232', + 'servo-linux1': '66.228.48.56', + 'servo-linux2': '173.255.201.95', + 'servo-linux3': '45.79.167.177', + 'servo-linux-android1': '72.14.176.110', + 'servo-mac1': '208.52.161.130', + 'servo-mac3': '63.135.170.19', + 'servo-head': 96.126.114.185' + ], + 'ssh_users': [ + 'edunham', + 'gw', + 'jack', + 'jdm', + 'larsberg', + 'manishearth', + 'mbrubeck', + 'Ms2ger', + 'mwu', + 'pcwalton', + 'simponsapin' + ] + }, 'Darwin': { 'servo_home': '/Users/servo', 'root_user': 'administrator' diff --git a/ssh/Ms2ger.pub b/common/ssh/Ms2ger.pub similarity index 100% rename from ssh/Ms2ger.pub rename to common/ssh/Ms2ger.pub diff --git a/ssh/edunham.pub b/common/ssh/edunham.pub old mode 100755 new mode 100644 similarity index 100% rename from ssh/edunham.pub rename to common/ssh/edunham.pub diff --git a/ssh/gw.pub b/common/ssh/gw.pub similarity index 100% rename from ssh/gw.pub rename to common/ssh/gw.pub diff --git a/ssh/jack.pub b/common/ssh/jack.pub similarity index 100% rename from ssh/jack.pub rename to common/ssh/jack.pub diff --git a/ssh/jdm.pub b/common/ssh/jdm.pub similarity index 100% rename from ssh/jdm.pub rename to common/ssh/jdm.pub diff --git a/ssh/larsberg.pub b/common/ssh/larsberg.pub similarity index 100% rename from ssh/larsberg.pub rename to common/ssh/larsberg.pub diff --git a/ssh/manishearth.pub b/common/ssh/manishearth.pub similarity index 100% rename from ssh/manishearth.pub rename to common/ssh/manishearth.pub diff --git a/ssh/mbrubeck.pub b/common/ssh/mbrubeck.pub old mode 100755 new mode 100644 similarity index 100% rename from ssh/mbrubeck.pub rename to common/ssh/mbrubeck.pub diff --git a/ssh/mwu.pub b/common/ssh/mwu.pub similarity index 100% rename from ssh/mwu.pub rename to common/ssh/mwu.pub diff --git a/ssh/pcwalton.pub b/common/ssh/pcwalton.pub similarity index 100% rename from ssh/pcwalton.pub rename to common/ssh/pcwalton.pub diff --git a/ssh/simonsapin.pub b/common/ssh/simonsapin.pub similarity index 100% rename from ssh/simonsapin.pub rename to common/ssh/simonsapin.pub From 775c6c5747918108dbbbec711497081163d6b03a Mon Sep 17 00:00:00 2001 From: Aneesh Agrawal Date: Wed, 19 Aug 2015 13:45:28 -0400 Subject: [PATCH 05/10] Consolidate states for conciseness and speed. The pkgs parameter in particular provides a speed boost by installing all pkgs in one transaction. --- android-dependencies.sls | 67 +++++++++++------------------- servo-dependencies.sls | 88 ++++++++++++++-------------------------- 2 files changed, 54 insertions(+), 101 deletions(-) diff --git a/android-dependencies.sls b/android-dependencies.sls index a461ae90..7ac86bb3 100644 --- a/android-dependencies.sls +++ b/android-dependencies.sls @@ -1,42 +1,29 @@ -{% if '64' in grains["cpuarch"] %} +{% if '64' in grains['cpuarch'] %} #TODO: need to do these first on new ubuntus. #dpkg --add-architecture i386 #apt-get update -libc6:i386: - pkg: - - installed - -libstdc++6:i386: - pkg: - - installed +android-dependencies-multilib: + pkg.installed: + - pkgs: + - libc6:i386 + - libstdc++6:i386 {% endif %} -default-jdk: - pkg.installed - -ant: - pkg.installed - -s3cmd: - pip.installed - -expect: - pkg.installed - -gcc: - pkg.installed - -g++: - pkg.installed - -lib32z1: - pkg.installed - -libstdc++6: - pkg.installed - -libgl1-mesa-dev: - pkg.installed +android-dependencies: + pkg.installed: + - pkgs: + - default-jdk + - ant + - expect + - gcc + - g++ + - lib32z1 + - libstdc++6 + - libgl1-mesa-dev + +android-python-dependencies: + pip.installed: + - s3cmd android-sdk-download: file.managed: @@ -72,7 +59,7 @@ android-sdk-update: - watch: - cmd: android-sdk-download - require: - - pkg: default-jdk + - pkg: android-dependencies android-ndk-download: file.managed: @@ -81,20 +68,14 @@ android-ndk-download: - source_hash: sha1=87e159831a6759d5fb84545c445e551995185634 - user: servo - group: servo - -android-ndk-chmod: - cmd.wait: - - name: chmod a+x /home/servo/android-ndk-r10c-linux-x86_64.bin - - user: servo - - watch: - - file: android-ndk-download + - mode: 777 android-ndk-install: cmd.wait: - name: /home/servo/android-ndk-r10c-linux-x86_64.bin - user: servo - watch: - - cmd: android-ndk-chmod + - file: android-ndk-download android-ndk-toolset-configuration: cmd.wait: diff --git a/servo-dependencies.sls b/servo-dependencies.sls index 7420abb9..0db9000c 100644 --- a/servo-dependencies.sls +++ b/servo-dependencies.sls @@ -1,16 +1,4 @@ -cmake: - pkg.installed - -git: - pkg.installed - -virtualenv: - pip.installed - -ghp-import: - pip.installed - -{% if grains["kernel"] != "Darwin" %} +{% if grains['kernel'] != 'Darwin' %} FIX enable multiverse: pkgrepo.absent: - name: deb http://archive.ubuntu.com/ubuntu trusty multiverse @@ -22,49 +10,33 @@ enable multiverse: agree to eula: cmd.run: - name: echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | debconf-set-selections - -libglib2.0-dev: - pkg.installed - -libgl1-mesa-dri: - pkg.installed - -freeglut3-dev: - pkg.installed - -libfreetype6-dev: - pkg.installed - -xorg-dev: - pkg.installed - -libssl-dev: - pkg.installed - -libbz2-dev: - pkg.installed - -ttf-mscorefonts-installer: - pkg.installed - -xserver-xorg-input-void: - pkg.installed - -xserver-xorg-video-dummy: - pkg.installed - -xpra: - pkg.installed - -libosmesa6-dev: - pkg.installed - -gperf: - pkg.installed - -{% else %} - -pkg-config: - pkg.installed - {% endif %} + +servo-dependencies: + pkg.installed: + - pkgs: + - cmake + - git + {% if grains['kernel'] == 'Darwin' %} + - pkg-config + {% else %} + - libglib2.0-dev + - libgl1-mesa-dri + - freeglut3-dev + - libfreetype6-dev + - xorg-dev + - libssl-dev + - libbz2-dev + - ttf-mscorefonts-installer + - xserver-xorg-input-void + - xserver-xorg-video-dummy + - xpra + - libosmesa6-dev + - gperf + {% endif %} + +servo-python-dependencies: + pip.installed: + - pkgs: + - virtualenv + - ghp-import From 98ff3653d4a87e76a71904e7936c1c5c4a65a72a Mon Sep 17 00:00:00 2001 From: Aneesh Agrawal Date: Wed, 19 Aug 2015 14:28:03 -0400 Subject: [PATCH 06/10] Do a bit of linting on other state files. Reuse conditional logic and configuration from other places, clean up unused code/duplicated functionality, and standardize a bit of formatting. Eliminate any traces of previous misspellings. --- buildbot/master.sls | 11 +--------- buildbot/slave.sls | 53 +++++++++++++++++++-------------------------- homu/init.sls | 7 +----- nginx/init.sls | 8 +++---- xvfb/init.sls | 6 ++--- 5 files changed, 30 insertions(+), 55 deletions(-) diff --git a/buildbot/master.sls b/buildbot/master.sls index a09d31fd..a9905315 100644 --- a/buildbot/master.sls +++ b/buildbot/master.sls @@ -21,8 +21,6 @@ buildbot-master: - group: servo - dir_mode: 755 - file_mode: 644 - - require_in: - - service: buildbot-master - watch_in: - service: buildbot-master @@ -32,14 +30,11 @@ buildbot-master: - user: root - group: root - mode: 644 - - require_in: - - service: buildbot-master - watch_in: - service: buildbot-master buildbot-github-listener: - service: - - running + service.running: - enable: True /usr/local/bin/github_buildbot.py: @@ -48,8 +43,6 @@ buildbot-github-listener: - user: root - group: root - mode: 755 - - reuqire_in: - - service: buildbot-github-listener - watch_in: - service: buildbot-github-listener @@ -60,8 +53,6 @@ buildbot-github-listener: - user: root - group: root - mode: 644 - - reuqire_in: - - service: buildbot-github-listener - watch_in: - service: buildbot-github-listener diff --git a/buildbot/slave.sls b/buildbot/slave.sls index 089509c7..bda5a0c2 100644 --- a/buildbot/slave.sls +++ b/buildbot/slave.sls @@ -1,51 +1,27 @@ -{% if grains["kernel"] != "Darwin" %} -{% set users_path = "/home" %} -{% else %} -{% set users_path = "/Users" %} -{% endif %} +{% from 'common/map.jinja' import config.servo_home as servo_home with context %} buildbot-slave.pip: pip.installed: - name: buildbot-slave == 0.8.12 -{{ users_path }}/servo/buildbot/slave: +{{ servo_home }}/buildbot/slave: file.recurse: - source: salt://buildbot/slave - template: jinja - user: servo - {% if grains["kernel"] != "Darwin" %} - - group: servo - {% else %} + {% if grains['kernel'] == 'Darwin' %} - group: staff + {% else %} + - group: servo {% endif %} - dir_mode: 755 - file_mode: 644 - {% if grains["kernel"] != "Darwin" %} + {% if grains['kernel'] != 'Darwin' %} - watch_in: - service: buildbot-slave {% endif %} -{% if grains["kernel"] != "Darwin" %} - -/etc/init/buildbot-slave.conf: - file.managed: - - source: salt://buildbot/buildbot-slave.conf - - user: root - {% if grains["kernel"] != "Darwin" %} - - group: root - {% else %} - - group: wheel - {% endif %} - - mode: 644 - - watch_in: - - service: buildbot-slave - -buildbot-slave: - service: - - running - - enable: True - -{% else %} +{% if grains['kernel'] == 'Darwin' %} /Library/LaunchDaemons/net.buildbot.buildslave.plist: file.managed: @@ -60,5 +36,20 @@ launchctl unload /Library/LaunchDaemons/net.buildbot.buildslave.plist: launchctl load -w /Library/LaunchDaemons/net.buildbot.buildslave.plist: cmd.run +{% else %} + +/etc/init/buildbot-slave.conf: + file.managed: + - source: salt://buildbot/buildbot-slave.conf + - user: root + - group: root + - mode: 644 + - watch_in: + - service: buildbot-slave + +buildbot-slave: + service.running: + - enable: True + {% endif %} diff --git a/homu/init.sls b/homu/init.sls index c80bb8ce..15ff508a 100644 --- a/homu/init.sls +++ b/homu/init.sls @@ -13,8 +13,6 @@ https://github.com/barosl/homu: - user: servo - group: servo - mode: 644 - - require_in: - - service: homu - watch_in: - service: homu @@ -30,8 +28,7 @@ install_homu: - editable: /home/servo/homu homu: - service: - - running + service.running: - enable: True - require: - pip: install_homu @@ -42,7 +39,5 @@ homu: - user: root - group: root - mode: 644 - - require_in: - - service: homu - watch_in: - service: homu diff --git a/nginx/init.sls b/nginx/init.sls index fff08b09..5138f4cd 100644 --- a/nginx/init.sls +++ b/nginx/init.sls @@ -1,9 +1,9 @@ nginx: - pkg: - - installed - service: - - running + pkg.installed: [] + service.running: - enable: True + - require: + - pkg: nginx /etc/nginx/sites-available/default: file.managed: diff --git a/xvfb/init.sls b/xvfb/init.sls index 0c771e95..d8f78f2e 100644 --- a/xvfb/init.sls +++ b/xvfb/init.sls @@ -6,10 +6,8 @@ - mode: 644 xvfb: - pkg: - - installed - service: - - running + pkg.installed: [] + service.running: - enable: True - watch: - file: /etc/init/xvfb.conf From bdf3877cf1812ebf4fae394d0644829a2ccf0d51 Mon Sep 17 00:00:00 2001 From: Aneesh Agrawal Date: Wed, 19 Aug 2015 15:19:31 -0400 Subject: [PATCH 07/10] Fix syntax mistakes. --- common/map.jinja | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/common/map.jinja b/common/map.jinja index 217825e0..51d360c6 100644 --- a/common/map.jinja +++ b/common/map.jinja @@ -3,7 +3,7 @@ 'defaults': { 'servo_home': '/home/servo', 'root_user': 'root', - 'hosts': [ + 'hosts': { 'servo-master': '96.126.125.232', 'servo-linux1': '66.228.48.56', 'servo-linux2': '173.255.201.95', @@ -11,8 +11,8 @@ 'servo-linux-android1': '72.14.176.110', 'servo-mac1': '208.52.161.130', 'servo-mac3': '63.135.170.19', - 'servo-head': 96.126.114.185' - ], + 'servo-head': '96.126.114.185' + }, 'ssh_users': [ 'edunham', 'gw', From 873188faa16bcf925ed8362b8938b734d42671dd Mon Sep 17 00:00:00 2001 From: Aneesh Agrawal Date: Wed, 19 Aug 2015 15:35:24 -0400 Subject: [PATCH 08/10] Fix another syntax mistake. --- common/init.sls | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/init.sls b/common/init.sls index 207d9572..1447ca14 100644 --- a/common/init.sls +++ b/common/init.sls @@ -24,6 +24,6 @@ host-{{ hostname }}: {% for ssh_user in config.ssh_users %} sshkey-{{ ssh_user }}: ssh_auth.present: - - user {{ config.root_user }} + - user: {{ config.root_user }} - source: salt://{{ tpldir }}/ssh/{{ ssh_user }}.pub {% endfor %} From c4a3dfaad68aafa0f68324c5dd00e381c879f0e3 Mon Sep 17 00:00:00 2001 From: Aneesh Agrawal Date: Wed, 19 Aug 2015 15:40:06 -0400 Subject: [PATCH 09/10] Fix a name mispelling. Sorry about that! --- common/map.jinja | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/map.jinja b/common/map.jinja index 51d360c6..6413f834 100644 --- a/common/map.jinja +++ b/common/map.jinja @@ -24,7 +24,7 @@ 'Ms2ger', 'mwu', 'pcwalton', - 'simponsapin' + 'simonsapin' ] }, 'Darwin': { From b015a9005e8e4c85b9deba6a254ee67517d9186f Mon Sep 17 00:00:00 2001 From: Aneesh Agrawal Date: Thu, 20 Aug 2015 00:15:16 -0400 Subject: [PATCH 10/10] Combine a few more states together. Also fix jinja templating import error. --- android-dependencies.sls | 18 ++++++------------ buildbot/master.sls | 4 +--- buildbot/slave.sls | 4 ++-- servo-dependencies.sls | 2 -- xvfb/init.sls | 3 ++- 5 files changed, 11 insertions(+), 20 deletions(-) diff --git a/android-dependencies.sls b/android-dependencies.sls index 7ac86bb3..ab907e4f 100644 --- a/android-dependencies.sls +++ b/android-dependencies.sls @@ -1,17 +1,13 @@ -{% if '64' in grains['cpuarch'] %} -#TODO: need to do these first on new ubuntus. -#dpkg --add-architecture i386 -#apt-get update -android-dependencies-multilib: +android-dependencies: pkg.installed: - pkgs: + {% if '64' in grains['cpuarch'] %} + # TODO: need to do these first on new ubuntus. + # dpkg --add-architecture i386 + # apt-get update - libc6:i386 - libstdc++6:i386 -{% endif %} - -android-dependencies: - pkg.installed: - - pkgs: + {% endif %} - default-jdk - ant - expect @@ -20,8 +16,6 @@ android-dependencies: - lib32z1 - libstdc++6 - libgl1-mesa-dev - -android-python-dependencies: pip.installed: - s3cmd diff --git a/buildbot/master.sls b/buildbot/master.sls index a9905315..0614d88d 100644 --- a/buildbot/master.sls +++ b/buildbot/master.sls @@ -9,8 +9,7 @@ boto: pip.installed buildbot-master: - service: - - running + service.running: - enable: True /home/servo/buildbot/master: @@ -55,4 +54,3 @@ buildbot-github-listener: - mode: 644 - watch_in: - service: buildbot-github-listener - diff --git a/buildbot/slave.sls b/buildbot/slave.sls index bda5a0c2..05b52220 100644 --- a/buildbot/slave.sls +++ b/buildbot/slave.sls @@ -1,10 +1,10 @@ -{% from 'common/map.jinja' import config.servo_home as servo_home with context %} +{% from 'common/map.jinja' import config as common with context %} buildbot-slave.pip: pip.installed: - name: buildbot-slave == 0.8.12 -{{ servo_home }}/buildbot/slave: +{{ common.servo_home }}/buildbot/slave: file.recurse: - source: salt://buildbot/slave - template: jinja diff --git a/servo-dependencies.sls b/servo-dependencies.sls index 0db9000c..251b64ae 100644 --- a/servo-dependencies.sls +++ b/servo-dependencies.sls @@ -34,8 +34,6 @@ servo-dependencies: - libosmesa6-dev - gperf {% endif %} - -servo-python-dependencies: pip.installed: - pkgs: - virtualenv diff --git a/xvfb/init.sls b/xvfb/init.sls index d8f78f2e..3a844dc5 100644 --- a/xvfb/init.sls +++ b/xvfb/init.sls @@ -9,6 +9,7 @@ xvfb: pkg.installed: [] service.running: - enable: True + - require: + - pkg: xvfb - watch: - file: /etc/init/xvfb.conf -