|
2 | 2 |
|
3 | 3 | get_linux_distributor(){ |
4 | 4 | #### Using python -mplatform command to get distributor name ##### |
5 | | - if ( python -mplatform || /usr/libexec/platform-python -mplatform ) | grep centos > /dev/null; then |
| 5 | + if ( python -mplatform || /usr/libexec/platform-python -mplatform || cat /etc/os-release) | grep centos > /dev/null; then |
6 | 6 | linux_distributor='centos' |
7 | | - elif ( python -mplatform || /usr/libexec/platform-python -mplatform ) | grep Ubuntu > /dev/null; then |
| 7 | + elif ( python -mplatform || cat /etc/os-release ) | grep Ubuntu > /dev/null; then |
8 | 8 | linux_distributor='ubuntu' |
9 | | - elif ( python -mplatform || /usr/libexec/platform-python -mplatform ) | grep debian > /dev/null; then |
| 9 | + elif ( python -mplatform || cat /etc/os-release ) | grep debian > /dev/null; then |
10 | 10 | linux_distributor='debian' |
11 | | - elif ( python -mplatform || /usr/libexec/platform-python -mplatform ) | grep redhat > /dev/null; then |
| 11 | + elif ( python -mplatform || /usr/libexec/platform-python -mplatform || cat /etc/os-release ) | grep redhat > /dev/null; then |
12 | 12 | linux_distributor='rhel' |
13 | | - elif ( python -mplatform || /usr/libexec/platform-python -mplatform ) | grep -E -i "linux.*oracle" > /dev/null; then |
| 13 | + elif ( python -mplatform || /usr/libexec/platform-python -mplatform || cat /etc/os-release ) | grep -E -i "linux.*oracle" > /dev/null; then |
14 | 14 | linux_distributor='linuxoracle' |
15 | 15 | fi |
16 | 16 | echo "${linux_distributor}" |
@@ -108,8 +108,8 @@ get_file_path_to_parse_env_variables(){ |
108 | 108 | # Execute parse_env_variables.py file to fetch values of `environment_variables` from 0.setting files |
109 | 109 | export_env_vars() { |
110 | 110 | config_file_name=$1 |
111 | | - if ( python -mplatform || /usr/libexec/platform-python -mplatform ) | grep "redhat-8" > /dev/null; then |
112 | | - commands="`/usr/libexec/platform-python $path_to_parse_env_variables \"$config_file_name\"`" |
| 111 | + if ( command -v python3) &> /dev/null;then |
| 112 | + commands="`python3 $path_to_parse_env_variables \"$config_file_name\"`" |
113 | 113 | else |
114 | 114 | commands="`python $path_to_parse_env_variables \"$config_file_name\"`" |
115 | 115 | fi |
|
0 commit comments