foreman_datacenter 0.1.16 → 0.1.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +27 -18
- data/app/controllers/foreman_datacenter/devices_controller.rb +1 -1
- data/app/models/foreman_datacenter/device.rb +10 -5
- data/app/models/foreman_datacenter/rack.rb +13 -1
- data/app/views/foreman_datacenter/racks/_device_position.html.erb +2 -2
- data/app/views/foreman_datacenter/racks/_device_position.html.erb.back +28 -0
- data/lib/foreman_datacenter/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4bfcfe691d56b5274d821b993d211882e4204c03
|
4
|
+
data.tar.gz: 441cbf172257fca2c0570fa6c611f84d48dcf5fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 232ebc810f7c3dda06f939eea57f8b6989ccdf4b53437eb7c175491451a6539511bfb9614a9010b8f9d0e1ce44b87d63c93180f0ebc61d842bdf77d917430b09
|
7
|
+
data.tar.gz: 37ffaa904453442a790f5cf17d9ee6d112eab189c292c4f228719d818f27f573c6fe0489a0a7d3bc87c107a720bbababf5c3d4921b9c6dc65c6c0cccbc8517fb
|
data/README.md
CHANGED
@@ -1,19 +1,34 @@
|
|
1
|
-
#
|
1
|
+
# Foreman Datacenter Plugin
|
2
2
|
|
3
|
-
|
3
|
+
This plugin lets you document your physical servers across multiple datacenters. It documents racks, devices, interfaces, connections between machines (servers or switches).
|
4
|
+
|
5
|
+
Foreman Datacenter plugin documents following:
|
6
|
+
|
7
|
+
* **Sites** - contains all physical locations (datacenters) where servers are stored
|
8
|
+
* **Racks** - contains all racks across all datacenters
|
9
|
+
* **Rack groups** - group of racks, e.g. one room where this group of racks is stored
|
10
|
+
* **Devices** - contains all devices (switches, servers, etc.)
|
11
|
+
* **Device types** - contains all device types (e.g. HP ProLiant DL180 G6)
|
12
|
+
* **Device roles** - e.g. server, switch, etc.
|
13
|
+
* **Manufactures** - contains all manufacturers (HP, Dell, etc.)
|
14
|
+
* **Platforms** - e.g. ipmi, mgmt interface, etc.
|
15
|
+
* **Console connections** - lists all e.g. RS232 connections
|
16
|
+
* **Power connections** - lists all connections of power cables
|
17
|
+
* **Interface connections** - lists all connections between interfaces
|
4
18
|
|
5
19
|
## Installation
|
6
20
|
|
7
|
-
See [
|
8
|
-
for how to install Foreman plugins
|
21
|
+
See [Plugins Installation](https://theforeman.org/plugins/#2.Installation) for how to install Foreman plugins.
|
9
22
|
|
10
23
|
## Usage
|
11
24
|
|
12
|
-
|
25
|
+
### Create a device type
|
26
|
+
|
27
|
+
Here you can create a particular device type, for example a model of switch and then create all interfaces only here, so when you create a particular switch, it will have all the desired interfaces. Just click on **Device types** -> **New device type**, fill in information and save. Then click on the desired device type and you can add all the interfaces here.
|
13
28
|
|
14
|
-
|
29
|
+
### Create a device
|
15
30
|
|
16
|
-
|
31
|
+
You can either just create a device - then you have to create first Manufacturer, Device Type, Device Role, Platform; or you can import device from Puppet facts (this feature is still in development phase) - you just click **Devices** -> **Import from host** and then will search your host and click **Import to device**. Then you will get a page with additional information about the machine to be filled like location, position in rack, etc. Once device is created, you can list it in **Devices** section and when you click on this device, you can fill in additional information, e.g. connect its interfaces to a switch, etc.
|
17
32
|
|
18
33
|
## Contributing
|
19
34
|
|
@@ -21,18 +36,12 @@ Fork and send a Pull Request. Thanks!
|
|
21
36
|
|
22
37
|
## Copyright
|
23
38
|
|
24
|
-
Copyright (c) *
|
39
|
+
Copyright (c) *cloudevelops, Inc.*
|
25
40
|
|
26
|
-
|
27
|
-
it under the terms of the GNU General Public License as published by
|
28
|
-
the Free Software Foundation, either version 3 of the License, or
|
29
|
-
(at your option) any later version.
|
41
|
+
Authors: *Pavel Ivanov* and *Eugene Loginov*
|
30
42
|
|
31
|
-
This program is
|
32
|
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
33
|
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
34
|
-
GNU General Public License for more details.
|
43
|
+
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
35
44
|
|
36
|
-
|
37
|
-
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
45
|
+
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
38
46
|
|
47
|
+
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
|
@@ -107,7 +107,7 @@ module ForemanDatacenter
|
|
107
107
|
params[:device].permit(:device_type_id, :device_role_id, :platform_id,
|
108
108
|
:name, :serial, :rack_id, :position, :side,
|
109
109
|
:face, :status, :primary_ip4, :primary_ip6, :comments,
|
110
|
-
:host_id)
|
110
|
+
:host_id, :size)
|
111
111
|
end
|
112
112
|
|
113
113
|
def populate_from_host
|
@@ -114,6 +114,16 @@ module ForemanDatacenter
|
|
114
114
|
match[1] if match
|
115
115
|
end
|
116
116
|
|
117
|
+
def rack_positions
|
118
|
+
result = []
|
119
|
+
if size.nil?
|
120
|
+
result << position
|
121
|
+
else
|
122
|
+
size.times{ |p| result << (position + p) }
|
123
|
+
end
|
124
|
+
return result
|
125
|
+
end
|
126
|
+
|
117
127
|
private
|
118
128
|
|
119
129
|
def create_interfaces
|
@@ -172,10 +182,5 @@ module ForemanDatacenter
|
|
172
182
|
end
|
173
183
|
end
|
174
184
|
|
175
|
-
# def positions
|
176
|
-
# result = []
|
177
|
-
# size.times{ |p| result << (position + p) }
|
178
|
-
# return result
|
179
|
-
# end
|
180
185
|
end
|
181
186
|
end
|
@@ -14,8 +14,20 @@ module ForemanDatacenter
|
|
14
14
|
devices.where(position: position).to_a
|
15
15
|
end
|
16
16
|
|
17
|
+
# def positioned_devices
|
18
|
+
# height.downto(1).map { |position| [position, device_at(position)] }
|
19
|
+
# end
|
20
|
+
|
17
21
|
def positioned_devices
|
18
|
-
|
22
|
+
devs = devices.map{ |d| [d.positions, [d]] }
|
23
|
+
result = []
|
24
|
+
i = 1
|
25
|
+
loop do
|
26
|
+
current_device = devs.select{ |d| d[0].include?(i) }
|
27
|
+
current_device == [] ? (result << [[i],[]]; i +=1 ) : (result << current_device[0]; i = current_device[0][0].last + 1)
|
28
|
+
break if i > height
|
29
|
+
end
|
30
|
+
return result
|
19
31
|
end
|
20
32
|
end
|
21
33
|
end
|
@@ -3,9 +3,9 @@
|
|
3
3
|
<div class="panel-heading"><strong>Devices</strong></div>
|
4
4
|
<table class="table table-hover panel-body">
|
5
5
|
<tbody>
|
6
|
-
<% @rack.positioned_devices.each do |
|
6
|
+
<% @rack.positioned_devices.each do |positions, devices| %>
|
7
7
|
<tr>
|
8
|
-
<td class="col-md-1"><%=
|
8
|
+
<td class="col-md-1"><%= raw(positions.map{|p| "#{p}U"}.join("<br />")) %></td>
|
9
9
|
<td class="col-md-4">
|
10
10
|
<% unless devices.empty? %>
|
11
11
|
<% devices.each do |d| %>
|
@@ -0,0 +1,28 @@
|
|
1
|
+
<div class="col-md-5">
|
2
|
+
<div class="panel panel-default">
|
3
|
+
<div class="panel-heading"><strong>Devices</strong></div>
|
4
|
+
<table class="table table-hover panel-body">
|
5
|
+
<tbody>
|
6
|
+
<% @rack.positioned_devices.each do |position, devices| %>
|
7
|
+
<tr>
|
8
|
+
<td class="col-md-1"><%= position %>U</td>
|
9
|
+
<td class="col-md-4">
|
10
|
+
<% unless devices.empty? %>
|
11
|
+
<% devices.each do |d| %>
|
12
|
+
<div class="<%= "text-" + ((d.side == "full" or d.side.nil?) ? "center" : "right") + " pull-" + ((d.side == "full" or d.side.nil?) ? "center" : d.side) %>">
|
13
|
+
<%= link_to d.name, device_path(d) %>
|
14
|
+
<% if d.side.nil? %>
|
15
|
+
*
|
16
|
+
<% end %>
|
17
|
+
</div>
|
18
|
+
<% end %>
|
19
|
+
<% end %>
|
20
|
+
</td>
|
21
|
+
</tr>
|
22
|
+
<% end %>
|
23
|
+
</tbody>
|
24
|
+
</table>
|
25
|
+
</div>
|
26
|
+
<div><h6 class="text-right">* side is not defined</h6></div>
|
27
|
+
</div>
|
28
|
+
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman_datacenter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pavel Ivanov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-09-
|
11
|
+
date: 2017-09-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: deface
|
@@ -272,6 +272,7 @@ files:
|
|
272
272
|
- app/views/foreman_datacenter/rack_groups/new.html.erb
|
273
273
|
- app/views/foreman_datacenter/rack_groups/show.html.erb
|
274
274
|
- app/views/foreman_datacenter/racks/_device_position.html.erb
|
275
|
+
- app/views/foreman_datacenter/racks/_device_position.html.erb.back
|
275
276
|
- app/views/foreman_datacenter/racks/_form.html.erb
|
276
277
|
- app/views/foreman_datacenter/racks/_rack_groups.html.erb
|
277
278
|
- app/views/foreman_datacenter/racks/edit.html.erb
|