From fc3f5bfbd38612bb74e1671db383a717b878deb2 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Fri, 7 Aug 2020 09:05:11 +0900 Subject: [PATCH] Implement a common class to manage apache service This patch introduces a new class, openstack_integration::apache, which can be used to manage apache service in ci jobs. Change-Id: I1d29662abe630f291fc4dbcb80d439d9e7388ce8 --- fixtures/scenario001.pp | 23 +---------------------- fixtures/scenario002.pp | 23 +---------------------- fixtures/scenario003.pp | 23 +---------------------- fixtures/scenario004.pp | 23 +---------------------- manifests/apache.pp | 27 +++++++++++++++++++++++++++ 5 files changed, 31 insertions(+), 88 deletions(-) create mode 100644 manifests/apache.pp diff --git a/fixtures/scenario001.pp b/fixtures/scenario001.pp index 26b1706cf..de6ad6f8b 100644 --- a/fixtures/scenario001.pp +++ b/fixtures/scenario001.pp @@ -14,28 +14,6 @@ # limitations under the License. # -if ($::os['family'] == 'Debian') { - $wsgi_mod_package = 'libapache2-mod-wsgi-py3' - $wsgi_mod_lib = 'mod_wsgi.so' -} -elsif ($::os['name'] == 'Fedora') or - ($::os['family'] == 'RedHat' and Integer.new($::os['release']['major']) > 7) { - $wsgi_mod_package = 'python3-mod_wsgi' - $wsgi_mod_lib = 'mod_wsgi_python3.so' -} -if ($::os['family'] == 'Debian') or ($::os['name'] == 'Fedora') or - ($::os['family'] == 'RedHat' and Integer.new($::os['release']['major']) > 7) { - include apache::params - class { 'apache': - mod_packages => merge($::apache::params::mod_packages, { - 'wsgi' => $wsgi_mod_package, - }), - mod_libs => merge($::apache::params::mod_libs, { - 'wsgi' => $wsgi_mod_lib, - }) - } -} - if ($::os['name'] == 'Ubuntu') or ($::os['name'] == 'Fedora') or ($::os['family'] == 'RedHat' and Integer.new($::os['release']['major']) > 7) { # FIXME(ykarel) Disable SSL until services are ready to work with SSL + Python3 @@ -84,6 +62,7 @@ class { 'openstack_integration::config': if $ssl { include openstack_integration::cacert } +include openstack_integration::apache include openstack_integration::memcached include openstack_integration::rabbitmq if ($om_rpc == 'amqp') { diff --git a/fixtures/scenario002.pp b/fixtures/scenario002.pp index 2e9fe4d7a..c9f33ffbb 100644 --- a/fixtures/scenario002.pp +++ b/fixtures/scenario002.pp @@ -14,28 +14,6 @@ # limitations under the License. # -if ($::os['family'] == 'Debian') { - $wsgi_mod_package = 'libapache2-mod-wsgi-py3' - $wsgi_mod_lib = 'mod_wsgi.so' -} -elsif ($::os['name'] == 'Fedora') or - ($::os['family'] == 'RedHat' and Integer.new($::os['release']['major']) > 7) { - $wsgi_mod_package = 'python3-mod_wsgi' - $wsgi_mod_lib = 'mod_wsgi_python3.so' -} -if ($::os['family'] == 'Debian') or ($::os['name'] == 'Fedora') or - ($::os['family'] == 'RedHat' and Integer.new($::os['release']['major']) > 7) { - include apache::params - class { 'apache': - mod_packages => merge($::apache::params::mod_packages, { - 'wsgi' => $wsgi_mod_package, - }), - mod_libs => merge($::apache::params::mod_libs, { - 'wsgi' => $wsgi_mod_lib, - }) - } -} - if ($::os['name'] == 'Ubuntu') or ($::os['name'] == 'Fedora') or ($::os['family'] == 'RedHat' and Integer.new($::os['release']['major']) > 7) { # FIXME(ykarel) Disable SSL until services are ready to work with SSL + Python3 @@ -67,6 +45,7 @@ class { 'openstack_integration::config': if $ssl { include openstack_integration::cacert } +include openstack_integration::apache include openstack_integration::memcached include openstack_integration::rabbitmq include openstack_integration::mysql diff --git a/fixtures/scenario003.pp b/fixtures/scenario003.pp index 9b6938eb8..deeb7b7eb 100644 --- a/fixtures/scenario003.pp +++ b/fixtures/scenario003.pp @@ -14,28 +14,6 @@ # limitations under the License. # -if ($::os['family'] == 'Debian') { - $wsgi_mod_package = 'libapache2-mod-wsgi-py3' - $wsgi_mod_lib = 'mod_wsgi.so' -} -elsif ($::os['name'] == 'Fedora') or - ($::os['family'] == 'RedHat' and Integer.new($::os['release']['major']) > 7) { - $wsgi_mod_package = 'python3-mod_wsgi' - $wsgi_mod_lib = 'mod_wsgi_python3.so' -} -if ($::os['family'] == 'Debian') or ($::os['name'] == 'Fedora') or - ($::os['family'] == 'RedHat' and Integer.new($::os['release']['major']) > 7) { - include apache::params - class { 'apache': - mod_packages => merge($::apache::params::mod_packages, { - 'wsgi' => $wsgi_mod_package, - }), - mod_libs => merge($::apache::params::mod_libs, { - 'wsgi' => $wsgi_mod_lib, - }) - } -} - if ($::os['name'] == 'Ubuntu') or ($::os['name'] == 'Fedora') or ($::os['family'] == 'RedHat' and Integer.new($::os['release']['major']) > 7) { # FIXME(ykarel) Disable SSL until services are ready to work with SSL + Python3 @@ -92,6 +70,7 @@ class { 'openstack_integration::config': if $ssl { include openstack_integration::cacert } +include openstack_integration::apache include openstack_integration::memcached include openstack_integration::rabbitmq include openstack_integration::mysql diff --git a/fixtures/scenario004.pp b/fixtures/scenario004.pp index ed6c2d586..b569f49aa 100644 --- a/fixtures/scenario004.pp +++ b/fixtures/scenario004.pp @@ -14,28 +14,6 @@ # limitations under the License. # -if ($::os['family'] == 'Debian') { - $wsgi_mod_package = 'libapache2-mod-wsgi-py3' - $wsgi_mod_lib = 'mod_wsgi.so' -} -elsif ($::os['name'] == 'Fedora') or - ($::os['family'] == 'RedHat' and Integer.new($::os['release']['major']) > 7) { - $wsgi_mod_package = 'python3-mod_wsgi' - $wsgi_mod_lib = 'mod_wsgi_python3.so' -} -if ($::os['family'] == 'Debian') or ($::os['name'] == 'Fedora') or - ($::os['family'] == 'RedHat' and Integer.new($::os['release']['major']) > 7) { - include apache::params - class { 'apache': - mod_packages => merge($::apache::params::mod_packages, { - 'wsgi' => $wsgi_mod_package, - }), - mod_libs => merge($::apache::params::mod_libs, { - 'wsgi' => $wsgi_mod_lib, - }) - } -} - if ($::os['name'] == 'Ubuntu') or ($::os['name'] == 'Fedora') or ($::os['family'] == 'RedHat' and Integer.new($::os['release']['major']) > 7) { # FIXME(ykarel) Disable SSL until services are ready to work with SSL + Python3 @@ -80,6 +58,7 @@ class { 'openstack_integration::config': if $ssl { include openstack_integration::cacert } +include openstack_integration::apache include openstack_integration::memcached include openstack_integration::rabbitmq include openstack_integration::mysql diff --git a/manifests/apache.pp b/manifests/apache.pp new file mode 100644 index 000000000..f704129a2 --- /dev/null +++ b/manifests/apache.pp @@ -0,0 +1,27 @@ +class openstack_integration::apache { + + include openstack_integration::params + include openstack_integration::config + + if ($::os['family'] == 'Debian') { + $wsgi_mod_package = 'libapache2-mod-wsgi-py3' + $wsgi_mod_lib = 'mod_wsgi.so' + } + elsif ($::os['name'] == 'Fedora') or + ($::os['family'] == 'RedHat' and Integer.new($::os['release']['major']) > 7) { + $wsgi_mod_package = 'python3-mod_wsgi' + $wsgi_mod_lib = 'mod_wsgi_python3.so' + } + if ($::os['family'] == 'Debian') or ($::os['name'] == 'Fedora') or + ($::os['family'] == 'RedHat' and Integer.new($::os['release']['major']) > 7) { + include apache::params + class { 'apache': + mod_packages => merge($::apache::params::mod_packages, { + 'wsgi' => $wsgi_mod_package, + }), + mod_libs => merge($::apache::params::mod_libs, { + 'wsgi' => $wsgi_mod_lib, + }) + } + } +}