From 798b3bde38b8a054596919d9828c682c4f742b20 Mon Sep 17 00:00:00 2001 From: Joanna Ko Date: Tue, 15 Apr 2025 13:50:16 -0700 Subject: [PATCH 1/6] Add Rocky Linux Support --- sh/install.sh | 19 ++++++++++--------- wavefront_cli/lib/agent.py | 2 +- wavefront_cli/lib/proxy.py | 4 ++-- wavefront_cli/lib/system.py | 1 + 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/sh/install.sh b/sh/install.sh index 92f850f..f782c53 100755 --- a/sh/install.sh +++ b/sh/install.sh @@ -44,18 +44,16 @@ function exit_with_failure() { } function install_pkg() { - dpkg -s $1 >> ${INSTALL_LOG} 2>&1 - - if [ $? -ne 0 ]; then + if ! dpkg -s $1 >> ${INSTALL_LOG} 2>&1 + then echo "Installing $1 using apt-get" apt-get install $1 -y >> ${INSTALL_LOG} 2>&1 fi } function remove_pkg() { - dpkg -s $1 >> ${INSTALL_LOG} 2>&1 - - if [ $? -eq 0 ]; then + if ! dpkg -s $1 >> ${INSTALL_LOG} 2>&1 + then echo "Uninstalling $1 using apt-get" apt-get remove $1 -y >> ${INSTALL_LOG} 2>&1 fi @@ -68,6 +66,10 @@ function detect_operating_system() { echo -e "\ntest -f /etc/debian_version" >> ${INSTALL_LOG} echo "Debian/Ubuntu" OPERATING_SYSTEM="DEBIAN" + elif [ -f /etc/rocky-release ]; then + echo -e "\ntest -f /etc/rocky-release" >> ${INSTALL_LOG} + echo "Rocky Linux" + OPERATING_SYSTEM="ROCKY" elif [ -f /etc/redhat-release ] || [ -f /etc/system-release-cpe ]; then echo -e "\ntest -f /etc/redhat-release || test -f /etc/system-release-cpe" >> ${INSTALL_LOG} echo "RedHat/CentOS" @@ -90,12 +92,11 @@ function detect_operating_system() { } function install_python() { - if [ $OPERATING_SYSTEM == "DEBIAN" ]; then echo "Installing Python using apt-get" apt-get update >> ${INSTALL_LOG} 2>&1 apt-get install python3 -y >> ${INSTALL_LOG} 2>&1 - elif [ $OPERATING_SYSTEM == "REDHAT" ]; then + elif [ $OPERATING_SYSTEM == "REDHAT" ] || [ $OPERATING_SYSTEM == "ROCKY" ]; then echo "Installing Python using yum" yum install python3 -y >> ${INSTALL_LOG} 2>&1 elif [ $OPERATING_SYSTEM == "openSUSE" ] || [ $OPERATING_SYSTEM == "SLE" ]; then @@ -122,7 +123,7 @@ function remove_python() { echo "Uninstalling Python using apt-get" apt-get remove python3 -y &> ${INSTALL_LOG} apt-get autoremove -y &> ${INSTALL_LOG} - elif [ $OPERATING_SYSTEM == "REDHAT" ]; then + elif [ $OPERATING_SYSTEM == "REDHAT" ] || [ $OPERATING_SYSTEM == "ROCKY" ]; then echo "Uninstalling Python using yum" yum remove python3 -y &> ${INSTALL_LOG} elif [ $OPERATING_SYSTEM == "openSUSE" ] || [ $OPERATING_SYSTEM == "SLE" ]; then diff --git a/wavefront_cli/lib/agent.py b/wavefront_cli/lib/agent.py index c907a8f..df1b988 100644 --- a/wavefront_cli/lib/agent.py +++ b/wavefront_cli/lib/agent.py @@ -25,7 +25,7 @@ def get_install_agent_cmd(): cmd = "curl -s {} | bash && " if dist.strip().startswith(("Oracle Linux Server", "Fedora", - "Amazon Linux", "CentOS", + "Amazon Linux", "Rocky Linux", "CentOS", "Red Hat Enterprise Linux")): cmd = cmd.format(agent_pkg_rpm) + "yum -y -q install telegraf" elif dist.strip().startswith("Ubuntu"): diff --git a/wavefront_cli/lib/proxy.py b/wavefront_cli/lib/proxy.py index d7f3049..4577a8a 100644 --- a/wavefront_cli/lib/proxy.py +++ b/wavefront_cli/lib/proxy.py @@ -31,13 +31,13 @@ def get_proxy_install_cmd(proxy_next): if proxy_next: message.print_bold("Using proxy-next option. This will" " install the latest beta version proxy.") - print("Detected ", dist) cmd = "curl -s {pkg} | bash && " if dist.strip().startswith(("Oracle Linux Server", "Fedora", "Amazon Linux", "CentOS", - "Red Hat Enterprise Linux")): + "Red Hat Enterprise Linux", + "Rocky Linux")): pkg = proxy_pkg_rpm if proxy_next: pkg = proxy_next_pkg_rpm diff --git a/wavefront_cli/lib/system.py b/wavefront_cli/lib/system.py index d964d93..d5e84ef 100644 --- a/wavefront_cli/lib/system.py +++ b/wavefront_cli/lib/system.py @@ -68,6 +68,7 @@ def remove_service(service_name): dist = check_os() print("Detected ", dist) if dist.startswith("Amazon Linux") or\ + dist.startswith("Rocky Linux") or\ dist == "Red Hat Enterprise Linux Server": cmd = "yum -y remove " + service_name elif dist == "Ubuntu": From a34d66af3292608fca428111536209bfd6e6aff3 Mon Sep 17 00:00:00 2001 From: Joanna Ko Date: Sun, 13 Jul 2025 01:10:58 -0700 Subject: [PATCH 2/6] bump version number --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index a4b7c0b..f779fbe 100644 --- a/setup.py +++ b/setup.py @@ -33,7 +33,7 @@ def run(self): setuptools.setup( name='wavefront-cli', - version='0.1.2', + version='0.1.3', description='VMware Aria Operations for Applications CLI Utility.', long_description=long_description, url='https://github.com/wavefrontHQ/wavefront-cli', From 0a1df0213b0f909fb70684e9cc1fcad4fb9a4efb Mon Sep 17 00:00:00 2001 From: Joanna Ko Date: Sun, 13 Jul 2025 01:34:18 -0700 Subject: [PATCH 3/6] add fixes for jenkins job builds Revert "add fixes for jenkins job builds" This reverts commit 94c054395db22f0d05d62f72c0bb628d8529c15d. fix jenkins job build --- wavefront_cli/lib/proxy.py | 2 +- wavefront_cli/lib/system.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/wavefront_cli/lib/proxy.py b/wavefront_cli/lib/proxy.py index 4577a8a..134c2c3 100644 --- a/wavefront_cli/lib/proxy.py +++ b/wavefront_cli/lib/proxy.py @@ -77,7 +77,7 @@ def install_proxy(proxy_next): return install_status -# pylint: disable=too-many-arguments +# pylint: disable=too-many-arguments, too-many-positional-arguments def configure_proxy(url, wavefront_api_token, csp_api_token=None, csp_app_id=None, csp_app_secret=None, csp_org_id=None): """Configure wavefront proxy.""" diff --git a/wavefront_cli/lib/system.py b/wavefront_cli/lib/system.py index d5e84ef..11dc65a 100644 --- a/wavefront_cli/lib/system.py +++ b/wavefront_cli/lib/system.py @@ -65,6 +65,7 @@ def write_file(path, text): def remove_service(service_name): """Delete a service.""" + cmd = None dist = check_os() print("Detected ", dist) if dist.startswith("Amazon Linux") or\ From 7db5fe5bd1402e2c89a3bac49bdbcec860e8d744 Mon Sep 17 00:00:00 2001 From: Joanna Ko Date: Sun, 13 Jul 2025 01:40:44 -0700 Subject: [PATCH 4/6] fix jenkins job build positional arguments --- wavefront_cli/lib/proxy.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/wavefront_cli/lib/proxy.py b/wavefront_cli/lib/proxy.py index 134c2c3..3b0d967 100644 --- a/wavefront_cli/lib/proxy.py +++ b/wavefront_cli/lib/proxy.py @@ -76,8 +76,9 @@ def install_proxy(proxy_next): install_status = True return install_status +# For older pylint versions, adding E1121 to disable too-many-positional-arguments -# pylint: disable=too-many-arguments, too-many-positional-arguments +# pylint: disable=too-many-arguments, E1121 def configure_proxy(url, wavefront_api_token, csp_api_token=None, csp_app_id=None, csp_app_secret=None, csp_org_id=None): """Configure wavefront proxy.""" From dae1191a3643559094b68235e894cf720a4577c9 Mon Sep 17 00:00:00 2001 From: Joanna Ko Date: Sun, 13 Jul 2025 01:49:08 -0700 Subject: [PATCH 5/6] revert last commit --- wavefront_cli/lib/proxy.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/wavefront_cli/lib/proxy.py b/wavefront_cli/lib/proxy.py index 3b0d967..134c2c3 100644 --- a/wavefront_cli/lib/proxy.py +++ b/wavefront_cli/lib/proxy.py @@ -76,9 +76,8 @@ def install_proxy(proxy_next): install_status = True return install_status -# For older pylint versions, adding E1121 to disable too-many-positional-arguments -# pylint: disable=too-many-arguments, E1121 +# pylint: disable=too-many-arguments, too-many-positional-arguments def configure_proxy(url, wavefront_api_token, csp_api_token=None, csp_app_id=None, csp_app_secret=None, csp_org_id=None): """Configure wavefront proxy.""" From acbaf1d112f0f04bdc140ce72fbd4f7b70b27cd0 Mon Sep 17 00:00:00 2001 From: Joanna Ko Date: Mon, 14 Jul 2025 11:39:16 -0700 Subject: [PATCH 6/6] Address PR comment --- wavefront_cli/lib/system.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/wavefront_cli/lib/system.py b/wavefront_cli/lib/system.py index 11dc65a..dc98bc9 100644 --- a/wavefront_cli/lib/system.py +++ b/wavefront_cli/lib/system.py @@ -68,8 +68,7 @@ def remove_service(service_name): cmd = None dist = check_os() print("Detected ", dist) - if dist.startswith("Amazon Linux") or\ - dist.startswith("Rocky Linux") or\ + if dist.startswith(("Amazon Linux", "Rocky Linux")) or\ dist == "Red Hat Enterprise Linux Server": cmd = "yum -y remove " + service_name elif dist == "Ubuntu":