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


Python AppControllerClient.get_role_info方法代码示例

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


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

示例1: update_local_metadata

# 需要导入模块: from appcontroller_client import AppControllerClient [as 别名]
# 或者: from appcontroller_client.AppControllerClient import get_role_info [as 别名]
  def update_local_metadata(cls, options, db_master, head_node):
    """Writes a locations.json file to the local filesystem,
    that the tools can use to locate machines in an AppScale deployment.

    Args:
      options: A Namespace that indicates deployment-specific parameters not
        relating to the placement strategy in use.
      db_master: A str representing the location of the database master.
      head_node: A str representing the location we can reach an
        AppController at.
    """
    # find out every machine's IP address and what they're doing
    acc = AppControllerClient(head_node, cls.get_secret_key(options.keyname))
    role_info = acc.get_role_info()

    infrastructure = options.infrastructure or 'xen'

    # write our yaml metadata file
    appscalefile_contents = {
      'infrastructure' : infrastructure,
      'group' : options.group,
    }

    if infrastructure != "xen":
      appscalefile_contents['zone'] = options.zone

    if infrastructure == "gce":
      appscalefile_contents['project'] = options.project

    if infrastructure == 'azure':
      appscalefile_contents['azure_subscription_id'] = options.azure_subscription_id
      appscalefile_contents['azure_app_id'] = options.azure_app_id
      appscalefile_contents['azure_app_secret_key'] = options.azure_app_secret_key
      appscalefile_contents['azure_tenant_id'] = options.azure_tenant_id
      appscalefile_contents['azure_resource_group'] = options.azure_resource_group
      appscalefile_contents['azure_storage_account'] = options.azure_storage_account
      appscalefile_contents['azure_group_tag'] = options.azure_group_tag

    locations_json = {
      'node_info': role_info,
      'infrastructure_info': appscalefile_contents
    }

    # and now we can write the json metadata file
    with open(cls.get_locations_json_location(options.keyname), 'w') \
        as file_handle:
      file_handle.write(json.dumps(locations_json))
开发者ID:tmarballi,项目名称:appscale-tools,代码行数:49,代码来源:local_state.py

示例2: update_local_metadata

# 需要导入模块: from appcontroller_client import AppControllerClient [as 别名]
# 或者: from appcontroller_client.AppControllerClient import get_role_info [as 别名]
  def update_local_metadata(cls, options, node_layout, host, instance_id):
    """Writes a locations.yaml and locations.json file to the local filesystem,
    that the tools can use to locate machines in an AppScale deployment.

    Args:
      options: A Namespace that indicates deployment-specific parameters not
        relating to the placement strategy in use.
      node_layout: A NodeLayout that indicates the placement strategy in use
        for this deployment.
      host: A str representing the location we can reach an AppController at.
      instance_id: The instance ID (if running in a cloud environment)
        associated with the given host.
    """
    # find out every machine's IP address and what they're doing
    acc = AppControllerClient(host, cls.get_secret_key(options.keyname))
    all_ips = [str(ip) for ip in acc.get_all_public_ips()]
    role_info = acc.get_role_info()

    infrastructure = options.infrastructure or 'xen'

    # write our yaml metadata file
    yaml_contents = {
      'load_balancer' : str(host),
      'instance_id' : str(instance_id),
      'table' : options.table,
      'secret' : cls.get_secret_key(options.keyname),
      'db_master' : node_layout.db_master().public_ip,
      'ips' : all_ips,
      'infrastructure' : infrastructure,
      'group' : options.group,
    }

    if infrastructure != "xen":
      yaml_contents['zone'] = options.zone

    if infrastructure == "gce":
      yaml_contents['project'] = options.project

    with open(cls.get_locations_yaml_location(options.keyname), 'w') \
        as file_handle:
      file_handle.write(yaml.dump(yaml_contents, default_flow_style=False))

    # and now we can write the json metadata file
    with open(cls.get_locations_json_location(options.keyname), 'w') \
        as file_handle:
      file_handle.write(json.dumps(role_info))
开发者ID:lmandres,项目名称:appscale-tools-raspberry-pi,代码行数:48,代码来源:local_state.py


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