hosts.py 文件源码

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

项目:craton 作者: openstack 项目源码 文件源码
def post(self, context, request_data):
        """Create a new host."""
        json = util.copy_project_id_into_json(context, request_data)
        host_obj = dbapi.hosts_create(context, json)
        host = jsonutils.to_primitive(host_obj)
        if 'variables' in json:
            host["variables"] = jsonutils.to_primitive(host_obj.variables)
        else:
            host["variables"] = {}

        utils.add_up_link(context, host)

        location = v1.api.url_for(
            HostById, id=host_obj.id, _external=True
        )
        headers = {'Location': location}

        return host, 201, headers
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号