aggregates.py 文件源码

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

项目:mogan 作者: openstack 项目源码 文件源码
def _is_safe_to_update_metadata(self, patch, aggregate_uuid):
        """Check if it's safe to update aggregate metadata"""

        keys = ['availability_zone', 'affinity_zone']
        # Check if this tries to change *keys* to empty.
        for patch_dict in patch:
            for key in keys:
                if patch_dict['path'] == '/metadata/' + key \
                        and patch_dict['op'] != 'remove':
                    if not patch_dict['value']:
                        msg = _("Aggregate %(uuid)s does not support empty "
                                "named %(key)s") % {"uuid": aggregate_uuid,
                                                    "key": key}
                        raise wsme.exc.ClientSideError(
                            msg, status_code=http_client.BAD_REQUEST)
                    else:
                        self._check_metadata_conflicts(
                            aggregate_uuid, key, patch_dict['value'])
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号