This is an automated email from the ASF dual-hosted git repository.

iwasakims pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/bigtop.git


The following commit(s) were added to refs/heads/master by this push:
     new 6cc67dc86 BIGTOP-4148. Replace adding repo in puppetize.sh with puppet 
manifest (#1283)
6cc67dc86 is described below

commit 6cc67dc860a7ceb4c4d40f96dd2009b1be33a302
Author: masatana <[email protected]>
AuthorDate: Thu Jul 11 10:51:18 2024 +0900

    BIGTOP-4148. Replace adding repo in puppetize.sh with puppet manifest 
(#1283)
---
 bigtop-deploy/puppet/manifests/jdk.pp     |  1 +
 bigtop-deploy/puppet/manifests/python.pp  |  1 +
 bigtop-deploy/puppet/manifests/yumrepo.pp | 47 +++++++++++++++++++++++++++++++
 bigtop_toolchain/bin/puppetize.sh         |  6 ----
 bigtop_toolchain/manifests/packages.pp    | 31 ++++++++++++++++++++
 5 files changed, 80 insertions(+), 6 deletions(-)

diff --git a/bigtop-deploy/puppet/manifests/jdk.pp 
b/bigtop-deploy/puppet/manifests/jdk.pp
index fea19a5a4..bf2c60442 100644
--- a/bigtop-deploy/puppet/manifests/jdk.pp
+++ b/bigtop-deploy/puppet/manifests/jdk.pp
@@ -42,6 +42,7 @@ class jdk {
       }
     }
     /(CentOS|Amazon|Fedora|RedHat|Rocky|openEuler)/: {
+      require yumrepo
       package { 'jdk':
         name => 'java-1.8.0-openjdk-devel',
         ensure => present,
diff --git a/bigtop-deploy/puppet/manifests/python.pp 
b/bigtop-deploy/puppet/manifests/python.pp
index 076c3f4ad..25a42e2d0 100644
--- a/bigtop-deploy/puppet/manifests/python.pp
+++ b/bigtop-deploy/puppet/manifests/python.pp
@@ -16,6 +16,7 @@
 class python {
     case $operatingsystem {
         /(?i:(centos|fedora|redhat|rocky))/: {
+            require yumrepo
             package { 'python3-devel':
               ensure => 'present',
             }
diff --git a/bigtop-deploy/puppet/manifests/yumrepo.pp 
b/bigtop-deploy/puppet/manifests/yumrepo.pp
new file mode 100644
index 000000000..ecd80ebca
--- /dev/null
+++ b/bigtop-deploy/puppet/manifests/yumrepo.pp
@@ -0,0 +1,47 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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.
+
+class yumrepo {
+  case $::operatingsystem {
+    /(Rocky)/: {
+      package { 'epel-release':
+        ensure => installed,
+      } 
+      if versioncmp($operatingsystemmajrelease, '8') == 0 {
+        # On Rocky 8, EPEL requires that the PowerTools repository is enabled.
+        # See 
https://fedoraproject.org/wiki/EPEL#How_can_I_use_these_extra_packages.3F
+        yumrepo { 'powertools':
+          ensure  => 'present',
+          enabled => '1'
+        }
+        yumrepo { 'devel':
+          ensure  => 'present',
+          enabled => '1'
+        }
+      }
+      if versioncmp($operatingsystemmajrelease, '9') == 0 {
+        # On Rocky 9, EPEL requires that the crb repository is enabled.
+        yumrepo { 'crb':
+          ensure  => 'present',
+          enabled => '1'
+        }
+        yumrepo { 'devel':
+          ensure  => 'present',
+          enabled => '1'
+        }
+      }
+    }
+  }
+}
diff --git a/bigtop_toolchain/bin/puppetize.sh 
b/bigtop_toolchain/bin/puppetize.sh
index bffd846bc..a23b07600 100755
--- a/bigtop_toolchain/bin/puppetize.sh
+++ b/bigtop_toolchain/bin/puppetize.sh
@@ -58,9 +58,6 @@ case ${ID}-${VERSION_ID} in
         dnf -y install glibc-langpack-en hostname diffutils curl sudo unzip 
wget puppet procps-ng 'dnf-command(config-manager)'
         # Install the module in the same way as Fedora 31 and CentOS 7 for 
compatibility issues.
         puppet module install puppetlabs-stdlib --version 4.12.0
-        # Enabling the PowerTools and EPEL repositories via Puppet doesn't 
seem to work in some cases.
-        # As a workaround for that, enable the former here in advance of 
running the Puppet manifests.
-        dnf config-manager --set-enabled powertools devel
         ;;
     rocky-9*)
         rpm -ivh 
https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm
@@ -68,9 +65,6 @@ case ${ID}-${VERSION_ID} in
         dnf -y install glibc-langpack-en hostname diffutils sudo unzip wget 
puppet procps-ng 'dnf-command(config-manager)'
         # Install the module in the same way as Fedora 31 and CentOS 7 for 
compatibility issues.
         puppet module install puppetlabs-stdlib --version 4.12.0
-        # Enabling the PowerTools and EPEL repositories via Puppet doesn't 
seem to work in some cases.
-        # As a workaround for that, enable the former here in advance of 
running the Puppet manifests.
-        dnf config-manager --set-enabled crb devel
         ;;
     rhel-8*)
         rpm -Uvh https://yum.puppet.com/puppet5-release-el-8.noarch.rpm
diff --git a/bigtop_toolchain/manifests/packages.pp 
b/bigtop_toolchain/manifests/packages.pp
index 3fd5abe6a..3a495d9ea 100644
--- a/bigtop_toolchain/manifests/packages.pp
+++ b/bigtop_toolchain/manifests/packages.pp
@@ -348,6 +348,37 @@ class bigtop_toolchain::packages {
       }
     }
   }
+  if $operatingsystem == 'Rocky' {
+    package { 'epel-release':
+      ensure => installed,
+      notify => Package[$pkgs]
+    }
+    if versioncmp($operatingsystemmajrelease, '8') == 0 {
+      # On Rocky 8, EPEL requires that the PowerTools repository is enabled.
+      # See 
https://fedoraproject.org/wiki/EPEL#How_can_I_use_these_extra_packages.3F
+      yumrepo { 'powertools':
+        ensure  => 'present',
+        enabled => '1'
+      }
+      yumrepo { 'devel':
+        ensure  => 'present',
+        enabled => '1'
+      }
+      Yumrepo<||> -> Package<||>
+    }
+    if versioncmp($operatingsystemmajrelease, '9') == 0 {
+      # On Rocky 9, EPEL requires that the crb repository is enabled.
+      yumrepo { 'crb':
+        ensure  => 'present',
+        enabled => '1'
+      }
+      yumrepo { 'devel':
+        ensure  => 'present',
+        enabled => '1'
+      }
+      Yumrepo<||> -> Package<||>
+    }
+  }
 
 
   if $osfamily == 'RedHat' {

Reply via email to