Use POST body for large data objects

This commit is contained in:
Joshua Boniface 2020-01-06 23:28:06 -05:00
parent f326fd99e2
commit 2aaccfffa7
2 changed files with 40 additions and 6 deletions

View File

@ -240,10 +240,18 @@ def userdata_add(config, params):
API_arguments: args API_arguments: args
API schema: {message} API schema: {message}
""" """
name = params.get('name')
userdata_data = params.get('data')
request_uri = get_request_uri(config, '/provisioner/userdata') request_uri = get_request_uri(config, '/provisioner/userdata')
response = requests.post( response = requests.post(
request_uri, request_uri,
params=params params={
'name': name
},
data={
'data': userdata_data
}
) )
debug_output(config, request_uri, response) debug_output(config, request_uri, response)
@ -263,10 +271,18 @@ def userdata_modify(config, name, params):
API_arguments: args API_arguments: args
API schema: {message} API schema: {message}
""" """
name = params.get('name')
userdata_data = params.get('data')
request_uri = get_request_uri(config, '/provisioner/userdata/{name}'.format(name=name)) request_uri = get_request_uri(config, '/provisioner/userdata/{name}'.format(name=name))
response = requests.put( response = requests.post(
request_uri, request_uri,
params=params params={
'name': name
},
data={
'data': userdata_data
}
) )
debug_output(config, request_uri, response) debug_output(config, request_uri, response)
@ -353,10 +369,18 @@ def script_add(config, params):
API_arguments: args API_arguments: args
API schema: {message} API schema: {message}
""" """
name = params.get('name')
script_data = params.get('data')
request_uri = get_request_uri(config, '/provisioner/script') request_uri = get_request_uri(config, '/provisioner/script')
response = requests.post( response = requests.post(
request_uri, request_uri,
params=params params={
'name': name
},
data={
'data': script_data
}
) )
debug_output(config, request_uri, response) debug_output(config, request_uri, response)
@ -376,10 +400,18 @@ def script_modify(config, name, params):
API_arguments: args API_arguments: args
API schema: {message} API schema: {message}
""" """
name = params.get('name')
script_data = params.get('data')
request_uri = get_request_uri(config, '/provisioner/script/{name}'.format(name=name)) request_uri = get_request_uri(config, '/provisioner/script/{name}'.format(name=name))
response = requests.put( response = requests.put(
request_uri, request_uri,
params=params params={
'name': name
},
data={
'data': script_data
}
) )
debug_output(config, request_uri, response) debug_output(config, request_uri, response)

View File

@ -113,11 +113,13 @@ def vm_define(config, xml, node, node_limit, node_selector, node_autostart):
response = requests.post( response = requests.post(
request_uri, request_uri,
params={ params={
'xml': xml,
'node': node, 'node': node,
'limit': node_limit, 'limit': node_limit,
'selector': node_selector, 'selector': node_selector,
'autostart': node_autostart 'autostart': node_autostart
},
data={
'xml': xml
} }
) )