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', 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..134c2c3 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 @@ -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 d964d93..dc98bc9 100644 --- a/wavefront_cli/lib/system.py +++ b/wavefront_cli/lib/system.py @@ -65,9 +65,10 @@ 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\ + if dist.startswith(("Amazon Linux", "Rocky Linux")) or\ dist == "Red Hat Enterprise Linux Server": cmd = "yum -y remove " + service_name elif dist == "Ubuntu":