This is an automatically generated e-mail. To reply, visit: http://reviewboard-fedoraserver.rhcloud.com/r/54/

TODO (Diff revision 3)
23
* implement service handling
23
* implement service handling
24
  - startServices
25
  - restartServices
24
  - restartServices
26
  - stopServices
27
25

This portion no longer applies to the current master branch and needs to be rebased.


src/rolekit/dbus_utils.py (Diff revision 3)
def dbus_label_escape(label):
161
# FIXME: Is it possible to write a reasonably stand-alone test for this?

We can probably write something up with unittest.mock, but let's not worry about that right now.


src/rolekit/server/rolebase.py (Diff revision 3)
    def stopServices(self):
    def stop_services_async(self):
428
        """stopServices"""
438
        """stop_services_async"""
429
        log.debug1("%s.stopServices()", self._log_prefix)
439
        log.debug1("%s.stop_services_async()", self._log_prefix)
430
        raise NotImplementedError()
440
441
        with SystemdJobHandler() as job_handler:
442
            for service in self._settings["services"]:
443
                job_path = job_handler.manager.StopUnit(service, "replace")
444
                job_handler.register_job(job_path)
445
446
            job_results = yield job_handler.all_jobs_done_future()
447
448
        if any([x for x in job_results.itervalues() if x not in ("skipped", "done")]):
449
            details = ", ".join(["%s: %s" % item for item in job_results.iteritems()])
450
            raise RolekitError(COMMAND_FAILED, "Stopping services failed: %s" % details)

This is almost exactly the same implementation as start_services_async. Could you merge these into a single function, please? Just pass a boolean value for starting and stopping.


The general approach looks great (and appears to work well). Just a few minor nitpicks to clean up.

- Stephen Gallagher


On July 30th, 2014, 1:38 p.m. UTC, Miloslav Trmac wrote:

Review request for RoleKit Mailing List, Stephen Gallagher and Thomas Woerner.
By Miloslav Trmac.

Updated July 30, 2014, 1:38 p.m.

Repository: rolekit

Description

Implement starting and stopping services, and use it in databaseserver.

Includes some work-in-progress edits to databaseserver, IMHO harmless enough but will split them if asked.

Now rereading this, should the StartUnit/StopUnit D-Bus calls be non-blocking as well? At this late hour I’m inclined to say that they are explicitly designed to be returning quickly, so it isn’t really necessary.

Testing

starting/stopping postgres through d-feet.

Diffs

  • TODO (053560af7e811ae9d26b7eafff92ac2786af5408)
  • config/roles/databaseserver/role.py (358deca3fc7172929d53d2c77efd5c919da2aea9)
  • src/rolekit/dbus_utils.py (fb21cec2681f60ec2ad30372c4caf285e8ba13a7)
  • src/rolekit/server/rolebase.py (d53c745352183944e307cca5259a58f058f81e27)

View Diff