~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/devscripts/ec2test/builtins.py

  • Committer: Launchpad Patch Queue Manager
  • Date: 2012-01-06 20:21:38 UTC
  • mfrom: (14646.2.1 bug912794)
  • Revision ID: launchpad@pqm.canonical.com-20120106202138-mnl55qu4h9iovgk4
[r=gary][bug=912794] update to newer launchpadlib

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
__metaclass__ = type
7
7
__all__ = []
8
8
 
9
 
from datetime import datetime, timedelta
 
9
from datetime import (
 
10
    datetime,
 
11
    timedelta,
 
12
    )
10
13
import os
11
14
import pdb
12
15
import socket
23
26
    ListOption,
24
27
    Option,
25
28
    )
 
29
from bzrlib.trace import is_verbose
26
30
from bzrlib.transport import get_transport
27
 
from bzrlib.trace import is_verbose
28
31
from pytz import UTC
29
32
import simplejson
30
33
 
620
623
        instance.check_bundling_prerequisites(ami_name)
621
624
        instance.set_up_and_run(
622
625
            postmortem, True, self.update_image, instance,
623
 
            extra_update_image_command, ami_name, instance._credentials, public)
 
626
            extra_update_image_command, ami_name, instance._credentials,
 
627
            public)
624
628
 
625
629
    def update_image(self, instance, extra_update_image_command, ami_name,
626
630
                     credentials, public):
792
796
                    current_status = '[FAILED]'
793
797
                else:
794
798
                    current_status = '[OK]    '
795
 
        output = '%-40s  %-10s (up for %s) %10s' % (description, current_status, uptime,
796
 
            instance.id)
 
799
        output = (
 
800
            '%-40s  %-10s (up for %s) %10s'
 
801
            % (description, current_status, uptime, instance.id))
797
802
        if verbose:
798
803
            url = self.get_http_url(instance)
799
804
            if url is None:
800
805
                url = "No web service"
801
806
            output += '\n  %s' % (url,)
802
807
            if instance.state_reason:
803
 
                output += '\n  transition reason: %s' % instance.state_reason.get(
804
 
                    'message', '')
 
808
                output += (
 
809
                    '\n  transition reason: %s'
 
810
                    % instance.state_reason.get('message', ''))
805
811
        return output
806
812
 
807
813
    def format_summary(self, by_state):
824
830
            data = self.get_ec2test_info(instance)
825
831
            if data is None and not all:
826
832
                continue
827
 
            print self.format_instance(instance, data, verbose=(show_urls or is_verbose()))
 
833
            print self.format_instance(
 
834
                instance, data, verbose=(show_urls or is_verbose()))
828
835
        print 'Summary: %s' % (self.format_summary(by_state),)
829
836
 
830
837