mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
8542e93b24
Updates the rebuild_server action so that it base64's the personality just like we do in create_server.
39 lines
1.1 KiB
Ruby
39 lines
1.1 KiB
Ruby
module Fog
|
|
module Compute
|
|
class OpenStack
|
|
class Real
|
|
|
|
def rebuild_server(server_id, image_ref, name, admin_pass=nil, metadata=nil, personality=nil)
|
|
|
|
body = { 'rebuild' => {
|
|
'imageRef' => image_ref,
|
|
'name' => name
|
|
}}
|
|
body['rebuild']['adminPass'] = admin_pass if admin_pass
|
|
body['rebuild']['metadata'] = metadata if metadata
|
|
if personality
|
|
body['rebuild']['personality'] = []
|
|
for file in personality
|
|
body['rebuild']['personality'] << {
|
|
'contents' => Base64.encode64(file['contents']),
|
|
'path' => file['path']
|
|
}
|
|
end
|
|
end
|
|
server_action(server_id, body, 202)
|
|
end
|
|
|
|
end
|
|
|
|
class Mock
|
|
|
|
def rebuild_server(server_id, image_ref, name, admin_pass=nil, metadata=nil, personality=nil)
|
|
response = get_server_details(server_id)
|
|
response.body['server']['status'] = "REBUILD"
|
|
response
|
|
end
|
|
|
|
end
|
|
end
|
|
end
|
|
end
|