本文整理汇总了Python中disco_aws_automation.DiscoAWS.instances_from_amis方法的典型用法代码示例。如果您正苦于以下问题:Python DiscoAWS.instances_from_amis方法的具体用法?Python DiscoAWS.instances_from_amis怎么用?Python DiscoAWS.instances_from_amis使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类disco_aws_automation.DiscoAWS
的用法示例。
在下文中一共展示了DiscoAWS.instances_from_amis方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_wait_for_autoscaling_using_amiid
# 需要导入模块: from disco_aws_automation import DiscoAWS [as 别名]
# 或者: from disco_aws_automation.DiscoAWS import instances_from_amis [as 别名]
def test_wait_for_autoscaling_using_amiid(self, mock_config, **kwargs):
'''test wait for autoscaling using the ami id to identify the instances'''
aws = DiscoAWS(config=mock_config, environment_name=TEST_ENV_NAME)
instances = [{"InstanceId": "i-123123aa"}]
aws.instances_from_amis = MagicMock(return_value=instances)
aws.wait_for_autoscaling('ami-12345678', 1)
aws.instances_from_amis.assert_called_with(['ami-12345678'], group_name=None, launch_time=None)
示例2: test_instances_from_amis
# 需要导入模块: from disco_aws_automation import DiscoAWS [as 别名]
# 或者: from disco_aws_automation.DiscoAWS import instances_from_amis [as 别名]
def test_instances_from_amis(self, mock_config, **kwargs):
'''test get instances using ami ids '''
aws = DiscoAWS(config=mock_config, environment_name=TEST_ENV_NAME)
instance = create_autospec(boto.ec2.instance.Instance)
instance.id = "i-123123aa"
instances = [instance]
aws.instances = MagicMock(return_value=instances)
self.assertEqual(aws.instances_from_amis('ami-12345678'), instances)
aws.instances.assert_called_with(filters={"image_id": 'ami-12345678'}, instance_ids=None)
示例3: test_instances_from_amis_with_group_name
# 需要导入模块: from disco_aws_automation import DiscoAWS [as 别名]
# 或者: from disco_aws_automation.DiscoAWS import instances_from_amis [as 别名]
def test_instances_from_amis_with_group_name(self, mock_config, **kwargs):
'''test get instances using ami ids in a specified group name'''
aws = DiscoAWS(config=mock_config, environment_name=TEST_ENV_NAME)
instance = create_autospec(boto.ec2.instance.Instance)
instance.id = "i-123123aa"
instances = [instance]
aws.instances_from_asgs = MagicMock(return_value=instances)
aws.instances = MagicMock(return_value=instances)
self.assertEqual(aws.instances_from_amis('ami-12345678', group_name='test_group'), instances)
aws.instances_from_asgs.assert_called_with(['test_group'])
示例4: test_instances_from_amis_with_launch_date
# 需要导入模块: from disco_aws_automation import DiscoAWS [as 别名]
# 或者: from disco_aws_automation.DiscoAWS import instances_from_amis [as 别名]
def test_instances_from_amis_with_launch_date(self, mock_config, **kwargs):
'''test get instances using ami ids and with date after a specified date time'''
aws = DiscoAWS(config=mock_config, environment_name=TEST_ENV_NAME)
now = datetime.utcnow()
instance1 = create_autospec(boto.ec2.instance.Instance)
instance1.id = "i-123123aa"
instance1.launch_time = str(now + timedelta(minutes=10))
instance2 = create_autospec(boto.ec2.instance.Instance)
instance2.id = "i-123123ff"
instance2.launch_time = str(now - timedelta(days=1))
instances = [instance1, instance2]
aws.instances = MagicMock(return_value=instances)
self.assertEqual(aws.instances_from_amis('ami-12345678', launch_time=now),
[instance1])
aws.instances.assert_called_with(filters={"image_id": 'ami-12345678'}, instance_ids=None)