Class: Fog::Compute::Azure::Servers
- Inherits:
-
Fog::Collection
- Object
- Fog::Collection
- Fog::Compute::Azure::Servers
- Defined in:
- lib/fog/azure/models/compute/servers.rb
Instance Method Summary collapse
Instance Method Details
#all ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/fog/azure/models/compute/servers.rb', line 31 def all() servers = [] service.list_virtual_machines.each do |vm| hash = {} vm.instance_variables.each do |var| hash[var.to_s.delete("@")] = vm.instance_variable_get(var) end hash[:vm_user] = "azureuser" if hash[:vm_user].nil? servers << hash end load(servers) end |
#bootstrap(new_attributes = {}) ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/fog/azure/models/compute/servers.rb', line 50 def bootstrap(new_attributes = {}) defaults = { :vm_name => "fog-#{Time.now.to_i}", :vm_user => "azureuser", :image => "b39f27a8b8c64d52b05eac6a62ebad85__Ubuntu-12_04_3-LTS-amd64-server-20131205-en-us-30GB", :location => "Central US", :private_key_file => File.("~/.ssh/id_rsa"), :vm_size => "Small", } server = create(defaults.merge(new_attributes)) server.wait_for { sshable? } unless server.private_key_file.nil? server end |
#get(identity, cloud_service_name) ⇒ Object
44 45 46 47 48 |
# File 'lib/fog/azure/models/compute/servers.rb', line 44 def get(identity, cloud_service_name) all.find { |f| f.name == identity && f.cloud_service_name == cloud_service_name } rescue Fog::Errors::NotFound nil end |