From 26fa77506075aaea85f07bb339773aa468a6687e Mon Sep 17 00:00:00 2001 From: Marcus Furlong Date: Fri, 10 May 2024 18:24:44 -0400 Subject: [PATCH] add dnf hook and ensure hook consistency --- hooks/apt/05patchman | 2 +- hooks/dnf/patchman.action | 1 + hooks/yum/patchman.py | 3 +-- hooks/zypper/patchman.py | 4 ++-- setup.cfg | 1 + 5 files changed, 6 insertions(+), 5 deletions(-) create mode 100644 hooks/dnf/patchman.action diff --git a/hooks/apt/05patchman b/hooks/apt/05patchman index d9f02e23..0e70b061 100644 --- a/hooks/apt/05patchman +++ b/hooks/apt/05patchman @@ -1 +1 @@ -DPkg::Post-Invoke { "if [ -x /usr/sbin/patchman-client ]; then echo 'Sending report to patchman server ...'; /usr/sbin/patchman-client -n ; fi"; }; +DPkg::Post-Invoke { "if [ -x /usr/sbin/patchman-client ] ; then echo 'Sending report to patchman server...' ; /usr/sbin/patchman-client -n ; fi"; }; diff --git a/hooks/dnf/patchman.action b/hooks/dnf/patchman.action new file mode 100644 index 00000000..dd36362b --- /dev/null +++ b/hooks/dnf/patchman.action @@ -0,0 +1 @@ +*:any:if [ -x /usr/sbin/patchman-client ] ; then echo 'Sending report to patchman server...' ; /usr/sbin/patchman-client -n ; fi diff --git a/hooks/yum/patchman.py b/hooks/yum/patchman.py index 1b40ba35..c59af372 100644 --- a/hooks/yum/patchman.py +++ b/hooks/yum/patchman.py @@ -15,7 +15,6 @@ # along with Patchman. If not, see import os - from yum.plugins import TYPE_CORE requires_api_version = '2.1' @@ -23,7 +22,7 @@ def posttrans_hook(conduit): - conduit.info(2, 'patchman: sending data') + conduit.info(2, 'Sending report to patchman server...') servicecmd = conduit.confString('main', 'servicecmd', '/usr/sbin/patchman-client') diff --git a/hooks/zypper/patchman.py b/hooks/zypper/patchman.py index a4e5a8f4..3d8f5da9 100755 --- a/hooks/zypper/patchman.py +++ b/hooks/zypper/patchman.py @@ -17,7 +17,7 @@ # along with Patchman. If not, see # # zypp system plugin for patchman -# + import os import logging from zypp_plugin import Plugin @@ -33,7 +33,7 @@ def PLUGINBEGIN(self, headers, body): def PACKAGESETCHANGED(self, headers, body): logging.info('PACKAGESETCHANGED') logging.debug(f'headers: {headers!s}') - print('patchman: sending data') + print('Sending report to patchman server...') servicecmd = '/usr/sbin/patchman-client' args = '-n' command = f'{servicecmd!s} {args!s}> /dev/null' diff --git a/setup.cfg b/setup.cfg index 1c011d72..d001be97 100644 --- a/setup.cfg +++ b/setup.cfg @@ -25,6 +25,7 @@ requires = /usr/bin/python3 python3-importlib-metadata policycoreutils-python-utils httpd + python3-dnf-plugin-post-transaction-actions [install] optimize=1