vm: run_service(): require user session running only when need gui access

User session may not be started at all (for example no qubes packages
installed there), so don't block it in all the cases. Also this would
prevent running 'qubes.WaitForSession' service...

In practice, default value for 'gui' argument is False, so in most cases
user session will be ignored. Which doesn't matter in most cases -
especially for services called by qubesd.
This commit is contained in:
Marek Marczykowski-Górecki 2017-04-26 01:11:47 +02:00
parent 68d5ca93e1
commit 3e067a3ef5
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -1048,7 +1048,7 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM):
raise qubes.exc.QubesVMError(
self, 'Domain {!r}: qrexec not connected'.format(self.name))
if not self.have_session.is_set():
if gui and not self.have_session.is_set():
raise qubes.exc.QubesVMError(self, 'don\'t have session yet')
self.fire_event_pre('domain-cmd-pre-run', start_guid=gui)