Skip to content
This repository has been archived by the owner on Jan 3, 2023. It is now read-only.

Commit

Permalink
Merge pull request #141 from matejak/no-async
Browse files Browse the repository at this point in the history
Renamed module and variables to get rid of async.
  • Loading branch information
mpreisler committed Jul 2, 2018
2 parents 1544aad + c343497 commit ace6472
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
File renamed without changes.
2 changes: 1 addition & 1 deletion openscap_daemon/dbus_daemon.py
Expand Up @@ -81,7 +81,7 @@ def GetProfileChoicesForInput(self, input_file, tailoring_file):
@dbus.service.method(dbus_interface=dbus_utils.DBUS_INTERFACE,
in_signature="", out_signature="a(xsi)")
def GetAsyncActionsStatus(self):
return self.system.async.get_status()
return self.system.async_manager.get_status()

@dbus.service.method(dbus_interface=dbus_utils.DBUS_INTERFACE,
in_signature="s", out_signature="(sssn)")
Expand Down
16 changes: 8 additions & 8 deletions openscap_daemon/system.py
Expand Up @@ -26,7 +26,7 @@
from openscap_daemon.task import Task
from openscap_daemon.config import Configuration
from openscap_daemon import oscap_helpers
from openscap_daemon import async
from openscap_daemon import async_tools


class ResultsNotAvailable(Exception):
Expand All @@ -40,7 +40,7 @@ def __init__(self):

class System(object):
def __init__(self, config_file):
self.async = async.AsyncManager()
self.async_manager = async_tools.AsyncManager()

logging.info("Loading configuration from '%s'.", config_file)
self.config = Configuration()
Expand Down Expand Up @@ -90,7 +90,7 @@ def get_profile_choices_for_input(self, input_file, tailoring_file):
input_file, tailoring_file, None
)

class AsyncEvaluateSpecAction(async.AsyncAction):
class AsyncEvaluateSpecAction(async_tools.AsyncAction):
def __init__(self, system, spec):
super(System.AsyncEvaluateSpecAction, self).__init__()

Expand All @@ -113,7 +113,7 @@ def __str__(self):
return "Evaluate Spec '%s'" % (self.spec)

def evaluate_spec_async(self, spec):
return self.async.enqueue(
return self.async_manager.enqueue(
System.AsyncEvaluateSpecAction(
self,
spec
Expand Down Expand Up @@ -488,7 +488,7 @@ def get_closest_datetime(self, reference_datetime):

return ret

class AsyncUpdateTaskAction(async.AsyncAction):
class AsyncUpdateTaskAction(async_tools.AsyncAction):
def __init__(self, system, task_id, reference_datetime):
super(System.AsyncUpdateTaskAction, self).__init__()

Expand Down Expand Up @@ -536,7 +536,7 @@ def schedule_tasks(self, reference_datetime=None):

if task.should_be_updated(reference_datetime):
self.tasks_scheduled.add(task.id_)
self.async.enqueue(
self.async_manager.enqueue(
System.AsyncUpdateTaskAction(
self,
task.id_,
Expand Down Expand Up @@ -662,7 +662,7 @@ def generate_fix_for_task_result(self, task_id, result_id, fix_type):
fix_type
)

class AsyncEvaluateCVEScannerWorkerAction(async.AsyncAction):
class AsyncEvaluateCVEScannerWorkerAction(async_tools.AsyncAction):
def __init__(self, system, worker):
super(System.AsyncEvaluateCVEScannerWorkerAction, self).__init__()

Expand All @@ -680,7 +680,7 @@ def __str__(self):
return "Evaluate CVE Scanner Worker '%s'" % (self.worker)

def evaluate_cve_scanner_worker_async(self, worker):
return self.async.enqueue(
return self.async_manager.enqueue(
System.AsyncEvaluateCVEScannerWorkerAction(
self,
worker
Expand Down
3 changes: 2 additions & 1 deletion tests/unit/test_basic_update.py
Expand Up @@ -37,8 +37,9 @@ def test(self):
print(self.system.tasks)
self.system.schedule_tasks()

while len(self.system.async.actions) > 0:
while len(self.system.async_manager.actions) > 0:
time.sleep(1)


if __name__ == "__main__":
BasicUpdateTest.run()

0 comments on commit ace6472

Please sign in to comment.