|
|
d51d46 |
From 5c4efd4cff0459ea65914ce07d7307589206b0cd Mon Sep 17 00:00:00 2001
|
|
|
d51d46 |
From: Radovan Sroka <rsroka@redhat.com>
|
|
|
d51d46 |
Date: Mon, 22 Jul 2019 17:21:59 +0200
|
|
|
d51d46 |
Subject: [PATCH] Removed stdout output for dnf plugin
|
|
|
d51d46 |
|
|
|
d51d46 |
DNF stdout shouldn't be affected by its plugin.
|
|
|
d51d46 |
---
|
|
|
d51d46 |
dnf/fapolicyd-dnf-plugin.py | 16 ++++++----------
|
|
|
d51d46 |
1 file changed, 6 insertions(+), 10 deletions(-)
|
|
|
d51d46 |
|
|
|
d51d46 |
diff --git a/dnf/fapolicyd-dnf-plugin.py b/dnf/fapolicyd-dnf-plugin.py
|
|
|
d51d46 |
index 2c9d65e..3de6651 100644
|
|
|
d51d46 |
--- a/dnf/fapolicyd-dnf-plugin.py
|
|
|
d51d46 |
+++ b/dnf/fapolicyd-dnf-plugin.py
|
|
|
d51d46 |
@@ -3,6 +3,7 @@
|
|
|
d51d46 |
import dnf
|
|
|
d51d46 |
import os
|
|
|
d51d46 |
import stat
|
|
|
d51d46 |
+import sys
|
|
|
d51d46 |
|
|
|
d51d46 |
class Fapolicyd(dnf.Plugin):
|
|
|
d51d46 |
|
|
|
d51d46 |
@@ -11,30 +12,25 @@ class Fapolicyd(dnf.Plugin):
|
|
|
d51d46 |
file = None
|
|
|
d51d46 |
|
|
|
d51d46 |
def __init__(self, base, cli):
|
|
|
d51d46 |
- print("fapolicyd-plugin is installed and active")
|
|
|
d51d46 |
pass
|
|
|
d51d46 |
|
|
|
d51d46 |
def transaction(self):
|
|
|
d51d46 |
- print("fapolicy-plugin: sending signal to fapolicy daemon")
|
|
|
d51d46 |
|
|
|
d51d46 |
if not os.path.exists(self.pipe):
|
|
|
d51d46 |
- print("Pipe does not exist (" + self.pipe + ")")
|
|
|
d51d46 |
- print("Perhaps fapolicy-plugin does not have enough permission")
|
|
|
d51d46 |
- print("or fapolicyd is not running...")
|
|
|
d51d46 |
+ sys.stderr.write("Pipe does not exist (" + self.pipe + ")\n")
|
|
|
d51d46 |
+ sys.stderr.write("Perhaps fapolicy-plugin does not have enough permissions\n")
|
|
|
d51d46 |
+ sys.stderr.write("or fapolicyd is not running...\n")
|
|
|
d51d46 |
return
|
|
|
d51d46 |
|
|
|
d51d46 |
if not stat.S_ISFIFO(os.stat(self.pipe).st_mode):
|
|
|
d51d46 |
- print(self.pipe + ": is not a pipe!")
|
|
|
d51d46 |
+ sys.stderr.write(self.pipe + ": is not a pipe!\n")
|
|
|
d51d46 |
return
|
|
|
d51d46 |
|
|
|
d51d46 |
try:
|
|
|
d51d46 |
self.file = open(self.pipe, "w")
|
|
|
d51d46 |
except PermissionError:
|
|
|
d51d46 |
- print("fapolicy-plugin does not have write permission: " + self.pipe)
|
|
|
d51d46 |
+ sys.stderr.write("fapolicy-plugin does not have write permission: " + self.pipe + "\n")
|
|
|
d51d46 |
return
|
|
|
d51d46 |
|
|
|
d51d46 |
self.file.write("1")
|
|
|
d51d46 |
self.file.close()
|
|
|
d51d46 |
-
|
|
|
d51d46 |
- print("Fapolicyd was notified")
|
|
|
d51d46 |
-
|