Merge lp:~abentley/juju-release-tools/make-parent-dir into lp:juju-release-tools

Proposed by Aaron Bentley
Status: Merged
Merged at revision: 265
Proposed branch: lp:~abentley/juju-release-tools/make-parent-dir
Merge into: lp:juju-release-tools
Diff against target: 23 lines (+6/-0)
1 file modified
download_agents.py (+6/-0)
To merge this branch: bzr merge lp:~abentley/juju-release-tools/make-parent-dir
Reviewer Review Type Date Requested Status
Curtis Hovey (community) code Approve
Review via email: mp+286411@code.launchpad.net

Commit message

Create parent directories as needed.

Description of the change

Update download_agents to create the parent directories of agents.

This is needed now that agents have version prefixes like agent/1.25.1

To post a comment you must log in.
Revision history for this message
Curtis Hovey (sinzui) wrote :

Thank you.

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'download_agents.py'
--- download_agents.py 2015-11-06 21:00:26 +0000
+++ download_agents.py 2016-02-17 21:41:53 +0000
@@ -2,6 +2,7 @@
2from __future__ import print_function2from __future__ import print_function
33
4from argparse import ArgumentParser4from argparse import ArgumentParser
5import errno
5import json6import json
6import os7import os
7from urllib.request import urlopen8from urllib.request import urlopen
@@ -22,6 +23,11 @@
22 else:23 else:
23 print('Downloading: {}'.format(path), end='')24 print('Downloading: {}'.format(path), end='')
24 sys.stdout.flush()25 sys.stdout.flush()
26 try:
27 os.makedirs(os.path.dirname(download['path']))
28 except OSError as e:
29 if e.errno != errno.EEXIST:
30 raise
25 with open(download['path'], 'wb') as target:31 with open(download['path'], 'wb') as target:
26 with urlopen(download['url']) as source:32 with urlopen(download['url']) as source:
27 while True:33 while True:

Subscribers

People subscribed via source and target branches