Class: ForemanFogProxmox::Proxmox
- Inherits:
-
ComputeResource
- Object
- ComputeResource
- ForemanFogProxmox::Proxmox
- Includes:
- ProxmoxComputeAttributes, ProxmoxConnection, ProxmoxConsole, ProxmoxImages, ProxmoxInterfaces, ProxmoxOperatingSystems, ProxmoxVersion, ProxmoxVmCommands, ProxmoxVmNew, ProxmoxVmQueries, ProxmoxVolumes, ProxmoxVmHelper
- Defined in:
- app/models/foreman_fog_proxmox/proxmox.rb
Constant Summary
Constants included from ProxmoxVmUuidHelper
ProxmoxVmUuidHelper::UUID_REGEXP
Class Method Summary collapse
Instance Method Summary collapse
- #associate_by(name, attributes) ⇒ Object
- #associated_host(vm) ⇒ Object
- #auth_method ⇒ Object
- #auth_method=(value) ⇒ Object
- #capabilities ⇒ Object
- #certs_to_store ⇒ Object
- #provided_attributes ⇒ Object
- #ssl_certs ⇒ Object
- #ssl_certs=(value) ⇒ Object
- #ssl_verify_peer ⇒ Object
- #ssl_verify_peer=(value) ⇒ Object
- #token ⇒ Object
- #token=(value) ⇒ Object
- #token_id ⇒ Object
- #token_id=(value) ⇒ Object
Methods included from ProxmoxConsole
Methods included from ProxmoxVersion
Methods included from ProxmoxOperatingSystems
#available_linux_operating_systems, #available_operating_systems, #available_windows_operating_systems, #compute_os_types, #os_linux_types_mapping, #os_windows_types_mapping
Methods included from ProxmoxImages
#available_images, #clone_from_image, #image_exists?, #images_by_storage, #template, #template_name, #template_uuid, #templates
Methods included from ProxmoxInterfaces
#check_cidr, #cidr_prefix, #cidr_prefix_method, #container?, #container_nic_name_valid?, #dhcp?, #editable_network_interfaces?, #host_interfaces_attrs, #ip_s, #set_container_interface_name, #set_ip, #set_mac, #set_nic_identifier, #to_boolean, #to_cidr_method, #v6_s, #vm_type
Methods included from ProxmoxVolumes
#add_volume, #delete_volume, #extend_volume, #extract_id, #move_volume, #save_volume, #update_cdrom, #update_options, #update_volume, #update_volume_required?, #volume_exists?, #volume_options, #volume_to_delete?
Methods included from ProxmoxVmHelper
#parse_typed_vm, #vm_collection
Methods included from ProxmoxVmOsTemplateHelper
#ostemplate_keys, #parse_container_ostemplate, #parse_ostemplate, #parse_ostemplate_without_keys
Methods included from ProxmoxVmConfigHelper
#args_a, #config_a, #config_general_or_ostemplate_key?, #config_options, #config_typed_keys, #general_a, #object_to_config_hash, #parse_typed_cpu, #parse_typed_memory, #parsed_typed_config
Methods included from ProxmoxVmVolumesHelper
#add_disk_options, #add_typed_volume, #parse_hard_disk_volume, #parse_typed_volume, #parse_typed_volumes, #parsed_typed_volumes, #remove_volume_keys, #volume_type?
Methods included from ProxmoxVmCloudinitHelper
Methods included from ProxmoxVmCdromHelper
Methods included from ProxmoxVmInterfacesHelper
#add_or_delete_typed_interface, #compute_dhcps, #interface_common_typed_keys, #interface_compute_attributes_typed_keys, #parse_typed_interfaces, #parsed_typed_interfaces
Methods included from ProxmoxComputeAttributes
#host_compute_attrs, #interface_compute_attributes, #not_config_key?, #vm_compute_attributes
Methods included from ProxmoxVmQueries
#bridges, #find_vm_by_uuid, #find_vm_in_servers_by_vmid, #nodes, #storages, #vms
Methods included from ProxmoxVmUuidHelper
#extract, #extract_vmid, #match_uuid?
Methods included from ProxmoxPools
#add_vm_to_pool, #pool_owner, #pools, #remove_vm_from_pool, #update_pool
Methods included from ProxmoxVmCommands
#compute_clone_attributes, #compute_config_attributes, #create_vm, #destroy_vm, #save_vm, #start_on_boot, #supports_update?, #user_data_supported?
Methods included from ProxmoxVmNew
#add_default_typed_interface, #add_default_typed_volume, #cdrom_defaults, #cloudinit_defaults, #config_attributes, #convert_config_attributes, #default_node, #default_node_id, #hard_disk_typed_defaults, #interface_defaults, #interface_typed_defaults, #new_interface, #new_typed_interface, #new_typed_vm, #new_typed_volume, #new_vm, #new_volume, #next_vmid, #vm_instance_defaults, #vm_typed_instance_defaults
Methods included from ProxmoxConnection
#access_ticket?, #connection_options, #credentials_valid?, #current_user_token_expire, #disconnect, #test_connection, #user_token?
Class Method Details
.model_name ⇒ Object
60 61 62 |
# File 'app/models/foreman_fog_proxmox/proxmox.rb', line 60 def self.model_name ComputeResource.model_name end |
.provider_friendly_name ⇒ Object
52 53 54 |
# File 'app/models/foreman_fog_proxmox/proxmox.rb', line 52 def self.provider_friendly_name 'Proxmox' end |
Instance Method Details
#associate_by(name, attributes) ⇒ Object
68 69 70 71 |
# File 'app/models/foreman_fog_proxmox/proxmox.rb', line 68 def associate_by(name, attributes) Host.(:view_hosts, Host).joins(:primary_interface).where(:nics => { :primary => true }).where("nics.#{name}".downcase => attributes.downcase).readonly(false).first end |
#associated_host(vm) ⇒ Object
64 65 66 |
# File 'app/models/foreman_fog_proxmox/proxmox.rb', line 64 def associated_host(vm) associate_by('mac', vm.mac) end |
#auth_method ⇒ Object
103 104 105 |
# File 'app/models/foreman_fog_proxmox/proxmox.rb', line 103 def auth_method attrs[:auth_method] || 'access_ticket' end |
#auth_method=(value) ⇒ Object
107 108 109 |
# File 'app/models/foreman_fog_proxmox/proxmox.rb', line 107 def auth_method=(value) attrs[:auth_method] = value end |
#capabilities ⇒ Object
56 57 58 |
# File 'app/models/foreman_fog_proxmox/proxmox.rb', line 56 def capabilities [:build, :new_volume, :new_interface, :image] end |
#certs_to_store ⇒ Object
81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'app/models/foreman_fog_proxmox/proxmox.rb', line 81 def certs_to_store return if ssl_certs.blank? store = OpenSSL::X509::Store.new ssl_certs.split(/(?=-----BEGIN)/).each do |cert| x509_cert = OpenSSL::X509::Certificate.new cert store.add_cert x509_cert end store rescue StandardError => e logger.error(e) raise ::Foreman::Exception, N_('Unable to store X509 certificates') end |
#provided_attributes ⇒ Object
46 47 48 49 50 |
# File 'app/models/foreman_fog_proxmox/proxmox.rb', line 46 def provided_attributes super.merge( :mac => :mac ) end |
#ssl_certs ⇒ Object
73 74 75 |
# File 'app/models/foreman_fog_proxmox/proxmox.rb', line 73 def ssl_certs attrs[:ssl_certs] end |
#ssl_certs=(value) ⇒ Object
77 78 79 |
# File 'app/models/foreman_fog_proxmox/proxmox.rb', line 77 def ssl_certs=(value) attrs[:ssl_certs] = value end |
#ssl_verify_peer ⇒ Object
95 96 97 |
# File 'app/models/foreman_fog_proxmox/proxmox.rb', line 95 def ssl_verify_peer attrs[:ssl_verify_peer].blank? ? false : Foreman::Cast.to_bool(attrs[:ssl_verify_peer]) end |
#ssl_verify_peer=(value) ⇒ Object
99 100 101 |
# File 'app/models/foreman_fog_proxmox/proxmox.rb', line 99 def ssl_verify_peer=(value) attrs[:ssl_verify_peer] = value end |
#token ⇒ Object
119 120 121 |
# File 'app/models/foreman_fog_proxmox/proxmox.rb', line 119 def token attrs[:token] end |
#token=(value) ⇒ Object
123 124 125 |
# File 'app/models/foreman_fog_proxmox/proxmox.rb', line 123 def token=(value) attrs[:token] = value end |
#token_id ⇒ Object
111 112 113 |
# File 'app/models/foreman_fog_proxmox/proxmox.rb', line 111 def token_id attrs[:token_id] end |
#token_id=(value) ⇒ Object
115 116 117 |
# File 'app/models/foreman_fog_proxmox/proxmox.rb', line 115 def token_id=(value) attrs[:token_id] = value end |