foreman_datacenter 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e154fe5ab9be2e7d64a586a3395e9382c02c5722
4
- data.tar.gz: 73b922e8071601cae1149d1e70044d402b02535e
3
+ metadata.gz: 76f5b1abf0cce09777cce5f45036844100f191d1
4
+ data.tar.gz: 0d0bb581e1af837951a9faca94fda6918b9f77cc
5
5
  SHA512:
6
- metadata.gz: f3db7ebe2a0846f7d2a1e7550876c4ce35e0d4e9335abc2a0c452645d3e07494329b77a14eec855ef3d4eda1a165d47909ea1cc48cc4d858f6c74e6c24868f91
7
- data.tar.gz: 3181025341807ee9b7a49d46731ede52571cef861606a0b562de39b0db13d7ad402ef320b9ea4dedd75e9ac326decbec3ebbab8b2a8eb0c7eb73036268d4fa71
6
+ metadata.gz: 830efe9ae3bbf0a6a1835a95b86841f1c9751434454762f6c65075c707b7801e703640aa56edb242355511e5cbdaf7423c89202d9a1a4257996b39ed56b0dabc
7
+ data.tar.gz: dccfa972aefe23c9aa20cf81ebfe9c1bdce4e14188f777e9012aeec8ed0e5e9e85a5993f8cddbe5a49934bf8348f054951685e471b3daf6a890f3cdb4e2f7daf
@@ -18,6 +18,8 @@ module ForemanDatacenter
18
18
  has_many :non_management_interfaces, -> { where(mgmt_only: false) },
19
19
  :class_name => 'ForemanDatacenter::DeviceInterface'
20
20
  has_many :modules, :class_name => 'ForemanDatacenter::DeviceModule'
21
+ has_one :ipmi_interface, -> { where(name: 'ipmi', mgmt_only: true) },
22
+ :class_name => 'ForemanDatacenter::DeviceInterface'
21
23
  belongs_to_host
22
24
 
23
25
  enum face: [:front, :rear]
@@ -47,7 +49,11 @@ module ForemanDatacenter
47
49
  end
48
50
 
49
51
  def ip_address
50
- primary_ip4 || primary_ip6
52
+ ipmi_interface.try(:ip_address) || primary_ip4
53
+ end
54
+
55
+ def mac_address
56
+ ipmi_interface.try(:mac_address)
51
57
  end
52
58
 
53
59
  def manufacturer_id
@@ -97,6 +103,8 @@ module ForemanDatacenter
97
103
  self.name = host.name
98
104
  device_type = DeviceType.for_host(host)
99
105
  self.device_type = device_type if device_type
106
+ serial = host.fact_value_by_name('serialnumber')
107
+ self.serial = serial.value if serial
100
108
  end
101
109
 
102
110
  private
@@ -114,7 +122,8 @@ module ForemanDatacenter
114
122
  name: interface.identifier,
115
123
  form_factor: ForemanDatacenter::DeviceInterface::DEFAULT_FORM_FACTOR,
116
124
  mac_address: interface.mac,
117
- ip_address: interface.ip
125
+ ip_address: interface.ip,
126
+ mgmt_only: interface.identifier == 'ipmi'
118
127
  )
119
128
  end
120
129
  end
@@ -104,10 +104,10 @@
104
104
  <tr>
105
105
  <td>Primary IPv4</td>
106
106
  <td>
107
- <% if @device.primary_ip4.blank? %>
107
+ <% if @device.ip_address.blank? %>
108
108
  Not defined
109
109
  <% else %>
110
- <%= @device.primary_ip4 %></td>
110
+ <%= @device.ip_address %></td>
111
111
  <% end %>
112
112
  </tr>
113
113
  <tr>
@@ -116,9 +116,20 @@
116
116
  <% if @device.primary_ip6.blank? %>
117
117
  Not defined
118
118
  <% else %>
119
- <%= @device.primary_ip6 %></td>
119
+ <%= @device.primary_ip6 %>
120
120
  <% end %>
121
- </tr>
121
+ </td>
122
+ </tr>
123
+ <tr>
124
+ <td>MAC address</td>
125
+ <td>
126
+ <% if @device.mac_address.blank? %>
127
+ Not defined
128
+ <% else %>
129
+ <%= @device.mac_address %>
130
+ <% end %>
131
+ </td>
132
+ </tr>
122
133
  </tbody>
123
134
  </table>
124
135
  </div>
@@ -1,3 +1,3 @@
1
1
  module ForemanDatacenter
2
- VERSION = '0.1.0'.freeze
2
+ VERSION = '0.1.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_datacenter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pavel Ivanov