Class: Fog::Compute::Openvz::Mock
- Inherits:
-
Object
- Object
- Fog::Compute::Openvz::Mock
- Defined in:
- lib/fog/openvz/compute.rb,
lib/fog/openvz/requests/compute/set_server.rb,
lib/fog/openvz/requests/compute/exec_server.rb,
lib/fog/openvz/requests/compute/stop_server.rb,
lib/fog/openvz/requests/compute/exec2_server.rb,
lib/fog/openvz/requests/compute/list_servers.rb,
lib/fog/openvz/requests/compute/mount_server.rb,
lib/fog/openvz/requests/compute/start_server.rb,
lib/fog/openvz/requests/compute/create_server.rb,
lib/fog/openvz/requests/compute/resume_server.rb,
lib/fog/openvz/requests/compute/status_server.rb,
lib/fog/openvz/requests/compute/umount_server.rb,
lib/fog/openvz/requests/compute/compact_server.rb,
lib/fog/openvz/requests/compute/convert_server.rb,
lib/fog/openvz/requests/compute/destroy_server.rb,
lib/fog/openvz/requests/compute/quotaon_server.rb,
lib/fog/openvz/requests/compute/restart_server.rb,
lib/fog/openvz/requests/compute/suspend_server.rb,
lib/fog/openvz/requests/compute/quotaoff_server.rb,
lib/fog/openvz/requests/compute/snapshot_server.rb,
lib/fog/openvz/requests/compute/quotainit_server.rb,
lib/fog/openvz/requests/compute/runscript_server.rb,
lib/fog/openvz/requests/compute/get_server_details.rb,
lib/fog/openvz/requests/compute/snapshot_list_server.rb,
lib/fog/openvz/requests/compute/snapshot_mount_server.rb,
lib/fog/openvz/requests/compute/snapshot_delete_server.rb,
lib/fog/openvz/requests/compute/snapshot_switch_server.rb,
lib/fog/openvz/requests/compute/snapshot_umount_server.rb
Class Method Summary collapse
Instance Method Summary collapse
- #compact_server(id, options = {}) ⇒ Object
- #convert_server(id, options = {}) ⇒ Object
- #create_server(options = {}) ⇒ Object
- #data ⇒ Object
- #destroy_server(id, options = {}) ⇒ Object
- #exec2_server(id, args) ⇒ Object
- #exec_server(id, args = []) ⇒ Object
- #get_server_details(id) ⇒ Object
-
#initialize(options = {}) ⇒ Mock
constructor
A new instance of Mock.
- #list_servers ⇒ Object
- #mount_server(id, options = {}) ⇒ Object
- #quotainit_server(id, options = {}) ⇒ Object
- #quotaon_server(id, options = {}) ⇒ Object
- #quotaooff_server(id, options = {}) ⇒ Object
- #reset_data ⇒ Object
- #restart_server(id, options = {}) ⇒ Object
- #resume_server(id, options = {}) ⇒ Object
- #runscript_server(id, args = []) ⇒ Object
- #set_server(id, options = {}) ⇒ Object
- #snapshot_delete_server(id, options = {}) ⇒ Object
- #snapshot_list_server(id, options = {}) ⇒ Object
- #snapshot_mount_server(id, options = {}) ⇒ Object
- #snapshot_server(id, options = {}) ⇒ Object
- #snapshot_switch_server(id, options = {}) ⇒ Object
- #snapshot_umount_server(id, options = {}) ⇒ Object
- #start_server(id, options = {}) ⇒ Object
- #status_server(id, options = {}) ⇒ Object
- #stop_server(id, options = {}) ⇒ Object
- #suspend_server(id, options = {}) ⇒ Object
- #umount_server(id, options = {}) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Mock
Returns a new instance of Mock.
55 56 57 |
# File 'lib/fog/openvz/compute.rb', line 55 def initialize(={}) @openvz_connect_command = [:openvz_connect_command] end |
Class Method Details
.data ⇒ Object
43 44 45 46 47 48 49 |
# File 'lib/fog/openvz/compute.rb', line 43 def self.data @data ||= Hash.new do |hash, key| hash[key] = { :servers => [], } end end |
.reset ⇒ Object
51 52 53 |
# File 'lib/fog/openvz/compute.rb', line 51 def self.reset @data = nil end |
Instance Method Details
#compact_server(id, options = {}) ⇒ Object
11 12 13 |
# File 'lib/fog/openvz/requests/compute/compact_server.rb', line 11 def compact_server(id, = {}) Fog::Mock.not_implemented end |
#convert_server(id, options = {}) ⇒ Object
11 12 13 |
# File 'lib/fog/openvz/requests/compute/convert_server.rb', line 11 def convert_server(id, = {}) Fog::Mock.not_implemented end |
#create_server(options = {}) ⇒ Object
11 12 13 14 15 |
# File 'lib/fog/openvz/requests/compute/create_server.rb', line 11 def create_server( = {}) # When a new fake server is created we set the status to stopped ['status'] = 'stopped' self.data[:servers] << end |
#data ⇒ Object
59 60 61 |
# File 'lib/fog/openvz/compute.rb', line 59 def data self.class.data[@openvz_connect_command] end |
#destroy_server(id, options = {}) ⇒ Object
11 12 13 |
# File 'lib/fog/openvz/requests/compute/destroy_server.rb', line 11 def destroy_server(id , = {}) self.data[:servers].reject! { |s| s['ctid'].to_s == id.to_s } end |
#exec2_server(id, args) ⇒ Object
11 12 13 |
# File 'lib/fog/openvz/requests/compute/exec2_server.rb', line 11 def exec2_server(id, args) Fog::Mock.not_implemented end |
#exec_server(id, args = []) ⇒ Object
11 12 13 |
# File 'lib/fog/openvz/requests/compute/exec_server.rb', line 11 def exec_server(id, args = []) Fog::Mock.not_implemented end |
#get_server_details(id) ⇒ Object
11 12 13 |
# File 'lib/fog/openvz/requests/compute/get_server_details.rb', line 11 def get_server_details(id) return self.data[:servers].find { |s| s['ctid'].to_s == id.to_s } end |
#list_servers ⇒ Object
11 12 13 |
# File 'lib/fog/openvz/requests/compute/list_servers.rb', line 11 def list_servers self.data[:servers] end |
#mount_server(id, options = {}) ⇒ Object
11 12 13 |
# File 'lib/fog/openvz/requests/compute/mount_server.rb', line 11 def mount_server(id, = {}) Fog::Mock.not_implemented end |
#quotainit_server(id, options = {}) ⇒ Object
11 12 13 |
# File 'lib/fog/openvz/requests/compute/quotainit_server.rb', line 11 def quotainit_server(id, = {}) Fog::Mock.not_implemented end |
#quotaon_server(id, options = {}) ⇒ Object
11 12 13 |
# File 'lib/fog/openvz/requests/compute/quotaon_server.rb', line 11 def quotaon_server(id, = {}) Fog::Mock.not_implemented end |
#quotaooff_server(id, options = {}) ⇒ Object
11 12 13 |
# File 'lib/fog/openvz/requests/compute/quotaoff_server.rb', line 11 def quotaooff_server(id, = {}) Fog::Mock.not_implemented end |
#reset_data ⇒ Object
63 64 65 |
# File 'lib/fog/openvz/compute.rb', line 63 def reset_data self.class.data.delete(@openvz_connect_command) end |
#restart_server(id, options = {}) ⇒ Object
11 12 13 14 15 16 |
# File 'lib/fog/openvz/requests/compute/restart_server.rb', line 11 def restart_server(id, = {}) server = self.data[:servers].find { |s| s['ctid'] == id.to_s } unless server.nil? server['status'] = 'running' end end |
#resume_server(id, options = {}) ⇒ Object
11 12 13 |
# File 'lib/fog/openvz/requests/compute/resume_server.rb', line 11 def resume_server(id, = {}) Fog::Mock.not_implemented end |
#runscript_server(id, args = []) ⇒ Object
11 12 13 |
# File 'lib/fog/openvz/requests/compute/runscript_server.rb', line 11 def runscript_server(id,args = []) Fog::Mock.not_implemented end |
#set_server(id, options = {}) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/fog/openvz/requests/compute/set_server.rb', line 11 def set_server(id, = {}) server = self.data[:servers].find { |s| s['ctid'].to_s == id.to_s } unless server.nil? .each do |k,v| server[k] = v end end end |
#snapshot_delete_server(id, options = {}) ⇒ Object
11 12 13 |
# File 'lib/fog/openvz/requests/compute/snapshot_delete_server.rb', line 11 def snapshot_delete_server(id, = {}) Fog::Mock.not_implemented end |
#snapshot_list_server(id, options = {}) ⇒ Object
11 12 13 |
# File 'lib/fog/openvz/requests/compute/snapshot_list_server.rb', line 11 def snapshot_list_server(id, = {}) Fog::Mock.not_implemented end |
#snapshot_mount_server(id, options = {}) ⇒ Object
11 12 13 |
# File 'lib/fog/openvz/requests/compute/snapshot_mount_server.rb', line 11 def snapshot_mount_server(id, = {}) Fog::Mock.not_implemented end |
#snapshot_server(id, options = {}) ⇒ Object
11 12 13 |
# File 'lib/fog/openvz/requests/compute/snapshot_server.rb', line 11 def snapshot_server(id, = {}) Fog::Mock.not_implemented end |
#snapshot_switch_server(id, options = {}) ⇒ Object
11 12 13 |
# File 'lib/fog/openvz/requests/compute/snapshot_switch_server.rb', line 11 def snapshot_switch_server(id, = {}) Fog::Mock.not_implemented end |
#snapshot_umount_server(id, options = {}) ⇒ Object
11 12 13 |
# File 'lib/fog/openvz/requests/compute/snapshot_umount_server.rb', line 11 def snapshot_umount_server(id, = {}) Fog::Mock.not_implemented end |
#start_server(id, options = {}) ⇒ Object
11 12 13 14 15 16 |
# File 'lib/fog/openvz/requests/compute/start_server.rb', line 11 def start_server(id,={}) server = self.data[:servers].find { |s| s['ctid'].to_s == id.to_s } unless server.nil? server['status'] = 'running' end end |
#status_server(id, options = {}) ⇒ Object
11 12 13 |
# File 'lib/fog/openvz/requests/compute/status_server.rb', line 11 def status_server(id, = {}) Fog::Mock.not_implemented end |
#stop_server(id, options = {}) ⇒ Object
11 12 13 14 15 16 |
# File 'lib/fog/openvz/requests/compute/stop_server.rb', line 11 def stop_server(id, = {}) server = self.data[:servers].find { |s| s['ctid'].to_s == id.to_s } unless server.nil? server['status'] = 'stopped' end end |
#suspend_server(id, options = {}) ⇒ Object
11 12 13 |
# File 'lib/fog/openvz/requests/compute/suspend_server.rb', line 11 def suspend_server(id, = {}) Fog::Mock.not_implemented end |
#umount_server(id, options = {}) ⇒ Object
11 12 13 |
# File 'lib/fog/openvz/requests/compute/umount_server.rb', line 11 def umount_server(id, = {}) Fog::Mock.not_implemented end |