From: Debian FreeIPA Team Date: Tue, 24 Jan 2023 11:21:19 +0000 (+0000) Subject: dont-run-rpm X-Git-Tag: archive/raspbian/2.3.1+dfsg1-1+rpi1^2~3 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=6971dd9f67c5854860570e977537f0355105e55e;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: