Merge remote-tracking branch 'origin/pr/301'
* origin/pr/301: qvm-features-request: ensure qrexec agent is started dnf plugin: don't try to execute qrexec if service is not running
This commit is contained in:
commit
c1c4ed1790
@ -29,6 +29,12 @@ import sys
|
|||||||
|
|
||||||
import qubesdb
|
import qubesdb
|
||||||
|
|
||||||
|
|
||||||
|
def is_active(service):
|
||||||
|
status = subprocess.call(["systemctl", "is-active", "--quiet", service])
|
||||||
|
return status == 0
|
||||||
|
|
||||||
|
|
||||||
class FeatureRequestAction(argparse.Action):
|
class FeatureRequestAction(argparse.Action):
|
||||||
'''Action for argument parser that stores a property.'''
|
'''Action for argument parser that stores a property.'''
|
||||||
# pylint: disable=redefined-builtin,too-few-public-methods
|
# pylint: disable=redefined-builtin,too-few-public-methods
|
||||||
@ -66,7 +72,8 @@ parser.add_argument('features',
|
|||||||
|
|
||||||
def main(args=None):
|
def main(args=None):
|
||||||
args = parser.parse_args(args)
|
args = parser.parse_args(args)
|
||||||
|
if not is_active("qubes-qrexec-agent"):
|
||||||
|
return
|
||||||
qdb = qubesdb.QubesDB()
|
qdb = qubesdb.QubesDB()
|
||||||
for feature, value in args.features.items():
|
for feature, value in args.features.items():
|
||||||
qdb.write('/features-request/' + feature, value)
|
qdb.write('/features-request/' + feature, value)
|
||||||
|
@ -28,6 +28,10 @@ import subprocess
|
|||||||
|
|
||||||
PLUGIN_CONF = 'qubes-hooks'
|
PLUGIN_CONF = 'qubes-hooks'
|
||||||
|
|
||||||
|
def is_active(service):
|
||||||
|
status = subprocess.call(["systemctl", "is-active", "--quiet", service])
|
||||||
|
return status == 0
|
||||||
|
|
||||||
class QubesHooks(dnf.Plugin):
|
class QubesHooks(dnf.Plugin):
|
||||||
name = 'qubes-hooks'
|
name = 'qubes-hooks'
|
||||||
|
|
||||||
@ -37,6 +41,8 @@ class QubesHooks(dnf.Plugin):
|
|||||||
self.log = logging.getLogger('dnf')
|
self.log = logging.getLogger('dnf')
|
||||||
|
|
||||||
def resolved(self):
|
def resolved(self):
|
||||||
|
if not is_active("qubes-qrexec-agent"):
|
||||||
|
return
|
||||||
# in case of no action to do, transaction() hook won't be called;
|
# in case of no action to do, transaction() hook won't be called;
|
||||||
# report updates availability here - especially when everything is up
|
# report updates availability here - especially when everything is up
|
||||||
# to date - to clear updates-available flag
|
# to date - to clear updates-available flag
|
||||||
@ -53,6 +59,8 @@ class QubesHooks(dnf.Plugin):
|
|||||||
])
|
])
|
||||||
|
|
||||||
def transaction(self):
|
def transaction(self):
|
||||||
|
if not is_active("qubes-qrexec-agent"):
|
||||||
|
return
|
||||||
if LooseVersion(dnf.const.VERSION) < '2.0.0':
|
if LooseVersion(dnf.const.VERSION) < '2.0.0':
|
||||||
config = self.read_config(self.base.conf, PLUGIN_CONF)
|
config = self.read_config(self.base.conf, PLUGIN_CONF)
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user