Merge lp:~bac/launchpad/ec2_attached into lp:launchpad

Proposed by Brad Crittenden
Status: Merged
Approved by: Henning Eggers
Approved revision: not available
Merged at revision: not available
Proposed branch: lp:~bac/launchpad/ec2_attached
Merge into: lp:launchpad
Diff against target: 44 lines (+9/-4)
1 file modified
lib/devscripts/ec2test/builtins.py (+9/-4)
To merge this branch: bzr merge lp:~bac/launchpad/ec2_attached
Reviewer Review Type Date Requested Status
Henning Eggers (community) code Approve
Review via email: mp+15272@code.launchpad.net

Commit message

Add an '--attached' option to 'ec2 land' for the very rare occasions you want to not go headless.

To post a comment you must log in.
Revision history for this message
Brad Crittenden (bac) wrote :

= Summary =

Using 'ec2 land' the use of --headless is hard-coded. This branch adds
an '--attached' option for the very rare cases you don't want to use
headless.

== Proposed fix ==

Simply add the option to make --headless the default but optional.

== Pre-implementation notes ==

None.

== Implementation details ==

As above.

== Tests ==

None.

== Demo and Q/A ==

Run 'ec2 land --dry-run' with and without --attached

= Launchpad lint =

Checking for conflicts. and issues in doctests and templates.
Running jslint, xmllint, pyflakes, and pylint.
Using normal rules.

Linting changed files:
  lib/devscripts/ec2test/builtins.py

Revision history for this message
Henning Eggers (henninge) wrote :

Thanks for this simple but effective improvement.

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/devscripts/ec2test/builtins.py'
2--- lib/devscripts/ec2test/builtins.py 2009-11-17 22:52:24 +0000
3+++ lib/devscripts/ec2test/builtins.py 2009-11-30 16:29:11 +0000
4@@ -324,15 +324,20 @@
5 Option(
6 'force',
7 help="Land the branch even if the proposal is not approved."),
8+ Option(
9+ 'attached',
10+ help="Remain attached, i.e. do not go headless."),
11 ]
12
13 takes_args = ['merge_proposal?']
14
15 def _get_landing_command(self, source_url, target_url, commit_message,
16- emails):
17+ emails, attached):
18 """Return the command that would need to be run to submit with ec2."""
19 ec2_path = os.path.join(get_launchpad_root(), 'utilities', 'ec2')
20- command = [ec2_path, 'test', '--headless']
21+ command = [ec2_path, 'test']
22+ if not attached:
23+ command.extend(['--headless'])
24 command.extend(['--email=%s' % email for email in emails])
25 # 'ec2 test' has a bug where you cannot pass full URLs to branches to
26 # the -b option. It has special logic for 'launchpad' branches, so we
27@@ -346,7 +351,7 @@
28 def run(self, merge_proposal=None, machine=None,
29 instance_type=DEFAULT_INSTANCE_TYPE, postmortem=False,
30 debug=False, commit_text=None, dry_run=False, testfix=False,
31- print_commit=False, force=False):
32+ print_commit=False, force=False, attached=False):
33 try:
34 from devscripts.autoland import (
35 LaunchpadBranchLander, MissingReviewError)
36@@ -399,7 +404,7 @@
37
38 landing_command = self._get_landing_command(
39 mp.source_branch, mp.target_branch, commit_message,
40- mp.get_stakeholder_emails())
41+ mp.get_stakeholder_emails(), attached)
42 if dry_run:
43 print landing_command
44 else: