Merge lp:~abentley/juju-release-tools/arbitrary-stream into lp:juju-release-tools

Proposed by Aaron Bentley
Status: Merged
Merged at revision: 279
Proposed branch: lp:~abentley/juju-release-tools/arbitrary-stream
Merge into: lp:juju-release-tools
Diff against target: 58 lines (+22/-9)
2 files modified
agent_paths.py (+0/-1)
set_stream.py (+22/-8)
To merge this branch: bzr merge lp:~abentley/juju-release-tools/arbitrary-stream
Reviewer Review Type Date Requested Status
Curtis Hovey (community) code Approve
Review via email: mp+287519@code.launchpad.net

Commit message

set_stream supports full agent-stream, not just revision-build.

Description of the change

This branch changes set_stream to support full agent-stream.

This script sets the content-id for the supplied items. It was initially used by the parallel-streams job and later the assemble-parallel-streams-job, to create copies of the released stream tools with the revision-build content-id.

Now we want to use it when promoting "proposed" agent versions to "released", so we need to be able to specify the full agent stream (but still not the full content-id!).

This branch does that. An initial version was cowboyed into place to support update-streams-release-proposed.

The --update-path functionality was used only by parallel-streams and is a candidate to be removed in a future update.

To post a comment you must log in.
279. By Aaron Bentley

set_stream supports full agent-stream, not just revision-build.

Revision history for this message
Curtis Hovey (sinzui) wrote :

Thank you.

review: Approve (code)
280. By Aaron Bentley

Fix lint.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'agent_paths.py'
2--- agent_paths.py 2016-02-17 20:56:06 +0000
3+++ agent_paths.py 2016-02-29 19:56:36 +0000
4@@ -1,7 +1,6 @@
5 #!/usr/bin/env python3
6 from argparse import ArgumentParser
7 import json
8-import os.path
9 import re
10 import sys
11
12
13=== modified file 'set_stream.py'
14--- set_stream.py 2016-01-25 16:10:34 +0000
15+++ set_stream.py 2016-02-29 19:56:36 +0000
16@@ -9,21 +9,35 @@
17
18 def main():
19 parser = ArgumentParser()
20- parser.add_argument('in_file')
21- parser.add_argument('out_file')
22- parser.add_argument('revision_build')
23- parser.add_argument('--update-path', action='store_true')
24+ parser.add_argument('in_file', metavar='IN-FILE',
25+ help='The file to read.')
26+ parser.add_argument('out_file', metavar='OUT-FILE',
27+ help='The file to write.')
28+ parser.add_argument(
29+ 'stream_id', metavar="STREAM-ID",
30+ help='The new stream for the items. By default, a revision-build'
31+ ' stream.')
32+ parser.add_argument(
33+ '--update-path', action='store_true',
34+ help='Update the path to put the agent in "agent/STREAM"')
35+ parser.add_argument(
36+ '--agent-stream', action='store_true',
37+ help='Interpret STREAM-ID as an agent-stream value, not a'
38+ ' revision build.')
39 args = parser.parse_args()
40 with open(args.in_file) as in_file:
41 stanzas = json.load(in_file)
42- stream = 'revision-build-{}'.format(args.revision_build)
43+ if args.agent_stream:
44+ stream = args.stream_id
45+ else:
46+ stream = 'revision-build-{}'.format(args.stream_id)
47+ content_id = 'com.ubuntu.juju:{}:tools'.format(stream)
48 for stanza in stanzas:
49- stanza['content_id'] = 'com.ubuntu.juju:{}:tools'.format(stream)
50+ stanza['content_id'] = content_id
51 if not args.update_path:
52 continue
53 path = os.path.join(
54- 'agent', 'revision-build-{}'.format(args.revision_build),
55- os.path.basename(stanza['path']))
56+ 'agent', stream, os.path.basename(stanza['path']))
57 stanza['path'] = path
58 json_dump(stanzas, args.out_file)
59

Subscribers

People subscribed via source and target branches