designate.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:charm-designate 作者: openstack 项目源码 文件源码
def update_pools(self):
        # designate-manage communicates with designate via message bus so no
        # need to set OS_ vars
        # NOTE(AJK) this runs with every hook (once most relations are up) and
        # so if it fails it will be picked up by the next relation change or
        # update-status.  i.e. it will heal eventually.
        if hookenv.is_leader():
            try:
                cmd = "designate-manage pool update"
                # Note(tinwood) that this command may fail if the pools.yaml
                # doesn't actually contain any pools.  This happens when the
                # relation is broken, which errors out the charm.  This stops
                # this happening and logs the error.
                subprocess.check_call(cmd.split(), timeout=60)
            except subprocess.CalledProcessError as e:
                hookenv.log("designate-manage pool update failed: {}"
                            .format(str(e)))
            except subprocess.TimeoutExpired as e:
                # the timeout is if the rabbitmq server has gone away; it just
                # retries continuously; this lets the hook complete.
                hookenv.log("designate-manage pool command timed out: {}".
                            format(str(e)))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号