2011-09-26 02:41:54 -04:00
|
|
|
module Fog
|
|
|
|
module Compute
|
|
|
|
class OpenStack
|
|
|
|
class Real
|
|
|
|
|
2011-09-29 14:10:21 -04:00
|
|
|
def rebuild_server(server_id, image_ref, name, admin_pass=nil, metadata=nil, personality=nil)
|
2011-09-26 02:41:54 -04:00
|
|
|
|
|
|
|
body = { 'rebuild' => {
|
2011-09-29 14:10:21 -04:00
|
|
|
'imageRef' => image_ref,
|
2011-09-26 02:41:54 -04:00
|
|
|
'name' => name
|
|
|
|
}}
|
2011-09-29 14:10:21 -04:00
|
|
|
body['rebuild']['adminPass'] = admin_pass if admin_pass
|
2011-09-26 02:41:54 -04:00
|
|
|
body['rebuild']['metadata'] = metadata if metadata
|
|
|
|
body['rebuild']['personality'] = personality if personality
|
2011-09-29 14:10:21 -04:00
|
|
|
server_action(server_id, body, 202)
|
2011-09-26 02:41:54 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
class Mock
|
|
|
|
|
2011-09-29 14:10:21 -04:00
|
|
|
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"
|
2011-09-26 02:41:54 -04:00
|
|
|
response
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|