Module: FogExtensions::Gridscale::Server
- Extended by:
- ActiveSupport::Concern
- Defined in:
- app/models/concerns/fog_extensions/gridscale/server.rb
Instance Attribute Summary collapse
-
#interfaces_attributes ⇒ Object
Returns the value of attribute interfaces_attributes.
-
#ipv4_address ⇒ Object
Returns the value of attribute ipv4_address.
-
#ipv6_address ⇒ Object
Returns the value of attribute ipv6_address.
-
#mac ⇒ Object
Returns the value of attribute mac.
-
#object_uuid ⇒ Object
Returns the value of attribute object_uuid.
-
#server_uuid ⇒ Object
Returns the value of attribute server_uuid.
Instance Method Summary collapse
- #ip4_add_in ⇒ Object
- #ip6_add_in ⇒ Object
- #ip_addresses ⇒ Object
- #mac_addr ⇒ Object
- #reset ⇒ Object
- #select_nic(fog_nics, nic) ⇒ Object
- #state ⇒ Object
- #to_s ⇒ Object
- #vm_description ⇒ Object
Instance Attribute Details
#interfaces_attributes ⇒ Object
Returns the value of attribute interfaces_attributes.
6 7 8 |
# File 'app/models/concerns/fog_extensions/gridscale/server.rb', line 6 def interfaces_attributes @interfaces_attributes end |
#ipv4_address ⇒ Object
Returns the value of attribute ipv4_address.
6 7 8 |
# File 'app/models/concerns/fog_extensions/gridscale/server.rb', line 6 def ipv4_address @ipv4_address end |
#ipv6_address ⇒ Object
Returns the value of attribute ipv6_address.
6 7 8 |
# File 'app/models/concerns/fog_extensions/gridscale/server.rb', line 6 def ipv6_address @ipv6_address end |
#mac ⇒ Object
Returns the value of attribute mac.
6 7 8 |
# File 'app/models/concerns/fog_extensions/gridscale/server.rb', line 6 def mac @mac end |
#object_uuid ⇒ Object
Returns the value of attribute object_uuid.
6 7 8 |
# File 'app/models/concerns/fog_extensions/gridscale/server.rb', line 6 def object_uuid @object_uuid end |
#server_uuid ⇒ Object
Returns the value of attribute server_uuid.
6 7 8 |
# File 'app/models/concerns/fog_extensions/gridscale/server.rb', line 6 def server_uuid @server_uuid end |
Instance Method Details
#ip4_add_in ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'app/models/concerns/fog_extensions/gridscale/server.rb', line 32 def ip4_add_in x = nil if interfaces_attributes != nil interfaces_attributes.each do |key, value| if value["ipv4_uuid"] !=nil && value["ipv4_uuid"] != "" x = service.ips.get(value["ipv4_uuid"]) end end end x.ip end |
#ip6_add_in ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'app/models/concerns/fog_extensions/gridscale/server.rb', line 45 def ip6_add_in x = nil if interfaces_attributes != nil interfaces_attributes.each do |key, value| if value["ipv6_uuid"] !=nil && value["ipv6_uuid"] != "" x = service.ips.get(value["ipv6_uuid"]) end end end x.ip end |
#ip_addresses ⇒ Object
27 28 29 30 |
# File 'app/models/concerns/fog_extensions/gridscale/server.rb', line 27 def ip_addresses [ipv4_address, ipv6_address].flatten.select(&:present?) end |
#mac_addr ⇒ Object
58 59 60 |
# File 'app/models/concerns/fog_extensions/gridscale/server.rb', line 58 def mac_addr :mac end |
#reset ⇒ Object
19 20 21 |
# File 'app/models/concerns/fog_extensions/gridscale/server.rb', line 19 def reset reboot end |
#select_nic(fog_nics, nic) ⇒ Object
62 63 64 65 |
# File 'app/models/concerns/fog_extensions/gridscale/server.rb', line 62 def select_nic(fog_nics, nic) # foreman-xenserver uses fog_nics[0] here, so I'll just copy that for now. fog_nics[0] end |
#state ⇒ Object
10 11 12 13 |
# File 'app/models/concerns/fog_extensions/gridscale/server.rb', line 10 def state requires :status @state ||= status end |
#to_s ⇒ Object
15 16 17 |
# File 'app/models/concerns/fog_extensions/gridscale/server.rb', line 15 def to_s name end |
#vm_description ⇒ Object
23 24 25 |
# File 'app/models/concerns/fog_extensions/gridscale/server.rb', line 23 def vm_description format(_('%{cpus} CPUs and %{ram} memory'), :cpus => cores, :ram => memory) end |