Module: FogExtensions::Azure::Servers

Extended by:
ActiveSupport::Concern
Defined in:
app/models/concerns/fog_extensions/azure/servers.rb

Instance Method Summary collapse

Instance Method Details

#all_with_patched_arguments(_options = {}) ⇒ Object

Azure servers.all doesn’t take any argument, against the fog standard, so we override the method. github.com/fog/fog-azure/pull/25



14
15
16
# File 'app/models/concerns/fog_extensions/azure/servers.rb', line 14

def all_with_patched_arguments(_options = {})
  all_without_patched_arguments
end

#get_with_cloud_service_patch(identity, cloud_service_name = nil) ⇒ Object

Azure servers.get takes 2 arguments, the cloud service name and the vm_name. This is against the fog standard, however it’s not possible to uniquely find a VM with just one argument. Instead, we try our best (see models/foreman_azure/azure.rb#find_vm_by_uuid for a similar method) to find it.



23
24
25
26
27
28
# File 'app/models/concerns/fog_extensions/azure/servers.rb', line 23

def get_with_cloud_service_patch(identity, cloud_service_name = nil)
  cloud_service_name ||= identity
  cloud_service_vm = get_without_cloud_service_patch(identity, cloud_service_name)
  return cloud_service_vm if cloud_service_vm.present?
  find { |vm| vm.vm_name == identity }
end