graphics_card_resource puts spaces in product names which results in broken job ids
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Checkbox Provider - Resource |
Fix Released
|
High
|
Daniel Manrique |
Bug Description
Picture a job like:
unit: template
template-unit: job
template-resource: graphics_
plugin: shell
id: graphics/
_summary: Obtains a simple screen capture of {product}
estimated_duration: 1.0
requires: package.name == 'gnome-screenshot'
command: gnome-screenshot --file $PLAINBOX_
_description: Obtains a simple screen capture of {product} using gnome-screenshot if present
Now picture output of graphics_
bus: pci
category: VIDEO
driver: i915
index: 1
path: /devices/
product: Haswell-ULT Integrated Graphics Controller
product_id: 2582
subproduct_id: 1546
subvendor_id: 4136
vendor: Intel Corporation
vendor_id: 32902
The product has spaces, so it results in a job id like:
graphics/
This obviously breaks things resulting in errors similar to (in this case, the bogus job was specified as a dependency):
There were some problems with the selected jobs
* missing dependency: '2013.com.
Problematic jobs will not be considered
Previously this was handled in the job's ID which in non-template jobs is done like so:
id: graphics/`echo ${index}
Since we no longer have that shell processing, maybe the resource should do these substitutions. Though I wonder if munging the product name that much would cause other repercussions. Graphics_
Related branches
- Zygmunt Krynicki (community): Approve
-
Diff: 24 lines (+7/-0)1 file modifiedproviders/plainbox-provider-resource-generic/bin/graphics_card_resource (+7/-0)
Changed in checkbox: | |
status: | New → Triaged |
importance: | Undecided → High |
affects: | checkbox → plainbox-provider-resource |
Changed in plainbox-provider-resource: | |
status: | Triaged → In Progress |
assignee: | nobody → Daniel Manrique (roadmr) |
Changed in plainbox-provider-resource: | |
status: | In Progress → Fix Committed |
milestone: | none → 0.18 |
Changed in plainbox-provider-resource: | |
status: | Fix Committed → Fix Released |
--- providers/ plainbox- provider- resource- generic/ bin/graphics_ card_resource 2015-01-27 14:34:02 +0000 plainbox- provider- resource- generic/ bin/graphics_ card_resource 2015-02-25 22:29:43 +0000 www.gnu. org/licenses/>.
+++ providers/
@@ -18,6 +18,7 @@
# along with Checkbox. If not, see <http://
import argparse
+import re
import subprocess
import shlex
@@ -115,6 +116,12 @@
except ValueError:
fake_product = "PCI ID unknown"
record[ 'product' ] = fake_product r"[^_a- zA-Z0-9- ]", 'product' ].replace( ".format( key=k, value=record[k])
for k in sorted( record. keys()) ]
+ # replace characters that would make for an invalid job id
+ record['product'] = re.sub(
+ "",
+ record[
+ " ",
+ "_"))
# Finally, print the record
items = ["{key}: {value}