From: Debian FreeIPA Team Date: Thu, 16 Jan 2025 16:16:37 +0000 (+0100) Subject: dont-run-rpm X-Git-Tag: archive/raspbian/2.3.1+dfsg1-1+rpi1+deb12u1^2~7 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=495787afa230d739f502b1f62c6c669b39f891a5;p=389-ds-base.git dont-run-rpm Gbp-Pq: Name dont-run-rpm.diff --- diff --git a/src/lib389/lib389/cli_ctl/cockpit.py b/src/lib389/lib389/cli_ctl/cockpit.py index 3e4ac54..ab96cc7 100644 --- a/src/lib389/lib389/cli_ctl/cockpit.py +++ b/src/lib389/lib389/cli_ctl/cockpit.py @@ -10,9 +10,13 @@ import os import subprocess def cockpit_present(): - rpm_handle = os.popen('rpm -qa --qf "%{NAME}\n"') - rpm_list = rpm_handle.read().splitlines() - if 'cockpit' in rpm_list: + if os.popen('dpkg-query -l cockpit'): + return True + else: + return False + +def firewalld_present(): + if os.popen('dpkg-query -l firewalld'): return True else: return False @@ -36,8 +40,8 @@ def open_firewall(inst, log, args): """ Open the firewall for Cockpit service """ - if not cockpit_present(): - raise ValueError("The 'cockpit' package is not installed on this system") + if not firewalld_present(): + raise ValueError("The 'firewalld' package is not installed on this system") OPEN_CMD = ['sudo', 'firewall-cmd', '--add-service=cockpit', '--permanent'] if args.zone is not None: @@ -66,8 +70,8 @@ def close_firewall(inst, log, args): """ Close firewall for Cockpit service """ - if not cockpit_present(): - raise ValueError("The 'cockpit' package is not installed on this system") + if not firewalld_present(): + raise ValueError("The 'firewalld' package is not installed on this system") CLOSE_CMD = ['sudo', 'firewall-cmd', '--remove-service=cockpit', '--permanent'] try: