python类unit_get()的实例源码

helpers.py 文件源码 项目:charm-ceilometer 作者: openstack 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def provide_data(self):
        return {
            'host': hookenv.unit_get('private-address'),
            'port': 80,
        }
helpers.py 文件源码 项目:charm-ceilometer 作者: openstack 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def provide_data(self):
        return {
            'host': hookenv.unit_get('private-address'),
            'port': 80,
        }
volume.py 文件源码 项目:charm-glusterfs 作者: openstack 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def get_local_ip() -> Result:
    """
    Returns the local IPAddr address associated with this server
    # Failures
    Returns a GlusterError representing any failure that may have happened
    while trying to
    query this information.
    """
    ip_addr = get_host_ip(unit_get('private-address'))
    try:
        parsed = ip_address(address=ip_addr)
        return Ok(parsed)  # Resolves a str hostname into a ip address.
    except ValueError:
        return Err("failed to parse ip address: {}".format(ip_addr))
helpers.py 文件源码 项目:charm-hacluster 作者: openstack 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def provide_data(self):
        return {
            'host': hookenv.unit_get('private-address'),
            'port': 80,
        }
helpers.py 文件源码 项目:charm-hacluster 作者: openstack 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def provide_data(self):
        return {
            'host': hookenv.unit_get('private-address'),
            'port': 80,
        }
helpers.py 文件源码 项目:charm-neutron-openvswitch 作者: openstack 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def provide_data(self):
        return {
            'host': hookenv.unit_get('private-address'),
            'port': 80,
        }
helpers.py 文件源码 项目:charm-neutron-openvswitch 作者: openstack 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def provide_data(self):
        return {
            'host': hookenv.unit_get('private-address'),
            'port': 80,
        }
helpers.py 文件源码 项目:charm-cinder-backup 作者: openstack 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def provide_data(self):
        return {
            'host': hookenv.unit_get('private-address'),
            'port': 80,
        }
helpers.py 文件源码 项目:charm-cinder-backup 作者: openstack 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def provide_data(self):
        return {
            'host': hookenv.unit_get('private-address'),
            'port': 80,
        }
trove.py 文件源码 项目:charm-trove 作者: openstack 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def get_database_setup(self):
        """Provide the default database credentials as a list of 3-tuples

        returns a structure of:
        [
            {'database': <database>,
             'username': <username>,
             'hostname': <hostname of this unit>
             'prefix': <the optional prefix for the database>, },
        ]

        :returns [{'database': ...}, ...]: credentials for multiple databases
        """
        host = None
        try:
            host = hookenv.network_get_primary_address('shared-db')
        except NotImplementedError:
            host = hookenv.unit_get('private-address')

        return [
            dict(
                database=self.config['database'],
                username=self.config['database-user'],
                hostname=host, )
        ]


# Determine the charm class by the supported release
helpers.py 文件源码 项目:charm-ceph 作者: openstack 项目源码 文件源码 阅读 31 收藏 0 点赞 0 评论 0
def provide_data(self):
        return {
            'host': hookenv.unit_get('private-address'),
            'port': 80,
        }
helpers.py 文件源码 项目:charm-ceph 作者: openstack 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def provide_data(self):
        return {
            'host': hookenv.unit_get('private-address'),
            'port': 80,
        }
helpers.py 文件源码 项目:charm-odl-controller 作者: openstack 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def provide_data(self):
        return {
            'host': hookenv.unit_get('private-address'),
            'port': 80,
        }
helpers.py 文件源码 项目:charm-odl-controller 作者: openstack 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def provide_data(self):
        return {
            'host': hookenv.unit_get('private-address'),
            'port': 80,
        }
prometheus.py 文件源码 项目:juju-charm-prometheus 作者: tasdomas 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def write_prometheus_config_yml():
    config = hookenv.config()
    target_jobs = unitdata.kv().get('target_jobs', [])
    scrape_jobs = unitdata.kv().get('scrape_jobs', [])

    # transform eg. 'h1:p1 ,  h2:p2' (string), to ['h1:p1', 'h2:p2'] (list)
    static_targets = None
    if config.get('static-targets'):
        static_targets = [x.strip()
                          for x in config.get('static-targets', '').split(',')]

    default_monitor_name = '{}-monitor'.format(hookenv.service_name())
    options = {
        'scrape_interval': config['scrape-interval'],
        'evaluation_interval': config['evaluation-interval'],
        'static_targets': static_targets,
        'private_address': hookenv.unit_get('private-address'),
        'monitor_name': config.get('monitor_name', default_monitor_name),
        'jobs': target_jobs,
        'scrape_jobs': scrape_jobs,
    }

    # custom-rules content must be passed verbatim with e.g.
    #   juju set prometheus custom-rules @my.rules
    if config.get('custom-rules'):
        custom_rules = config['custom-rules']
        with open(CUSTOM_RULES_PATH, 'w') as fh:
            fh.write(custom_rules)
        options['custom_rules_file'] = CUSTOM_RULES_PATH

    render(source=PROMETHEUS_YML_TMPL,
           target=PROMETHEUS_YML,
           context=options
           )
    validate_config()
    set_state('prometheus.do-restart')
    remove_state('prometheus.do-reconfig-yml')
helpers.py 文件源码 项目:charm-ceph-radosgw 作者: openstack 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def provide_data(self):
        return {
            'host': hookenv.unit_get('private-address'),
            'port': 80,
        }
helpers.py 文件源码 项目:charm-ceph-radosgw 作者: openstack 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def provide_data(self):
        return {
            'host': hookenv.unit_get('private-address'),
            'port': 80,
        }
helpers.py 文件源码 项目:charm-swift-storage 作者: openstack 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def provide_data(self):
        return {
            'host': hookenv.unit_get('private-address'),
            'port': 80,
        }
helpers.py 文件源码 项目:charm-swift-storage 作者: openstack 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def provide_data(self):
        return {
            'host': hookenv.unit_get('private-address'),
            'port': 80,
        }
helpers.py 文件源码 项目:charm-swift-storage 作者: openstack 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def provide_data(self):
        return {
            'host': hookenv.unit_get('private-address'),
            'port': 80,
        }


问题


面经


文章

微信
公众号

扫码关注公众号