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
=== modified file 'lib/devscripts/ec2test/builtins.py'
--- lib/devscripts/ec2test/builtins.py 2009-11-17 22:52:24 +0000
+++ lib/devscripts/ec2test/builtins.py 2009-11-30 16:29:11 +0000
@@ -324,15 +324,20 @@
324 Option(324 Option(
325 'force',325 'force',
326 help="Land the branch even if the proposal is not approved."),326 help="Land the branch even if the proposal is not approved."),
327 Option(
328 'attached',
329 help="Remain attached, i.e. do not go headless."),
327 ]330 ]
328331
329 takes_args = ['merge_proposal?']332 takes_args = ['merge_proposal?']
330333
331 def _get_landing_command(self, source_url, target_url, commit_message,334 def _get_landing_command(self, source_url, target_url, commit_message,
332 emails):335 emails, attached):
333 """Return the command that would need to be run to submit with ec2."""336 """Return the command that would need to be run to submit with ec2."""
334 ec2_path = os.path.join(get_launchpad_root(), 'utilities', 'ec2')337 ec2_path = os.path.join(get_launchpad_root(), 'utilities', 'ec2')
335 command = [ec2_path, 'test', '--headless']338 command = [ec2_path, 'test']
339 if not attached:
340 command.extend(['--headless'])
336 command.extend(['--email=%s' % email for email in emails])341 command.extend(['--email=%s' % email for email in emails])
337 # 'ec2 test' has a bug where you cannot pass full URLs to branches to342 # 'ec2 test' has a bug where you cannot pass full URLs to branches to
338 # the -b option. It has special logic for 'launchpad' branches, so we343 # the -b option. It has special logic for 'launchpad' branches, so we
@@ -346,7 +351,7 @@
346 def run(self, merge_proposal=None, machine=None,351 def run(self, merge_proposal=None, machine=None,
347 instance_type=DEFAULT_INSTANCE_TYPE, postmortem=False,352 instance_type=DEFAULT_INSTANCE_TYPE, postmortem=False,
348 debug=False, commit_text=None, dry_run=False, testfix=False,353 debug=False, commit_text=None, dry_run=False, testfix=False,
349 print_commit=False, force=False):354 print_commit=False, force=False, attached=False):
350 try:355 try:
351 from devscripts.autoland import (356 from devscripts.autoland import (
352 LaunchpadBranchLander, MissingReviewError)357 LaunchpadBranchLander, MissingReviewError)
@@ -399,7 +404,7 @@
399404
400 landing_command = self._get_landing_command(405 landing_command = self._get_landing_command(
401 mp.source_branch, mp.target_branch, commit_message,406 mp.source_branch, mp.target_branch, commit_message,
402 mp.get_stakeholder_emails())407 mp.get_stakeholder_emails(), attached)
403 if dry_run:408 if dry_run:
404 print landing_command409 print landing_command
405 else:410 else: