Merge pull request #287 from behanceops/feature-instance-launch-time
Feature instance launch time
This commit is contained in:
commit
7c0346c658
@ -299,6 +299,7 @@ class Instance(BotoInstance, TaggedEC2Resource):
|
|||||||
self.subnet_id = kwargs.get("subnet_id")
|
self.subnet_id = kwargs.get("subnet_id")
|
||||||
self.key_name = kwargs.get("key_name")
|
self.key_name = kwargs.get("key_name")
|
||||||
self.source_dest_check = "true"
|
self.source_dest_check = "true"
|
||||||
|
self.launch_time = datetime.now().isoformat()
|
||||||
self.private_ip_address = kwargs.get('private_ip_address')
|
self.private_ip_address = kwargs.get('private_ip_address')
|
||||||
|
|
||||||
self.block_device_mapping = BlockDeviceMapping()
|
self.block_device_mapping = BlockDeviceMapping()
|
||||||
|
|||||||
@ -204,7 +204,7 @@ EC2_RUN_INSTANCES = """<RunInstancesResponse xmlns="http://ec2.amazonaws.com/doc
|
|||||||
<keyName>{{ instance.key_name }}</keyName>
|
<keyName>{{ instance.key_name }}</keyName>
|
||||||
<amiLaunchIndex>0</amiLaunchIndex>
|
<amiLaunchIndex>0</amiLaunchIndex>
|
||||||
<instanceType>{{ instance.instance_type }}</instanceType>
|
<instanceType>{{ instance.instance_type }}</instanceType>
|
||||||
<launchTime>2007-08-07T11:51:50.000Z</launchTime>
|
<launchTime>{{ instance.launch_time }}</launchTime>
|
||||||
<placement>
|
<placement>
|
||||||
<availabilityZone>us-east-1b</availabilityZone>
|
<availabilityZone>us-east-1b</availabilityZone>
|
||||||
<groupName/>
|
<groupName/>
|
||||||
@ -325,7 +325,7 @@ EC2_DESCRIBE_INSTANCES = """<DescribeInstancesResponse xmlns='http://ec2.amazona
|
|||||||
<amiLaunchIndex>0</amiLaunchIndex>
|
<amiLaunchIndex>0</amiLaunchIndex>
|
||||||
<productCodes/>
|
<productCodes/>
|
||||||
<instanceType>{{ instance.instance_type }}</instanceType>
|
<instanceType>{{ instance.instance_type }}</instanceType>
|
||||||
<launchTime>YYYY-MM-DDTHH:MM:SS+0000</launchTime>
|
<launchTime>{{ instance.launch_time }}</launchTime>
|
||||||
<placement>
|
<placement>
|
||||||
<availabilityZone>us-west-2a</availabilityZone>
|
<availabilityZone>us-west-2a</availabilityZone>
|
||||||
<groupName/>
|
<groupName/>
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import tests.backport_assert_raises
|
|||||||
from nose.tools import assert_raises
|
from nose.tools import assert_raises
|
||||||
|
|
||||||
import base64
|
import base64
|
||||||
|
import datetime
|
||||||
|
|
||||||
import boto
|
import boto
|
||||||
from boto.ec2.instance import Reservation, InstanceAttribute
|
from boto.ec2.instance import Reservation, InstanceAttribute
|
||||||
@ -50,6 +51,7 @@ def test_instance_launch_and_terminate():
|
|||||||
instances.should.have.length_of(1)
|
instances.should.have.length_of(1)
|
||||||
instances[0].id.should.equal(instance.id)
|
instances[0].id.should.equal(instance.id)
|
||||||
instances[0].state.should.equal('running')
|
instances[0].state.should.equal('running')
|
||||||
|
datetime.datetime.strptime(instances[0].launch_time, '%Y-%m-%dT%H:%M:%S.%f')
|
||||||
|
|
||||||
root_device_name = instances[0].root_device_name
|
root_device_name = instances[0].root_device_name
|
||||||
instances[0].block_device_mapping[root_device_name].status.should.equal('attached')
|
instances[0].block_device_mapping[root_device_name].status.should.equal('attached')
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user