From b2122db4f64fb740b92b0e5ea8d4aab61896a9b1 Mon Sep 17 00:00:00 2001 From: Wes Turner Date: Mon, 11 Aug 2014 21:01:38 -0500 Subject: [PATCH 1/2] BUG: Fix pkgrepo.managed, from_source -> install_from_source (consistency) --- nginx/ng/install.sls | 22 +++++++++++++++++++++- nginx/ng/map.jinja | 3 ++- nginx/ng/service.sls | 2 +- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/nginx/ng/install.sls b/nginx/ng/install.sls index f538ccd..45fc003 100644 --- a/nginx/ng/install.sls +++ b/nginx/ng/install.sls @@ -5,10 +5,30 @@ {% from 'nginx/ng/map.jinja' import nginx, sls_block with context %} nginx_install: - {% if nginx.from_source %} + {% if nginx.install_from_source %} ## add source compilation here {% else %} pkg.installed: {{ sls_block(nginx.package.opts) }} - name: {{ nginx.lookup.package }} {% endif %} + +{% if salt['grains.get']('os_family') == 'Debian' %} +nginx_ppa_repo: + pkgrepo: + {%- if nginx.install_from_ppa %} + - managed + {%- else %} + - absent + {%- endif %} + - humanname: nginx-ppa-{{ grains['oscodename'] }} + - name: deb http://ppa.launchpad.net/nginx/stable/ubuntu {{ grains['oscodename'] }} main + - file: /etc/apt/sources.list.d/nginx-stable-{{ grains['oscodename'] }}.list + - dist: {{ grains['oscodename'] }} + - keyid: C300EE8C + - keyserver: keyserver.ubuntu.com + - require_in: + - pkg: nginx_install + - watch_in: + - pkg: nginx_install +{% endif %} diff --git a/nginx/ng/map.jinja b/nginx/ng/map.jinja index 4cb455f..46056fb 100644 --- a/nginx/ng/map.jinja +++ b/nginx/ng/map.jinja @@ -25,7 +25,8 @@ 'vhost_use_symlink': False, }, }, default='Debian' ), - 'from_source': False, + 'install_from_source': False, + 'install_from_ppa': False, 'package': { 'opts': {}, }, diff --git a/nginx/ng/service.sls b/nginx/ng/service.sls index 177c175..2812619 100644 --- a/nginx/ng/service.sls +++ b/nginx/ng/service.sls @@ -16,6 +16,6 @@ nginx_service: - require: - sls: nginx.ng.install - watch: - {% if not nginx.from_source %} + {% if not nginx.install_from_source %} - pkg: nginx_install {% endif %} From 1f5d6bb7ee1973a088502185e9b8718cc7a839bb Mon Sep 17 00:00:00 2001 From: Wes Turner Date: Mon, 11 Aug 2014 21:54:22 -0500 Subject: [PATCH 2/2] BUG: Conditional pkgrepo.absent instead of enabled, pkgrepo:watch_in --- nginx/package.sls | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/nginx/package.sls b/nginx/package.sls index fd5ae0c..cb8e80a 100644 --- a/nginx/package.sls +++ b/nginx/package.sls @@ -1,3 +1,4 @@ +{% from "nginx/map.jinja" import nginx with context %} {% set use_upstart = pillar.get('nginx', {}).get('use_upstart', true) %} {% if use_upstart %} nginx-old-init: @@ -35,9 +36,29 @@ nginx-old-init-disable: - file: nginx-old-init {% endif %} +{% if salt['grains.get']('os_family') == 'Debian' %} +nginx-ppa-repo: + pkgrepo: + {%- if nginx.install_from_ppa %} + - managed + {%- else %} + - absent + {%- endif %} + - humanname: nginx-ppa-{{ grains['oscodename'] }} + - name: deb http://ppa.launchpad.net/nginx/stable/ubuntu {{ grains['oscodename'] }} main + - file: /etc/apt/sources.list.d/nginx-stable-{{ grains['oscodename'] }}.list + - dist: {{ grains['oscodename'] }} + - keyid: C300EE8C + - keyserver: keyserver.ubuntu.com + - require_in: + - pkg: nginx + - watch_in: + - pkg: nginx +{% endif %} + nginx: pkg.installed: - - name: nginx + - name: {{ nginx.package }} {% if use_upstart %} file: - managed