iwasakims commented on code in PR #1263:
URL: https://github.com/apache/bigtop/pull/1263#discussion_r1609166400
##########
bigtop-deploy/puppet/manifests/python.pp:
##########
@@ -14,16 +14,57 @@
# limitations under the License.
class python {
- if (($operatingsystem == 'Ubuntu' and 0 <=
versioncmp($operatingsystemmajrelease, '22.04'))) {
- file { '/usr/bin/python':
- ensure => 'link',
- target => '/usr/bin/python2',
+
+ define set_python_alternatives($command) {
+ exec { $name:
+ command => $command,
+ unless => "/usr/sbin/update-alternatives --display python | grep
'/usr/bin/python3'",
+ path => ['/bin', '/usr/bin', '/sbin', '/usr/sbin'],
}
}
-
- if ($operatingsystem == 'openEuler') {
- package { 'python3-unversioned-command':
- ensure => 'present'
+
+ case $operatingsystem {
+ /(?i:(centos|fedora|redhat|rocky))/: {
+ package { 'python3-devel':
+ ensure => 'present',
+ }
+ if ($operatingsystem != 'Fedora') {
+ case $operatingsystemmajrelease {
+ '9': {
+ package { 'python-unversioned-command':
+ ensure => 'present',
+ }
+ }
+ '8': {
+ set_python_alternatives { 'set-python3':
+ command => '/usr/sbin/update-alternatives --set
python /usr/bin/python3',
+ }
Review Comment:
Thanks for the update, @JiaLiangC. The user defined resource can not be
resolved without quolifying with the class name like
`python::set_python_alternatives` on Puppet 6 used in Rocky Linux 8. I think we
can use plain `exec` if it is not used in other places.
```
Error: Evaluation Error: Error while evaluating a Resource Statement,
Unknown resource type: 'set_python_alternatives' (file:
/bigtop-home/bigtop-deploy/puppet/manifests/python.pp, line: 39, column: 25) on
node 70361087e339.bigtop.apache.org
```
In addition, evaluation of the resource is skipped because the unless
conditional is true even before updating alternatives.
```
[root@1ef2ea9dd4a9 /]# alternatives --display python
python - status is auto.
link currently points to /usr/libexec/no-python
/usr/libexec/no-python - priority 404
slave unversioned-python: (null)
slave unversioned-python-man: /usr/share/man/man1/unversioned-python.1.gz
/usr/bin/python3 - priority 300
slave unversioned-python: /usr/bin/python3
slave unversioned-python-man: /usr/share/man/man1/python3.1.gz
Current `best' version is /usr/libexec/no-python.
[root@1ef2ea9dd4a9 /]# /usr/sbin/update-alternatives --display python | grep
'/usr/bin/python3' && echo true
/usr/bin/python3 - priority 300
slave unversioned-python: /usr/bin/python3
true
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]