From dab0f45bea5b7d72b6a6665a3953be783a6bc827 Mon Sep 17 00:00:00 2001 From: Spencer Krum Date: Wed, 28 Jan 2015 19:51:43 -0800 Subject: [PATCH] Rename apache2 to httpd globally This renames the classes and defined types from apache to httpd. With the 'httpd' module available, we can migrate usage of 'apache' to 'httpd.' Eventually this will free the 'apache' namespace. A native ruby type and provider is contained in this class. It is not namespaced to the class name so it has been renamed from a2mod to httpd_mod. Change-Id: I056eb28a13e7ccc95f1496019bedc332c17dd458 --- lib/puppet/provider/a2mod/modfix.rb | 12 ------- .../a2mod.rb => httpd_mod/httpd_mod.rb} | 2 +- lib/puppet/provider/httpd_mod/modfix.rb | 13 +++++++ lib/puppet/type/{a2mod.rb => httpd_mod.rb} | 4 +-- manifests/dev.pp | 8 ++--- manifests/init.pp | 12 +++---- manifests/mod/python.pp | 10 +++--- manifests/mod/wsgi.pp | 10 +++--- manifests/params.pp | 6 ++-- manifests/php.pp | 8 ++--- manifests/python.pp | 10 +++--- manifests/ssl.pp | 10 +++--- manifests/vhost.pp | 36 +++++++++---------- manifests/vhost/proxy.pp | 16 ++++----- manifests/vhost/redirect.pp | 10 +++--- templates/vhost-default.conf.erb | 6 ++-- templates/vhost-proxy.conf.erb | 4 +-- 17 files changed, 89 insertions(+), 88 deletions(-) delete mode 100644 lib/puppet/provider/a2mod/modfix.rb rename lib/puppet/provider/{a2mod/a2mod.rb => httpd_mod/httpd_mod.rb} (89%) create mode 100644 lib/puppet/provider/httpd_mod/modfix.rb rename lib/puppet/type/{a2mod.rb => httpd_mod.rb} (85%) diff --git a/lib/puppet/provider/a2mod/modfix.rb b/lib/puppet/provider/a2mod/modfix.rb deleted file mode 100644 index 8f35b2e..0000000 --- a/lib/puppet/provider/a2mod/modfix.rb +++ /dev/null @@ -1,12 +0,0 @@ -Puppet::Type.type(:a2mod).provide :modfix do - desc "Dummy provider for A2mod. - - Fake nil resources when there is no crontab binary available. Allows - puppetd to run on a bootstrapped machine before a Cron package has been - installed. Workaround for: http://projects.puppetlabs.com/issues/2384 - " - - def self.instances - [] - end -end \ No newline at end of file diff --git a/lib/puppet/provider/a2mod/a2mod.rb b/lib/puppet/provider/httpd_mod/httpd_mod.rb similarity index 89% rename from lib/puppet/provider/a2mod/a2mod.rb rename to lib/puppet/provider/httpd_mod/httpd_mod.rb index 56e293e..f304588 100644 --- a/lib/puppet/provider/a2mod/a2mod.rb +++ b/lib/puppet/provider/httpd_mod/httpd_mod.rb @@ -1,4 +1,4 @@ -Puppet::Type.type(:a2mod).provide(:a2mod) do +Puppet::Type.type(:httpd_mod).provide(:httpd_mod) do desc "Manage Apache 2 modules on Debian and Ubuntu" optional_commands :encmd => "a2enmod" diff --git a/lib/puppet/provider/httpd_mod/modfix.rb b/lib/puppet/provider/httpd_mod/modfix.rb new file mode 100644 index 0000000..6c12b52 --- /dev/null +++ b/lib/puppet/provider/httpd_mod/modfix.rb @@ -0,0 +1,13 @@ +Puppet::Type.type(:httpd_mod).provide :modfix do + desc "Dummy provider for httpd_mod. + + Fake nil resources when there is no a2enmod binary available. Allows + puppetd to run on a bootstrapped machine before apache package has been + installed. Workaround for: http://projects.puppetlabs.com/issues/2384 + and followed up by https://tickets.puppetlabs.com/browse/MODULES-1725 + " + + def self.instances + [] + end +end diff --git a/lib/puppet/type/a2mod.rb b/lib/puppet/type/httpd_mod.rb similarity index 85% rename from lib/puppet/type/a2mod.rb rename to lib/puppet/type/httpd_mod.rb index 63e1914..dd2c776 100644 --- a/lib/puppet/type/a2mod.rb +++ b/lib/puppet/type/httpd_mod.rb @@ -1,4 +1,4 @@ -Puppet::Type.newtype(:a2mod) do +Puppet::Type.newtype(:httpd_mod) do @doc = "Manage Apache 2 modules on Debian and Ubuntu" ensurable @@ -12,4 +12,4 @@ Puppet::Type.newtype(:a2mod) do autorequire(:package) { catalog.resource(:package, 'httpd')} -end \ No newline at end of file +end diff --git a/manifests/dev.pp b/manifests/dev.pp index e25b2c2..9373ed7 100644 --- a/manifests/dev.pp +++ b/manifests/dev.pp @@ -1,4 +1,4 @@ -# Class: apache::dev +# Class: httpd::dev # # This class installs Apache development libraries # @@ -11,11 +11,11 @@ # # Sample Usage: # -class apache::dev { - include apache::params +class httpd::dev { + include httpd::params package { 'apache_dev_package': ensure => installed, - name => $apache::params::apache_dev, + name => $httpd::params::apache_dev, } } diff --git a/manifests/init.pp b/manifests/init.pp index 5fd2b85..f2a51dc 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -1,4 +1,4 @@ -# Class: apache +# Class: httpd # # This class installs Apache # @@ -12,24 +12,24 @@ # # Sample Usage: # -class apache { - include apache::params +class httpd { + include httpd::params package { 'httpd': ensure => installed, - name => $apache::params::apache_name, + name => $httpd::params::apache_name, } service { 'httpd': ensure => running, - name => $apache::params::apache_name, + name => $httpd::params::apache_name, enable => true, subscribe => Package['httpd'], } file { 'httpd_vdir': ensure => directory, - path => $apache::params::vdir, + path => $httpd::params::vdir, recurse => true, purge => true, notify => Service['httpd'], diff --git a/manifests/mod/python.pp b/manifests/mod/python.pp index 3b01360..c8c733f 100644 --- a/manifests/mod/python.pp +++ b/manifests/mod/python.pp @@ -1,4 +1,4 @@ -# Class: apache::mod::python +# Class: httpd::mod::python # # This class installs Python for Apache # @@ -11,16 +11,16 @@ # # Sample Usage: # -class apache::mod::python { - include apache +class httpd::mod::python { + include httpd package { 'mod_python_package': ensure => installed, - name => $apache::params::mod_python_package, + name => $httpd::params::mod_python_package, require => Package['httpd']; } - a2mod { 'python': ensure => present; } + httpd_mod { 'python': ensure => present; } } diff --git a/manifests/mod/wsgi.pp b/manifests/mod/wsgi.pp index 81463b9..9595d43 100644 --- a/manifests/mod/wsgi.pp +++ b/manifests/mod/wsgi.pp @@ -1,4 +1,4 @@ -# Class: apache::mod::wsgi +# Class: httpd::mod::wsgi # # This class installs wsgi for Apache # @@ -11,16 +11,16 @@ # # Sample Usage: # -class apache::mod::wsgi { - include apache +class httpd::mod::wsgi { + include httpd package { 'mod_wsgi_package': ensure => installed, - name => $apache::params::mod_wsgi_package, + name => $httpd::params::mod_wsgi_package, require => Package['httpd']; } - a2mod { 'wsgi': ensure => present; } + httpd_mod { 'wsgi': ensure => present; } } diff --git a/manifests/params.pp b/manifests/params.pp index fd4bc92..94378ce 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -1,4 +1,4 @@ -# Class: apache::params +# Class: httpd::params # # This class manages Apache parameters # @@ -17,12 +17,12 @@ # # Sample Usage: # -class apache::params { +class httpd::params { $user = 'www-data' $group = 'www-data' $ssl = true - $template = 'apache/vhost-default.conf.erb' + $template = 'httpd/vhost-default.conf.erb' $priority = '25' $servername = '' $serveraliases = '' diff --git a/manifests/php.pp b/manifests/php.pp index 4ad0211..ad86f7f 100644 --- a/manifests/php.pp +++ b/manifests/php.pp @@ -1,4 +1,4 @@ -# Class: apache::php +# Class: httpd::php # # This class installs PHP for Apache # @@ -12,11 +12,11 @@ # # Sample Usage: # -class apache::php { - include apache::params +class httpd::php { + include httpd::params package { 'apache_php_package': ensure => present, - name => $apache::params::php_package, + name => $httpd::params::php_package, } } diff --git a/manifests/python.pp b/manifests/python.pp index 3395a8b..c3322e9 100644 --- a/manifests/python.pp +++ b/manifests/python.pp @@ -1,4 +1,4 @@ -# Class: apache::python +# Class: httpd::python # # This class installs Python for Apache # @@ -12,14 +12,14 @@ # # Sample Usage: # -class apache::python { - include apache::params - include apache +class httpd::python { + include httpd::params + include httpd package { 'apache_python_package': ensure => present, name => $apache::params::python_package, } - a2mod { 'python': ensure => present, } + httpd_mod { 'python': ensure => present, } } diff --git a/manifests/ssl.pp b/manifests/ssl.pp index e7f3a98..0027072 100644 --- a/manifests/ssl.pp +++ b/manifests/ssl.pp @@ -1,4 +1,4 @@ -# Class: apache::ssl +# Class: httpd::ssl # # This class installs Apache SSL capabilities # @@ -12,15 +12,15 @@ # # Sample Usage: # -class apache::ssl { +class httpd::ssl { - include apache + include httpd case $::operatingsystem { 'centos', 'fedora', 'redhat', 'scientific': { package { 'apache_ssl_package': ensure => installed, - name => $apache::params::ssl_package, + name => $httpd::params::ssl_package, require => Package['httpd'], } } @@ -28,7 +28,7 @@ class apache::ssl { a2mod { 'ssl': ensure => present, } } default: { - fail( "${::operatingsystem} not defined in apache::ssl.") + fail( "${::operatingsystem} not defined in httpd::ssl.") } } } diff --git a/manifests/vhost.pp b/manifests/vhost.pp index 6ff5859..559a531 100644 --- a/manifests/vhost.pp +++ b/manifests/vhost.pp @@ -1,4 +1,4 @@ -# Definition: apache::vhost +# Definition: httpd::vhost # # This class installs Apache Virtual Hosts # @@ -19,32 +19,32 @@ # - Install Apache Virtual Hosts # # Requires: -# - The apache class +# - The httpd class # # Sample Usage: -# apache::vhost { 'site.name.fqdn': +# httpd::vhost { 'site.name.fqdn': # priority => '20', # port => '80', # docroot => '/path/to/docroot', # } # -define apache::vhost( +define httpd::vhost( $port, $docroot, $configure_firewall = true, - $ssl = $apache::params::ssl, - $template = $apache::params::template, - $priority = $apache::params::priority, - $servername = $apache::params::servername, - $serveraliases = $apache::params::serveraliases, - $auth = $apache::params::auth, - $redirect_ssl = $apache::params::redirect_ssl, - $options = $apache::params::options, - $apache_name = $apache::params::apache_name, - $vhost_name = $apache::params::vhost_name + $ssl = $httpd::params::ssl, + $template = $httpd::params::template, + $priority = $httpd::params::priority, + $servername = $httpd::params::servername, + $serveraliases = $httpd::params::serveraliases, + $auth = $httpd::params::auth, + $redirect_ssl = $httpd::params::redirect_ssl, + $options = $httpd::params::options, + $apache_name = $httpd::params::apache_name, + $vhost_name = $httpd::params::vhost_name ) { - include apache + include httpd if $servername == '' { $srvname = $name @@ -53,21 +53,21 @@ define apache::vhost( } if $ssl == true { - include apache::ssl + include httpd::ssl } # Since the template will use auth, redirect to https requires mod_rewrite if $redirect_ssl == true { case $::operatingsystem { 'debian','ubuntu': { - A2mod <| title == 'rewrite' |> + Httpd_mod <| title == 'rewrite' |> } default: { } } } file { "${priority}-${name}.conf": - path => "${apache::params::vdir}/${priority}-${name}.conf", + path => "${httpd::params::vdir}/${priority}-${name}.conf", content => template($template), owner => 'root', group => 'root', diff --git a/manifests/vhost/proxy.pp b/manifests/vhost/proxy.pp index cab545d..ea3720c 100644 --- a/manifests/vhost/proxy.pp +++ b/manifests/vhost/proxy.pp @@ -1,4 +1,4 @@ -# Define: apache::vhost::proxy +# Define: httpd::vhost::proxy # # Configures an apache vhost that will only proxy requests # @@ -18,29 +18,29 @@ # # Sample Usage: # -define apache::vhost::proxy ( +define httpd::vhost::proxy ( $port, $dest, $priority = '10', - $template = 'apache/vhost-proxy.conf.erb', + $template = 'httpd/vhost-proxy.conf.erb', $servername = '', $serveraliases = '', $ssl = false, $vhost_name = '*' ) { - include apache + include httpd - $apache_name = $apache::params::apache_name - $ssl_path = $apache::params::ssl_path + $apache_name = $httpd::params::apache_name + $ssl_path = $httpd::params::ssl_path $srvname = $name if $ssl == true { - include apache::ssl + include httpd::ssl } file { "${priority}-${name}": - path => "${apache::params::vdir}/${priority}-${name}", + path => "${httpd::params::vdir}/${priority}-${name}", content => template($template), owner => 'root', group => 'root', diff --git a/manifests/vhost/redirect.pp b/manifests/vhost/redirect.pp index 688d413..250d42a 100644 --- a/manifests/vhost/redirect.pp +++ b/manifests/vhost/redirect.pp @@ -1,4 +1,4 @@ -# Define: apache::vhost::redirect +# Define: httpd::vhost::redirect # # This class will create a vhost that does nothing more than redirect to a # given location @@ -17,21 +17,21 @@ # # Sample Usage: # -define apache::vhost::redirect ( +define httpd::vhost::redirect ( $port, $dest, $priority = '10', $serveraliases = '', - $template = 'apache/vhost-redirect.conf.erb', + $template = 'httpd/vhost-redirect.conf.erb', $vhost_name = '*' ) { - include apache + include httpd $srvname = $name file { "${priority}-${name}": - path => "${apache::params::vdir}/${priority}-${name}", + path => "${httpd::params::vdir}/${priority}-${name}", content => template($template), owner => 'root', group => 'root', diff --git a/templates/vhost-default.conf.erb b/templates/vhost-default.conf.erb index 3178f1f..c2365a9 100644 --- a/templates/vhost-default.conf.erb +++ b/templates/vhost-default.conf.erb @@ -1,5 +1,5 @@ # ************************************ -# Default template in module puppetlabs-apache +# Default template in module openstackci-httpd # Managed by Puppet # ************************************ @@ -18,9 +18,9 @@ NameVirtualHost <%= vhost_name %>:<%= port %> Order allow,deny allow from all - ErrorLog /var/log/<%= scope.lookupvar("apache::params::apache_name") %>/<%= name %>_error.log + ErrorLog /var/log/<%= scope.lookupvar("httpd::params::apache_name") %>/<%= name %>_error.log LogLevel warn - CustomLog /var/log/<%= scope.lookupvar("apache::params::apache_name") %>/<%= name %>_access.log combined + CustomLog /var/log/<%= scope.lookupvar("httpd::params::apache_name") %>/<%= name %>_access.log combined ServerSignature Off diff --git a/templates/vhost-proxy.conf.erb b/templates/vhost-proxy.conf.erb index 7bee3fb..4794af8 100644 --- a/templates/vhost-proxy.conf.erb +++ b/templates/vhost-proxy.conf.erb @@ -20,9 +20,9 @@ NameVirtualHost <%= vhost_name %>:<%= port %> ProxyPassReverse / <%= dest %>/ ProxyPreserveHost On - ErrorLog /var/log/<%= scope.lookupvar("apache::params::apache_name") %>/<%= name %>_error.log + ErrorLog /var/log/<%= scope.lookupvar("httpd::params::apache_name") %>/<%= name %>_error.log LogLevel warn - CustomLog /var/log/<%= scope.lookupvar("apache::params::apache_name") %>/<%= name %>_access.log combined + CustomLog /var/log/<%= scope.lookupvar("httpd::params::apache_name") %>/<%= name %>_access.log combined