foreman_custom_tab 0.1.1 → 0.2.0
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 45ffcb2d4091bf3844ae1e1681d3857d3e47853a
|
4
|
+
data.tar.gz: 81883825ea4cdd6b5dea970e73fb2f62694a8abc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ae87d56ebb27965d13b7f0b1265985e98997f8450c1823317053779de2eb9d935eac9ac7b885cd0561a33e641fe1201f62cdee8d3d3fce8e7f074880d06f012d
|
7
|
+
data.tar.gz: 701e58f41f59625499ca75941b1eedc9c74b06a1fdf0df472f8ea872ae4e82a967e710bb304024d6263f15b654bf9b2a3c4a1c4aa1c8fa9c793f460efd504871
|
data/README.md
CHANGED
@@ -14,7 +14,7 @@ bundle update foreman_custom_tab
|
|
14
14
|
|
15
15
|
## Configuration
|
16
16
|
|
17
|
-
If there is no configuration file then the tab should not appear on the detailed hosts screen, but if
|
17
|
+
If there is no configuration file then the tab should not appear on the detailed hosts screen, but if
|
18
18
|
there is one and it is empty then it will appear without any fields. To setup the configuration file create
|
19
19
|
a new file named 'foreman_custom_tab.yaml' at the location /etc/foreman/plugins/
|
20
20
|
|
@@ -23,16 +23,19 @@ The keys are the display title and the values are the methods that are actually
|
|
23
23
|
Example configuration:
|
24
24
|
|
25
25
|
```
|
26
|
+
---
|
26
27
|
:custom_tab:
|
27
|
-
:fields:
|
28
|
-
'Host Name': name
|
29
|
-
'MAC Address': mac
|
30
|
-
'IP Address': ip
|
31
|
-
'Architecture': arch
|
32
|
-
'Certificate Name': certname
|
33
|
-
'OS Title': operatingsystem.title
|
34
|
-
'OS Type': operatingsystem.type
|
35
28
|
:title: foo
|
29
|
+
:fields:
|
30
|
+
Host Name: name
|
31
|
+
MAC Address: mac
|
32
|
+
IP Address: ip
|
33
|
+
Architecture: arch
|
34
|
+
Certificate Name: certname
|
35
|
+
OS Title: operatingsystem.title
|
36
|
+
OS Type: operatingsystem.type
|
37
|
+
Puppet Version: facts[puppetversion]
|
38
|
+
Ruby Version: facts.fetch(rubyversion)
|
36
39
|
```
|
37
40
|
|
38
41
|
## Verify the Custom Tab is loaded
|
@@ -49,7 +52,7 @@ Note: foreman running locally (i.e not installed via rpm/debian package) does no
|
|
49
52
|
|
50
53
|
## Notes
|
51
54
|
|
52
|
-
This project is still incomplete and in development.
|
55
|
+
This project is still incomplete and in development.
|
53
56
|
|
54
57
|
Copyright (c) 2017 Joe Lyons Stannard III
|
55
58
|
|
@@ -65,4 +68,3 @@ GNU General Public License for more details.
|
|
65
68
|
|
66
69
|
You should have received a copy of the GNU General Public License
|
67
70
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
68
|
-
|
@@ -6,10 +6,15 @@ module ForemanCustomTab
|
|
6
6
|
fields = []
|
7
7
|
config_fields = SETTINGS[:custom_tab][:fields] || []
|
8
8
|
config_fields.each do |key, value|
|
9
|
-
host_attr_val = nil
|
10
9
|
# chain the method calls for attibutes like operatingsystem.title
|
11
|
-
value.split('.').
|
12
|
-
|
10
|
+
host_attr_val = value.split('.').inject(host) do |memo, method|
|
11
|
+
if m = method.match(/(.*)\((.*)\)/)
|
12
|
+
memo.try(*[m[1], *m[2].split(/,\s?/)])
|
13
|
+
elsif m = method.match(/(.*)\[(.*)\]/)
|
14
|
+
memo.try(m[1]).try('[]', m[2])
|
15
|
+
else
|
16
|
+
memo.try(method)
|
17
|
+
end
|
13
18
|
end
|
14
19
|
fields += [[_(key.to_s), host_attr_val]] if host_attr_val.present?
|
15
20
|
end
|
data/test/test_plugin_helper.rb
CHANGED
@@ -6,7 +6,8 @@ SETTINGS[:custom_tab] = { fields: { 'Host Name' => 'name',
|
|
6
6
|
'Architecture' => 'arch',
|
7
7
|
'Certificate Name' => 'certname',
|
8
8
|
'OS Title' => 'operatingsystem.title',
|
9
|
-
'OS Type' => 'operatingsystem.type'
|
9
|
+
'OS Type' => 'operatingsystem.type',
|
10
|
+
'Puppet Version' => 'facts[puppetversion]' },
|
10
11
|
title: 'foo' }
|
11
12
|
|
12
13
|
# This calls the main test_helper in Foreman-core
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman_custom_tab
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joe Stannard
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-01-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: deface
|