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
评论列表
文章目录