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


Python LocalState.update_local_metadata方法代码示例

本文整理汇总了Python中appscale.tools.local_state.LocalState.update_local_metadata方法的典型用法代码示例。如果您正苦于以下问题:Python LocalState.update_local_metadata方法的具体用法?Python LocalState.update_local_metadata怎么用?Python LocalState.update_local_metadata使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在appscale.tools.local_state.LocalState的用法示例。


在下文中一共展示了LocalState.update_local_metadata方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_update_local_metadata

# 需要导入模块: from appscale.tools.local_state import LocalState [as 别名]
# 或者: from appscale.tools.local_state.LocalState import update_local_metadata [as 别名]
  def test_update_local_metadata(self):
    # mock out getting all the ips in the deployment from the head node
    fake_soap = flexmock(name='fake_soap')
    fake_soap.should_receive('get_all_public_ips').with_args('the secret') \
      .and_return(json.dumps(['public1']))
    role_info = [{
        'public_ip' : 'public1',
        'private_ip' : 'private1',
        'roles' : ['shadow', 'db_master']
    }]
    fake_soap.should_receive('get_role_info').with_args('the secret') \
      .and_return(json.dumps(role_info))
    flexmock(SOAPpy)
    SOAPpy.should_receive('SOAPProxy').with_args('https://public1:17443') \
      .and_return(fake_soap)

    # mock out reading the secret key
    fake_secret = flexmock(name='fake_secret')
    fake_secret.should_receive('read').and_return('the secret')
    builtins = flexmock(sys.modules['__builtin__'])
    builtins.should_call('open')
    builtins.should_receive('open').with_args(
      LocalState.get_secret_key_location('booscale'), 'r') \
      .and_return(fake_secret)

    # Mock out writing the json file.
    json_location = LocalState.get_locations_json_location('booscale')
    builtins.should_receive('open').with_args(json_location, 'w')\
      .and_return(flexmock(write=lambda *args: None))

    options = flexmock(name='options', table='cassandra', infrastructure='ec2',
      keyname='booscale', group='boogroup', zone='my-zone-1b',
      EC2_ACCESS_KEY='baz', EC2_SECRET_KEY='baz', EC2_URL='')
    node_layout = NodeLayout(options={
      'min_machines' : 1,
      'max_machines' : 1,
      'infrastructure' : 'ec2',
      'table' : 'cassandra',
      'instance_type': 'm1.large'
    })
    LocalState.update_local_metadata(options, 'public1', 'public1')
开发者ID:AppScale,项目名称:appscale-tools,代码行数:43,代码来源:test_local_state.py


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