SRU will be triggered twice in the autostart file

Bug #1465617 reported by Po-Hsu Lin
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Next Generation Checkbox (CLI)
Fix Released
High
Po-Hsu Lin

Bug Description

For the command we use for starting SRU test in the autostart file, it will trigger the test twice:

look into the command we use:
sh -c "pidof systemd && { sudo systemctl start checkbox-ci-installed-notifier.service; /usr/bin/checkbox sru --check-config >/tmp/checkbox.log 2>&1; sudo systemctl start checkbox-ci-mailer.service; } || { sudo initctl emit checkbox-sru-started; /usr/bin/checkbox sru --check-config >/tmp/checkbox.log 2>&1; sudo initctl emit checkbox-sru-finished; }"

The problem is that on a SRU system, it doesn't have the checkbox-ci-mailer package installed.

Let's break down what happened on a 15.04 system:
1. it will satisfy the "pidof systemd && {$first_part}" command, run SRU once with $first_part command
2. since it failed with no checkbox-ci-mailer package installed in $first_part command, it will not return 0 for step 1
3. as the return value is not 0, the second part (command after ||) will be triggered, which causing SRU to be triggered twice.

A possible solution is to add another if statement for checking the existence of the checkbox-ci-mailer package, call the mailer service if it's installed.

Related branches

Po-Hsu Lin (cypressyew)
Changed in checkbox-ng:
status: New → Triaged
assignee: nobody → Po-Hsu Lin (cypressyew)
importance: Undecided → High
description: updated
Po-Hsu Lin (cypressyew)
Changed in checkbox-ng:
status: Triaged → In Progress
Po-Hsu Lin (cypressyew)
Changed in checkbox-ng:
milestone: none → 0.20
status: In Progress → Fix Committed
Changed in checkbox-ng:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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