upstart-monitor cannot run without gtk libraries installed

Bug #1235245 reported by James Hunt
48
This bug affects 8 people
Affects Status Importance Assigned to Milestone
upstart
New
Undecided
Cameron Norman
upstart (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

"upstart-monitor -n" should revert to cli operation. It attempts to do this, but then barfs on class UpstartEventsGui(Gtk.Window) since Gtk is not imported unless the required gtk libraries are installed.

Tags: patch
Revision history for this message
Barry Warsaw (barry) wrote :

I took a quick look at lp:upstart and it shouldn't be too hard to fix this. There are several classic approaches to doing this, but I think the easiest way is to simply move UpstartEventsGui into a separate module which only gets imported in the `else` clause at the bottom of main(). That's the only reference to this class, and by then you know you have Gtk. Yes, it's perfectly fine to embed an import right there:

...
    else:
        from .upstart_gui import UpstartEventsGui
        win = UpstartEventsGui()

(then you'd move UpstartEventsGui to upstart_gui.py in that directory.)

Revision history for this message
Barry Warsaw (barry) wrote :

Oh, and minor style issue while I'm here. :)

`if cli == True:` is better written just `if cli:`

We generally don't test explicit equality against True or False.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in upstart (Ubuntu):
status: New → Confirmed
Revision history for this message
Jari Turkia (jari-e) wrote :

Because systemd, apparently nobody ever bothered to fix this.

Here is my patch to make CLI working.

Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "upstart-monitor.cli.patch" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

tags: added: patch
Revision history for this message
Cameron Norman (cameronnemo) wrote :
Changed in upstart:
assignee: nobody → Cameron Norman (cameronnemo)
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.