From e77cead2ef9f3669b9dbd65229f4c01e28d13615 Mon Sep 17 00:00:00 2001
From: Tobias Urdin <tobias.urdin@binero.se>
Date: Sat, 24 Nov 2018 14:15:03 +0100
Subject: [PATCH] Remove ceph::rgw::apache_fastcgi

This class has been deprecated since many
releases back.

Change-Id: Ia6c2a3aa09ce8fd5a6d9c7c687c98134f27bbeb9
---
 manifests/rgw/apache_fastcgi.pp               | 164 ------------------
 .../notes/remove-fcgi-f5651dfd6538fdd3.yaml   |   4 +
 spec/defines/ceph_rgw_apache_fastcgi_spec.rb  | 141 ---------------
 spec/defines/ceph_rgw_keystone_spec.rb        |  15 +-
 4 files changed, 10 insertions(+), 314 deletions(-)
 delete mode 100644 manifests/rgw/apache_fastcgi.pp
 create mode 100644 releasenotes/notes/remove-fcgi-f5651dfd6538fdd3.yaml
 delete mode 100644 spec/defines/ceph_rgw_apache_fastcgi_spec.rb

diff --git a/manifests/rgw/apache_fastcgi.pp b/manifests/rgw/apache_fastcgi.pp
deleted file mode 100644
index 82458bda..00000000
--- a/manifests/rgw/apache_fastcgi.pp
+++ /dev/null
@@ -1,164 +0,0 @@
-#
-# Copyright (C) 2014 Catalyst IT Limited.
-#
-#   Licensed under the Apache License, Version 2.0 (the "License");
-#   you may not use this file except in compliance with the License.
-#   You may obtain a copy of the License at
-#
-#       http://www.apache.org/licenses/LICENSE-2.0
-#
-#   Unless required by applicable law or agreed to in writing, software
-#   distributed under the License is distributed on an "AS IS" BASIS,
-#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-#   See the License for the specific language governing permissions and
-#   limitations under the License.
-#
-# Author: Ricardo Rocha <ricardo@catalyst.net.nz>
-#
-# Configures a ceph radosgw apache frontend with mod_fastcgi.
-#
-## == Define: ceph::rgw::apache_fastcgi
-#
-# The RGW id. An alphanumeric string uniquely identifying the RGW.
-# ( example: radosgw.gateway )
-#
-### == Parameters
-#
-# [*admin_email*] Admin email for the radosgw reports.
-#   Optional. Default is 'root@localhost'.
-#
-# [*docroot*] Location of the apache docroot.
-#   Optional. Default is '/var/www'.
-#
-# [*fcgi_file*] Path to the fcgi file.
-#   Optional. Default is '/var/www/s3gw.cgi'.
-#
-# [*rgw_port*] Port the rados gateway listens.
-#   Optional. Default is 80.
-#
-# [*rgw_dns_name*] Hostname to use for the service.
-#   Optional. Default is $fqdn.
-#
-# [*rgw_socket_path*] Path to socket file.
-#   Optional. Default is '/tmp/radosgw.sock'.
-#
-# [*syslog*] Whether or not to log to syslog.
-#   Optional. Default is true.
-#
-# [*ceph_apache_repo*] Whether to require the CEPH apache repo (ceph::repo::fastcgi).
-#   Optional. Default is true. Check:
-#   http://docs.ceph.com/docs/master/install/install-ceph-gateway/
-#   for more info on repository recommendations.
-#
-# [*apache_mods*] Whether to configure and enable a set of default Apache modules.
-#   Optional. Defaults to false.
-#
-# [*apache_vhost*] Configures a default virtual host.
-#   Optional. Defaults to false.
-#
-# [*apache_purge_configs*] Removes all other Apache configs and virtual hosts.
-#   Optional. Defaults to true.
-#
-# [*apache_purge_vhost*] Whether to remove any configurations inside vhost_dir not managed
-#   by Puppet.
-#   Optional. Defaults to true.
-#
-# [*custom_apache_ports*] Array of ports to listen by Apache.
-#   Optional. Works only if custom_apache set to true. Default is undef.
-#
-define ceph::rgw::apache_fastcgi (
-  $admin_email          = 'root@localhost',
-  $docroot              = '/var/www',
-  $fcgi_file            = '/var/www/s3gw.fcgi',
-  $rgw_dns_name         = $::fqdn,
-  $rgw_port             = '80',
-  $rgw_socket_path      = $::ceph::params::rgw_socket_path,
-  $syslog               = true,
-  $ceph_apache_repo     = true,
-  $apache_mods          = false,
-  $apache_vhost         = false,
-  $apache_purge_configs = true,
-  $apache_purge_vhost   = true,
-  $custom_apache_ports  = undef,
-) {
-
-  warning ('apache_fastcgi is depricated and will be removed in two releases (P+2)')
-  class { '::apache':
-    default_mods    => $apache_mods,
-    default_vhost   => $apache_vhost,
-    purge_configs   => $apache_purge_configs,
-    purge_vhost_dir => $apache_purge_vhost,
-  }
-
-  if $custom_apache_ports {
-    apache::listen { $custom_apache_ports: }
-  }
-
-  if !$apache_mods {
-    include ::apache::mod::auth_basic
-  }
-
-  include ::apache::mod::alias
-  include ::apache::mod::mime
-  include ::apache::mod::rewrite
-
-  #Rewrite rule
-  #Variable name shrunk in favor of not having
-  #more than 140 chars per line
-  $rr = '^/([a-zA-Z0-9-_.]*)([/]?.*) /s3gw.fcgi?page=$1&params=$2&%{QUERY_STRING} [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]'
-
-  apache::vhost { "${rgw_dns_name}-radosgw":
-    servername     => $rgw_dns_name,
-    serveradmin    => $admin_email,
-    port           => $rgw_port,
-    docroot        => $docroot,
-    rewrite_rule   => $rr,
-    access_log     => $syslog,
-    error_log      => $syslog,
-    fastcgi_server => $fcgi_file,
-    fastcgi_socket => $rgw_socket_path,
-    fastcgi_dir    => $docroot,
-  }
-
-  # radosgw fast-cgi script
-  file { $fcgi_file:
-    ensure  => file,
-    owner   => 'root',
-    group   => 'root',
-    mode    => '0750',
-    content => "#!/bin/sh
-exec /usr/bin/radosgw -c /etc/ceph/ceph.conf -n ${name}",
-  }
-
-  File[$fcgi_file]
-  ~> Service['httpd']
-
-  # dependency on ceph apache repo if set
-  $pkg_fastcgi = $::apache::params::mod_packages['fastcgi']
-  if $ceph_apache_repo {
-    case $::osfamily {
-      'Debian': {
-        Apt::Source['ceph-fastcgi']
-        -> Package[$pkg_fastcgi]
-      }
-      'RedHat': {
-        if ($::osfamily == 'Redhat' and versioncmp($::operatingsystemrelease, '7.0') >= 0)
-        {
-          warning('puppetlabs puppet-apache dropped support for fastcgi on EL7')
-          $pkg_fastcgi_real = 'mod_fastcgi'
-        }
-        else
-        {
-          $pkg_fastcgi_real = $pkg_fastcgi
-        }
-        Yumrepo['ext-ceph-fastcgi']
-        -> Package[$pkg_fastcgi_real]
-      }
-      default: {
-        fail("Unsupported osfamily: ${::osfamily} operatingsystem: ${::operatingsystem}, \
-module ${module_name} only supports osfamily Debian and RedHat")
-      }
-    }
-  }
-
-}
diff --git a/releasenotes/notes/remove-fcgi-f5651dfd6538fdd3.yaml b/releasenotes/notes/remove-fcgi-f5651dfd6538fdd3.yaml
new file mode 100644
index 00000000..0d5053fa
--- /dev/null
+++ b/releasenotes/notes/remove-fcgi-f5651dfd6538fdd3.yaml
@@ -0,0 +1,4 @@
+---
+upgrade:
+  - |
+    The deprecated class ceph::rgw::apache_fastcgi is now removed.
diff --git a/spec/defines/ceph_rgw_apache_fastcgi_spec.rb b/spec/defines/ceph_rgw_apache_fastcgi_spec.rb
deleted file mode 100644
index 57bbf78c..00000000
--- a/spec/defines/ceph_rgw_apache_fastcgi_spec.rb
+++ /dev/null
@@ -1,141 +0,0 @@
-#
-# Copyright (C) 2014 Catalyst IT Limited.
-#
-#   Licensed under the Apache License, Version 2.0 (the "License");
-#   you may not use this file except in compliance with the License.
-#   You may obtain a copy of the License at
-#
-#       http://www.apache.org/licenses/LICENSE-2.0
-#
-#   Unless required by applicable law or agreed to in writing, software
-#   distributed under the License is distributed on an "AS IS" BASIS,
-#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-#   See the License for the specific language governing permissions and
-#   limitations under the License.
-#
-# Author: Ricardo Rocha <ricardo@catalyst.net.nz>
-# Author: David Gurtner <aldavud@crimson.ch>
-#
-require 'spec_helper'
-
-describe 'ceph::rgw::apache_fastcgi' do
-
-  let :pre_condition do
-    "include ceph::params
-     class { 'ceph::repo':
-       fastcgi => true,
-     }"
-  end
-
-  describe 'Debian Family' do
-
-    let :facts do
-      {
-        :concat_basedir         => '/var/lib/puppet/concat',
-        :fqdn                   => 'myhost.domain',
-        :hostname               => 'myhost',
-        :osfamily               => 'Debian',
-        :operatingsystem        => 'Ubuntu',
-        :lsbdistid              => 'Ubuntu',
-        :operatingsystemrelease => '14.04',
-        :lsbdistrelease         => '14.04',
-        :lsbdistcodename        => 'trusty',
-        :pkg_fastcgi            => 'libapache2-mod-fastcgi',
-      }
-    end
-
-    describe 'activated with default params' do
-
-      let :title do
-        'radosgw.gateway'
-      end
-
-      it { is_expected.to contain_apache__vhost('myhost.domain-radosgw').with( {
-        'servername'        => 'myhost.domain',
-        'serveradmin'       => 'root@localhost',
-        'port'              => 80,
-        'docroot'           => '/var/www',
-        'rewrite_rule'      => '^/([a-zA-Z0-9-_.]*)([/]?.*) /s3gw.fcgi?page=$1&params=$2&%{QUERY_STRING} [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]',
-        'access_log'        => true,
-        'error_log'         => true,
-        'fastcgi_server'    => '/var/www/s3gw.fcgi',
-        'fastcgi_socket'    => '/tmp/radosgw.sock',
-        'fastcgi_dir'       => '/var/www',
-      })}
-
-      it { is_expected.to contain_class('apache').with(
-        'default_mods'    => false,
-        'default_vhost'   => false,
-        'purge_configs'   => true,
-        'purge_vhost_dir' => true,
-      )}
-      it { is_expected.to contain_class('apache::mod::alias') }
-      it { is_expected.to contain_class('apache::mod::auth_basic') }
-      it { is_expected.to contain_class('apache::mod::fastcgi') }
-      it { is_expected.to contain_class('apache::mod::mime') }
-      it { is_expected.to contain_class('apache::mod::rewrite') }
-
-      it { is_expected.to contain_file('/var/www/s3gw.fcgi').with({
-        'ensure'  => 'file',
-        'owner'   => 'root',
-        'group'   => 'root',
-        'mode'    => '0750',
-        'content' => "#!/bin/sh
-exec /usr/bin/radosgw -c /etc/ceph/ceph.conf -n radosgw.gateway",
-      })}
-
-    end
-
-    describe "activated with custom params" do
-
-      let :title do
-        'myid'
-      end
-
-      let :params do
-        {
-          :rgw_dns_name         => 'mydns.hostname',
-          :rgw_socket_path      => '/some/location/radosgw.sock',
-          :rgw_port             => 1111,
-          :admin_email          => 'admin@hostname',
-          :fcgi_file            => '/some/fcgi/filepath',
-          :syslog               => false,
-          :apache_mods          => true,
-          :apache_vhost         => true,
-          :apache_purge_configs => false,
-          :apache_purge_vhost   => false,
-          :custom_apache_ports  => '8888',
-        }
-      end
-
-      it { is_expected.to contain_apache__vhost('mydns.hostname-radosgw').with( {
-        'servername'        => 'mydns.hostname',
-        'serveradmin'       => 'admin@hostname',
-        'port'              => 1111,
-        'docroot'           => '/var/www',
-        'rewrite_rule'      => '^/([a-zA-Z0-9-_.]*)([/]?.*) /s3gw.fcgi?page=$1&params=$2&%{QUERY_STRING} [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]',
-        'access_log'        => false,
-        'error_log'         => false,
-        'fastcgi_server'    => '/some/fcgi/filepath',
-        'fastcgi_socket'    => '/some/location/radosgw.sock',
-        'fastcgi_dir'       => '/var/www',
-      } ) }
-
-      it { is_expected.to contain_class('apache').with(
-        'default_mods'    => true,
-        'default_vhost'   => true,
-        'purge_configs'   => false,
-        'purge_vhost_dir' => false,
-      )}
-      it { is_expected.to contain_apache__listen('8888') }
-      it { is_expected.to contain_class('apache::mod::alias') }
-      it { is_expected.to contain_class('apache::mod::fastcgi') }
-      it { is_expected.to contain_class('apache::mod::mime') }
-      it { is_expected.to contain_class('apache::mod::rewrite') }
-
-      it { is_expected.to contain_file('/some/fcgi/filepath') }
-
-    end
-  end
-
-end
diff --git a/spec/defines/ceph_rgw_keystone_spec.rb b/spec/defines/ceph_rgw_keystone_spec.rb
index 109bc8a9..cd6bfa62 100644
--- a/spec/defines/ceph_rgw_keystone_spec.rb
+++ b/spec/defines/ceph_rgw_keystone_spec.rb
@@ -32,10 +32,9 @@ describe 'ceph::rgw::keystone' do
       let :pre_condition do
         "include ceph::params
          class { 'ceph': fsid => 'd5252e7d-75bc-4083-85ed-fe51fa83f62b' }
-         class { 'ceph::repo': fastcgi => true, }
+         class { 'ceph::repo': }
          include ceph
-         ceph::rgw { 'radosgw.gateway': }
-         ceph::rgw::apache_fastcgi { 'radosgw.gateway': }"
+         ceph::rgw { 'radosgw.gateway': }"
       end
 
       let :title do
@@ -80,9 +79,8 @@ wget --no-check-certificate http://keystone.default:5000/v2.0/certificates/signi
       let :pre_condition do
         "include ceph::params
          class { 'ceph': fsid => 'd5252e7d-75bc-4083-85ed-fe51fa83f62b' }
-         class { 'ceph::repo': fastcgi => true, }
-         ceph::rgw { 'radosgw.custom': }
-         ceph::rgw::apache_fastcgi { 'radosgw.custom': }"
+         class { 'ceph::repo': }
+         ceph::rgw { 'radosgw.custom': }"
       end
 
       let :title do
@@ -135,10 +133,9 @@ wget --no-check-certificate http://keystone.custom:5000/v2.0/certificates/signin
       let :pre_condition do
         "include ceph::params
          class { 'ceph': fsid => 'd5252e7d-75bc-4083-85ed-fe51fa83f62b' }
-         class { 'ceph::repo': fastcgi => true, }
+         class { 'ceph::repo': }
          include ceph
-         ceph::rgw { 'radosgw.gateway': }
-         ceph::rgw::apache_fastcgi { 'radosgw.gateway': }"
+         ceph::rgw { 'radosgw.gateway': }"
       end
 
       let :title do