Skip to content

Commit dd58915

Browse files
authored
Add Rocky Linux Support (#39)
2 parents dded18f + acbaf1d commit dd58915

5 files changed

Lines changed: 17 additions & 15 deletions

File tree

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def run(self):
3333

3434
setuptools.setup(
3535
name='wavefront-cli',
36-
version='0.1.2',
36+
version='0.1.3',
3737
description='VMware Aria Operations for Applications CLI Utility.',
3838
long_description=long_description,
3939
url='https://github.com/wavefrontHQ/wavefront-cli',

sh/install.sh

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,18 +44,16 @@ function exit_with_failure() {
4444
}
4545

4646
function install_pkg() {
47-
dpkg -s $1 >> ${INSTALL_LOG} 2>&1
48-
49-
if [ $? -ne 0 ]; then
47+
if ! dpkg -s $1 >> ${INSTALL_LOG} 2>&1
48+
then
5049
echo "Installing $1 using apt-get"
5150
apt-get install $1 -y >> ${INSTALL_LOG} 2>&1
5251
fi
5352
}
5453

5554
function remove_pkg() {
56-
dpkg -s $1 >> ${INSTALL_LOG} 2>&1
57-
58-
if [ $? -eq 0 ]; then
55+
if ! dpkg -s $1 >> ${INSTALL_LOG} 2>&1
56+
then
5957
echo "Uninstalling $1 using apt-get"
6058
apt-get remove $1 -y >> ${INSTALL_LOG} 2>&1
6159
fi
@@ -68,6 +66,10 @@ function detect_operating_system() {
6866
echo -e "\ntest -f /etc/debian_version" >> ${INSTALL_LOG}
6967
echo "Debian/Ubuntu"
7068
OPERATING_SYSTEM="DEBIAN"
69+
elif [ -f /etc/rocky-release ]; then
70+
echo -e "\ntest -f /etc/rocky-release" >> ${INSTALL_LOG}
71+
echo "Rocky Linux"
72+
OPERATING_SYSTEM="ROCKY"
7173
elif [ -f /etc/redhat-release ] || [ -f /etc/system-release-cpe ]; then
7274
echo -e "\ntest -f /etc/redhat-release || test -f /etc/system-release-cpe" >> ${INSTALL_LOG}
7375
echo "RedHat/CentOS"
@@ -90,12 +92,11 @@ function detect_operating_system() {
9092
}
9193

9294
function install_python() {
93-
9495
if [ $OPERATING_SYSTEM == "DEBIAN" ]; then
9596
echo "Installing Python using apt-get"
9697
apt-get update >> ${INSTALL_LOG} 2>&1
9798
apt-get install python3 -y >> ${INSTALL_LOG} 2>&1
98-
elif [ $OPERATING_SYSTEM == "REDHAT" ]; then
99+
elif [ $OPERATING_SYSTEM == "REDHAT" ] || [ $OPERATING_SYSTEM == "ROCKY" ]; then
99100
echo "Installing Python using yum"
100101
yum install python3 -y >> ${INSTALL_LOG} 2>&1
101102
elif [ $OPERATING_SYSTEM == "openSUSE" ] || [ $OPERATING_SYSTEM == "SLE" ]; then
@@ -122,7 +123,7 @@ function remove_python() {
122123
echo "Uninstalling Python using apt-get"
123124
apt-get remove python3 -y &> ${INSTALL_LOG}
124125
apt-get autoremove -y &> ${INSTALL_LOG}
125-
elif [ $OPERATING_SYSTEM == "REDHAT" ]; then
126+
elif [ $OPERATING_SYSTEM == "REDHAT" ] || [ $OPERATING_SYSTEM == "ROCKY" ]; then
126127
echo "Uninstalling Python using yum"
127128
yum remove python3 -y &> ${INSTALL_LOG}
128129
elif [ $OPERATING_SYSTEM == "openSUSE" ] || [ $OPERATING_SYSTEM == "SLE" ]; then

wavefront_cli/lib/agent.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def get_install_agent_cmd():
2525

2626
cmd = "curl -s {} | bash && "
2727
if dist.strip().startswith(("Oracle Linux Server", "Fedora",
28-
"Amazon Linux", "CentOS",
28+
"Amazon Linux", "Rocky Linux", "CentOS",
2929
"Red Hat Enterprise Linux")):
3030
cmd = cmd.format(agent_pkg_rpm) + "yum -y -q install telegraf"
3131
elif dist.strip().startswith("Ubuntu"):

wavefront_cli/lib/proxy.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ def get_proxy_install_cmd(proxy_next):
3131
if proxy_next:
3232
message.print_bold("Using proxy-next option. This will"
3333
" install the latest beta version proxy.")
34-
3534
print("Detected ", dist)
3635

3736
cmd = "curl -s {pkg} | bash && "
3837
if dist.strip().startswith(("Oracle Linux Server", "Fedora",
3938
"Amazon Linux", "CentOS",
40-
"Red Hat Enterprise Linux")):
39+
"Red Hat Enterprise Linux",
40+
"Rocky Linux")):
4141
pkg = proxy_pkg_rpm
4242
if proxy_next:
4343
pkg = proxy_next_pkg_rpm
@@ -77,7 +77,7 @@ def install_proxy(proxy_next):
7777
return install_status
7878

7979

80-
# pylint: disable=too-many-arguments
80+
# pylint: disable=too-many-arguments, too-many-positional-arguments
8181
def configure_proxy(url, wavefront_api_token, csp_api_token=None,
8282
csp_app_id=None, csp_app_secret=None, csp_org_id=None):
8383
"""Configure wavefront proxy."""

wavefront_cli/lib/system.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,10 @@ def write_file(path, text):
6565

6666
def remove_service(service_name):
6767
"""Delete a service."""
68+
cmd = None
6869
dist = check_os()
6970
print("Detected ", dist)
70-
if dist.startswith("Amazon Linux") or\
71+
if dist.startswith(("Amazon Linux", "Rocky Linux")) or\
7172
dist == "Red Hat Enterprise Linux Server":
7273
cmd = "yum -y remove " + service_name
7374
elif dist == "Ubuntu":

0 commit comments

Comments
 (0)