当前位置: 首页>>代码示例>>Python>>正文


Python DiscoAWS.instances_from_amis方法代码示例

本文整理汇总了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)
开发者ID:amplifylitco,项目名称:asiaq,代码行数:9,代码来源:test_disco_aws.py

示例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)
开发者ID:amplifylitco,项目名称:asiaq,代码行数:11,代码来源:test_disco_aws.py

示例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'])
开发者ID:amplifylitco,项目名称:asiaq,代码行数:12,代码来源:test_disco_aws.py

示例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)
开发者ID:amplifylitco,项目名称:asiaq,代码行数:19,代码来源:test_disco_aws.py


注:本文中的disco_aws_automation.DiscoAWS.instances_from_amis方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。