Merge lp:~cprov/core-image-watcher/fix-udf-call into lp:core-image-watcher

Proposed by Celso Providelo
Status: Merged
Approved by: Celso Providelo
Approved revision: 10
Merged at revision: 9
Proposed branch: lp:~cprov/core-image-watcher/fix-udf-call
Merge into: lp:core-image-watcher
Diff against target: 68 lines (+18/-16)
1 file modified
core_image_watcher/__init__.py (+18/-16)
To merge this branch: bzr merge lp:~cprov/core-image-watcher/fix-udf-call
Reviewer Review Type Date Requested Status
Francis Ginther Approve
Review via email: mp+254471@code.launchpad.net

Commit message

Fix u-d-f call (typo, extra space) and other minor style tweaks.

Description of the change

Fix u-d-f call (typo, extra space) and other minor style tweaks.

To post a comment you must log in.
Revision history for this message
Francis Ginther (fginther) wrote :

There was a typo that was forcing the use of shell=True that can be fixed. Otherwise the style tweaks look good.

review: Needs Fixing
10. By Celso Providelo

Fixed the u-d-f cmdline typo and remove shell=True

Revision history for this message
Celso Providelo (cprov) wrote :

Comments addressed, Francis. Thanks for double checking my hack.

Revision history for this message
Francis Ginther (fginther) wrote :

Approve.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'core_image_watcher/__init__.py'
2--- core_image_watcher/__init__.py 2015-03-27 13:51:39 +0000
3+++ core_image_watcher/__init__.py 2015-03-28 11:58:12 +0000
4@@ -44,19 +44,20 @@
5 queue.put(body)
6 queue.close()
7 except Exception as exc:
8- logger.error(exc, exc_info=True)
9+ logger.error(exc, exc_info=True, extra=body)
10 logger.info('Done!', extra=body)
11
12
13 def _get_version_string_output(channel, device):
14 """Obtains a bytestring of the images info from the core image server"""
15- cmd = ['ubuntu-device-flash',
16- 'query ',
17- '--list-images',
18- '--channel',
19- 'ubuntu-core/{}'.format(channel),
20- '--device={}'.format(device)]
21- images = None
22+ cmd = [
23+ 'ubuntu-device-flash',
24+ 'query',
25+ '--list-images',
26+ '--channel=ubuntu-core/{}'.format(channel),
27+ '--device={}'.format(device),
28+ ]
29+ images = b''
30 try:
31 images = subprocess.check_output(cmd)
32 except subprocess.CalledProcessError as e:
33@@ -72,9 +73,9 @@
34 images = get_output(channel, device).split()
35 if (len(images) >= 2):
36 return images[-2].decode('utf-8').replace(':', '')
37- else:
38- logger.info('Could not get the image list by u-d-f')
39- return None
40+
41+ logger.error('Could not get the image list by u-d-f: %s', images)
42+ return None
43
44
45 def _cache_version_to_disk(location, latest_version):
46@@ -92,7 +93,7 @@
47 f.write(latest_version)
48 except IOError as e:
49 latest_version = None
50- logger.error('Writing the latest image info failed: %s', (str(e)))
51+ logger.error('Writing the latest image info failed: %s', str(e))
52 finally:
53 return latest_version
54
55@@ -113,10 +114,11 @@
56 except Exception as e:
57 logger.error(e, exc_info=True)
58 return None
59- body = {}
60- body['image_name'] = latest_version
61- body['channel'] = channel
62- body['device'] = device
63+ body = {
64+ 'image_name': latest_version,
65+ 'channel': channel,
66+ 'device': device,
67+ }
68 return body
69
70

Subscribers

People subscribed via source and target branches