From 531e523b0ab71f3032b7af04222e3a1fd7eba5b1 Mon Sep 17 00:00:00 2001 From: Ashley Penney Date: Wed, 4 Sep 2013 17:27:58 -0400 Subject: [PATCH 1/2] Weird invalid characters in this comment. --- manifests/resource/location.pp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifests/resource/location.pp b/manifests/resource/location.pp index 3018dcb20..3aee89ea5 100644 --- a/manifests/resource/location.pp +++ b/manifests/resource/location.pp @@ -14,8 +14,8 @@ # with nginx::resource::upstream # [*proxy_read_timeout*] - Override the default the proxy read timeout value of 90 seconds # [*fastcgi*] - location of fastcgi (host:port) -# [*fastcgi_params*] - optional alternative fastcgi_params file to use -# [*fastcgi_script*] - optional SCRIPT_FILE parameter +# [*fastcgi_params*] - optional alternative fastcgi_params file to use +# [*fastcgi_script*] - optional SCRIPT_FILE parameter # [*fastcgi_split_path*] - Allows settings of fastcgi_split_path_info so that you can split the script_name and path_info via regex # [*ssl*] - Indicates whether to setup SSL bindings for this location. # [*ssl_only*] - Required if the SSL and normal vHost have the same port. From 46a17f97c5d6c9a3f89991b2c60d8011428faca1 Mon Sep 17 00:00:00 2001 From: Ashley Penney Date: Wed, 4 Sep 2013 17:57:41 -0400 Subject: [PATCH 2/2] Refactor to use puppetlabs-apt. This is just the first step of fixing up the repo stuff and allowing the module to take in a package_name, but this helps replace the execs{} with puppetlabs-apt. Tested on: Debian 7, Ubuntu 12.04. --- Gemfile.lock | 31 +++++++++++++++++++++++++++++++ Modulefile | 1 + manifests/package/debian.pp | 23 ++++++++--------------- 3 files changed, 40 insertions(+), 15 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index b8145a801..d78d90213 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,6 +1,7 @@ GEM remote: https://rubygems.org/ specs: + builder (3.2.2) diff-lcs (1.2.4) facter (1.7.1) hiera (1.2.1) @@ -8,6 +9,7 @@ GEM highline (1.6.19) json (1.8.0) json_pure (1.8.0) + kwalify (0.7.2) librarian (0.1.0) highline thor (~> 0.15) @@ -19,6 +21,9 @@ GEM mime-types (1.23) mocha (0.14.0) metaclass (~> 0.0.1) + net-scp (1.1.2) + net-ssh (>= 2.6.5) + net-ssh (2.6.8) nokogiri (1.5.9) puppet (3.2.1) facter (~> 1.6) @@ -37,6 +42,10 @@ GEM rspec (>= 2.9.0) rspec-puppet (>= 0.1.1) rake (10.0.4) + rbvmomi (1.6.0) + builder + nokogiri (>= 1.4.1) + trollop rest-client (1.6.7) mime-types (>= 1.16) rgen (0.6.2) @@ -50,7 +59,26 @@ GEM rspec-mocks (2.13.1) rspec-puppet (0.1.6) rspec + rspec-system (2.2.0) + kwalify (~> 0.7.2) + net-scp (~> 1.1) + net-ssh (~> 2.6) + nokogiri (~> 1.5.9) + rbvmomi (~> 1.6) + rspec (~> 2.13) + systemu (~> 2.5) + rspec-system-puppet (2.2.0) + rspec-system (~> 2.0) + rspec-system-serverspec (1.0.0) + rspec-system (~> 2.0) + serverspec (~> 0.6.0) + serverspec (0.6.3) + highline + net-ssh + rspec (~> 2.0) + systemu (2.5.2) thor (0.18.1) + trollop (2.0) PLATFORMS ruby @@ -63,3 +91,6 @@ DEPENDENCIES puppetlabs_spec_helper rake (>= 0.9.2.2) rspec-puppet (>= 0.1.3) + rspec-system-puppet + rspec-system-serverspec + serverspec diff --git a/Modulefile b/Modulefile index 7b8085532..5e5a2f141 100644 --- a/Modulefile +++ b/Modulefile @@ -8,3 +8,4 @@ description 'This module can be used for basic NGINX Management' project_page 'http://github.com/jfryman/puppet-nginx' dependency 'puppetlabs/stdlib', '>= 0.1.6' +dependency 'puppetlabs/apt', '>= 1.0.0' diff --git a/manifests/package/debian.pp b/manifests/package/debian.pp index 983d182d6..bb2b8b513 100644 --- a/manifests/package/debian.pp +++ b/manifests/package/debian.pp @@ -14,7 +14,7 @@ # # This class file is not called directly class nginx::package::debian { - $operatingsystem_lowercase = inline_template('<%= @operatingsystem.downcase %>') + $distro = downcase($::operatingsystem) package { 'nginx': ensure => $nginx::package_ensure, @@ -23,20 +23,13 @@ anchor { 'nginx::apt_repo' : } - file { '/etc/apt/sources.list.d/nginx.list': - ensure => present, - content => "deb http://nginx.org/packages/${operatingsystem_lowercase}/ ${::lsbdistcodename} nginx - deb-src http://nginx.org/packages/${operatingsystem_lowercase}/ ${::lsbdistcodename} nginx - ", - mode => '0444', - require => Exec['add_nginx_apt_key'], - before => Anchor['nginx::apt_repo'], - } + include '::apt' - exec { 'add_nginx_apt_key': - command => '/usr/bin/wget http://nginx.org/keys/nginx_signing.key -O - | /usr/bin/apt-key add -', - unless => '/usr/bin/apt-key list | /bin/grep -q nginx', - before => Anchor['nginx::apt_repo'], + apt::source { 'nginx': + location => "http://nginx.org/packages/${distro}", + repos => 'nginx', + key => '7BD9BF62', + key_source => 'http://nginx.org/keys/nginx_signing.key', } exec { 'apt_get_update_for_nginx': @@ -44,7 +37,7 @@ timeout => 240, returns => [ 0, 100 ], refreshonly => true, - subscribe => File['/etc/apt/sources.list.d/nginx.list'], + subscribe => Apt::Source['nginx'], before => Anchor['nginx::apt_repo'], } }