foreman_discovery 1.1.1 → 1.2.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +13 -5
- data/README.md +19 -71
- data/Rakefile +15 -16
- data/app/controllers/discovers_controller.rb +10 -11
- data/app/helpers/discovers_helper.rb +9 -9
- data/app/models/host/discovered.rb +6 -5
- data/app/models/host/managed_extensions.rb +2 -2
- data/app/models/setting/discovered.rb +8 -2
- data/app/overrides/add_dashboard_table.rb +9 -4
- data/app/views/discovers/_discovers_list.html.erb +14 -14
- data/app/views/discovers/_selected_hosts.html.erb +8 -4
- data/app/views/discovers/multiple_destroy.html.erb +2 -1
- data/app/views/discovers/select_multiple_location.html.erb +2 -2
- data/app/views/discovers/select_multiple_organization.html.erb +2 -2
- data/app/views/discovers/show.html.erb +4 -4
- data/config/initializers/discovery_setup.rb +0 -17
- data/extra/ovirt-node-plugin-foreman/COPYING +340 -0
- data/extra/ovirt-node-plugin-foreman/Makefile.am +60 -0
- data/extra/ovirt-node-plugin-foreman/README.md +217 -0
- data/extra/ovirt-node-plugin-foreman/autogen.sh +66 -0
- data/extra/ovirt-node-plugin-foreman/conf/Makefile.am +29 -0
- data/extra/ovirt-node-plugin-foreman/conf/foreman-plugin.firewall.in +4 -0
- data/extra/ovirt-node-plugin-foreman/conf/foreman-plugin.logs +2 -0
- data/extra/ovirt-node-plugin-foreman/configure.ac +62 -0
- data/extra/ovirt-node-plugin-foreman/ovirt-node-plugin-foreman.spec.in +145 -0
- data/extra/ovirt-node-plugin-foreman/recipe/Makefile.am +33 -0
- data/extra/ovirt-node-plugin-foreman/recipe/foreman-plugin-iso.ks +5 -0
- data/extra/ovirt-node-plugin-foreman/recipe/foreman-plugin-minimizer.ks +160 -0
- data/extra/ovirt-node-plugin-foreman/src/Makefile.am +32 -0
- data/extra/ovirt-node-plugin-foreman/src/discover-host.rb.in +186 -0
- data/extra/ovirt-node-plugin-foreman/src/discover-host.service +14 -0
- data/extra/ovirt-node-plugin-foreman/src/discovery-version-fact.rb.in +25 -0
- data/extra/ovirt-node-plugin-foreman/src/find-missing-libs +35 -0
- data/lib/{tasks.rake → discovery.rake} +22 -0
- data/lib/foreman_discovery/engine.rb +39 -7
- data/lib/foreman_discovery/version.rb +1 -1
- data/test/functional/discovers_controller_test.rb +3 -16
- data/test/test_helper.rb +2 -2
- data/test/test_plugin_helper.rb +6 -0
- data/test/unit/facts.json +92 -0
- data/test/unit/host_discovered_test.rb +20 -2
- metadata +55 -37
- data/lib/discovery_home_helper_patch.rb +0 -18
- data/test/unit/facts.yml +0 -91
@@ -0,0 +1,25 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# vim: ts=2:sw=2:et
|
3
|
+
#
|
4
|
+
# Copyright (C) 2013 Red Hat, Inc.
|
5
|
+
#
|
6
|
+
# This program is free software; you can redistribute it and/or modify
|
7
|
+
# it under the terms of the GNU General Public License as published by
|
8
|
+
# the Free Software Foundation; version 2 of the License.
|
9
|
+
#
|
10
|
+
# This program is distributed in the hope that it will be useful,
|
11
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
|
+
# GNU General Public License for more details.
|
14
|
+
#
|
15
|
+
# You should have received a copy of the GNU General Public License
|
16
|
+
# along with this program; if not, write to the Free Software
|
17
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
18
|
+
# MA 02110-1301, USA. A copy of the GNU General Public License is
|
19
|
+
# also available at http://www.gnu.org/copyleft/gpl.html.
|
20
|
+
|
21
|
+
Facter.add("discovery_version") do
|
22
|
+
setcode do
|
23
|
+
'@PACKAGE_VERSION@'
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
#
|
3
|
+
# vim: ts=2:sw=2:et
|
4
|
+
#
|
5
|
+
# Copyright (C) 2013 Red Hat, Inc.
|
6
|
+
#
|
7
|
+
# This program is free software; you can redistribute it and/or modify
|
8
|
+
# it under the terms of the GNU General Public License as published by
|
9
|
+
# the Free Software Foundation; version 2 of the License.
|
10
|
+
#
|
11
|
+
# This program is distributed in the hope that it will be useful,
|
12
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
# GNU General Public License for more details.
|
15
|
+
#
|
16
|
+
# You should have received a copy of the GNU General Public License
|
17
|
+
# along with this program; if not, write to the Free Software
|
18
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19
|
+
# MA 02110-1301, USA. A copy of the GNU General Public License is
|
20
|
+
# also available at http://www.gnu.org/copyleft/gpl.html.
|
21
|
+
|
22
|
+
ifs=$IFS
|
23
|
+
IFS=':'
|
24
|
+
|
25
|
+
files=$(find /usr -type f)
|
26
|
+
IFS=$ifs
|
27
|
+
for i in $files
|
28
|
+
do
|
29
|
+
if [ `file $i | grep -c 'ELF'` -ne 0 ]; then
|
30
|
+
if [ `ldd $i 2>/dev/null | grep -c 'not found'` -ne 0 ]; then
|
31
|
+
echo "$i:"
|
32
|
+
ldd $i 2>/dev/null | grep 'not found'
|
33
|
+
fi
|
34
|
+
fi
|
35
|
+
done
|
@@ -42,6 +42,10 @@ namespace :discovery do
|
|
42
42
|
puts "please install advdef"
|
43
43
|
exit 1
|
44
44
|
end
|
45
|
+
unless system("echo -n 'testing dependency: ' ; which git")
|
46
|
+
puts "please install git"
|
47
|
+
exit 1
|
48
|
+
end
|
45
49
|
|
46
50
|
script = File.join(File.dirname(__FILE__), '..', 'extra', 'build_iso.sh')
|
47
51
|
builddir=''
|
@@ -75,3 +79,21 @@ namespace :discovery do
|
|
75
79
|
|
76
80
|
end
|
77
81
|
end
|
82
|
+
|
83
|
+
# Setup Tests
|
84
|
+
namespace :test do
|
85
|
+
desc "Test Discovery plugin"
|
86
|
+
Rake::TestTask.new(:discovery) do |t|
|
87
|
+
test_dir = File.join(File.dirname(__FILE__), '..', 'test')
|
88
|
+
t.libs << ["test",test_dir]
|
89
|
+
t.pattern = "#{test_dir}/**/*_test.rb"
|
90
|
+
t.verbose = true
|
91
|
+
end
|
92
|
+
end
|
93
|
+
Rake::Task[:test].enhance do
|
94
|
+
Rake::Task['test:discovery'].invoke
|
95
|
+
end
|
96
|
+
load 'tasks/jenkins.rake'
|
97
|
+
Rake::Task["jenkins:unit"].enhance do
|
98
|
+
Rake::Task['test:discovery'].invoke
|
99
|
+
end
|
@@ -1,12 +1,13 @@
|
|
1
1
|
require 'deface'
|
2
|
-
require '
|
2
|
+
require 'fast_gettext'
|
3
|
+
require 'gettext_i18n_rails'
|
3
4
|
|
4
5
|
module ForemanDiscovery
|
5
6
|
#Inherit from the Rails module of the parent app (Foreman), not the plugin.
|
6
7
|
#Thus, inherits from ::Rails::Engine and not from Rails::Engine
|
7
8
|
class Engine < ::Rails::Engine
|
8
9
|
|
9
|
-
# Load this before the Foreman config
|
10
|
+
# Load this before the Foreman config initializers, so that the Setting.descendants
|
10
11
|
# list includes the plugin STI setting class
|
11
12
|
initializer 'foreman_discovery.load_default_settings', :before => :load_config_initializers do |app|
|
12
13
|
require_dependency File.expand_path("../../../app/models/setting/discovered.rb", __FILE__) if (Setting.table_exists? rescue(false))
|
@@ -16,16 +17,47 @@ module ForemanDiscovery
|
|
16
17
|
ActionView::Base.send :include, DiscoversHelper
|
17
18
|
end
|
18
19
|
|
19
|
-
|
20
|
+
initializer 'foreman_discovery.register_gettext', :after => :load_config_initializers do |app|
|
21
|
+
locale_dir = File.join(File.expand_path('../../..', __FILE__), 'locale')
|
22
|
+
locale_domain = 'discovery'
|
23
|
+
|
24
|
+
Foreman::Gettext::Support.add_text_domain locale_domain, locale_dir
|
25
|
+
end
|
26
|
+
|
27
|
+
initializer 'foreman_discovery.register_plugin', :after=> :finisher_hook do |app|
|
28
|
+
Foreman::Plugin.register :foreman_discovery do
|
29
|
+
requires_foreman '>= 1.4'
|
30
|
+
|
31
|
+
# Add permissions
|
32
|
+
security_block :discovery do
|
33
|
+
permission :view_discovered_hosts, {:discovers => [:index, :show, :auto_complete_search, :refresh_facts] }
|
34
|
+
permission :provision_discovered_hosts, {:discovers => [:new, :create] }
|
35
|
+
permission :edit_discovered_hosts, {:discovers => [:edit, :update, :update_multiple_location,
|
36
|
+
:select_multiple_organization,
|
37
|
+
:update_multiple_organization,
|
38
|
+
:select_multiple_location] }
|
39
|
+
permission :destroy_discovered_hosts, {:discovers => [:destroy, :submit_multiple_destroy, :multiple_destroy] }
|
40
|
+
|
41
|
+
end
|
42
|
+
|
43
|
+
# Add a new role called 'Discovery' if it doesn't exist
|
44
|
+
role "Discovery", [:view_discovered_hosts, :provision_discovered_hosts, :edit_discovered_hosts, :destroy_discovered_hosts]
|
45
|
+
|
46
|
+
#add menu entry
|
47
|
+
menu :top_menu, :discovery, :url_hash => {:controller=> :discovers, :action=>:index},
|
48
|
+
:caption=> N_('Discovered hosts'),
|
49
|
+
:parent => :hosts_menu,
|
50
|
+
:after=>:hosts
|
51
|
+
end
|
52
|
+
end
|
53
|
+
# Include extensions to models in this config.to_prepare block
|
20
54
|
config.to_prepare do
|
21
|
-
# Include host
|
55
|
+
# Include host extensions
|
22
56
|
::Host::Managed.send :include, Host::ManagedExtensions
|
23
|
-
# Patch the menu
|
24
|
-
::HomeHelper.send :include, DiscoveryHomeHelperPatch
|
25
57
|
end
|
26
58
|
|
27
59
|
rake_tasks do
|
28
|
-
load "
|
60
|
+
load "discovery.rake"
|
29
61
|
end
|
30
62
|
|
31
63
|
end
|
@@ -1,5 +1,4 @@
|
|
1
|
-
require '
|
2
|
-
require 'mocha/setup'
|
1
|
+
require 'test_plugin_helper'
|
3
2
|
|
4
3
|
class DiscoversControllerTest < ActionController::TestCase
|
5
4
|
setup :initialize_host
|
@@ -17,20 +16,8 @@ class DiscoversControllerTest < ActionController::TestCase
|
|
17
16
|
|
18
17
|
def test_add_entry_to_nav_menu
|
19
18
|
get :index, {}, set_session_user
|
20
|
-
assert_tag :tag => '
|
21
|
-
:attributes => {
|
22
|
-
:child => { :tag => 'ul',
|
23
|
-
:child => { :tag => 'li',
|
24
|
-
:child => { :tag => 'ul',
|
25
|
-
:child => { :tag => 'li',
|
26
|
-
:child => {
|
27
|
-
:tag => 'a',
|
28
|
-
:attributes => {:href => '/discovers'}
|
29
|
-
}
|
30
|
-
}
|
31
|
-
}
|
32
|
-
}
|
33
|
-
}
|
19
|
+
assert_tag :tag => 'a',
|
20
|
+
:attributes => {:href => '/discovers'}
|
34
21
|
end
|
35
22
|
|
36
23
|
private
|
data/test/test_helper.rb
CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
|
|
2
2
|
require 'bundler/setup'
|
3
3
|
|
4
4
|
ENV["RAILS_ENV"] ||= 'test'
|
5
|
-
require File.
|
5
|
+
require File.expand_path("../../.foreman_app/config/environment.rb", __FILE__)
|
6
6
|
|
7
7
|
require 'test/unit'
|
8
8
|
require 'foreman_discovery'
|
@@ -16,7 +16,7 @@ class ActiveSupport::TestCase
|
|
16
16
|
# Note: You'll currently still have to declare fixtures explicitly in integration tests
|
17
17
|
# -- they do not yet inherit this setting
|
18
18
|
|
19
|
-
foreman_dir = File.expand_path("
|
19
|
+
foreman_dir = File.expand_path("../../.foreman_app", File.join(Dir.pwd, __FILE__))
|
20
20
|
fixture_path=File.join(foreman_dir, "test/fixtures")
|
21
21
|
fixtures :all
|
22
22
|
|
@@ -0,0 +1,92 @@
|
|
1
|
+
{
|
2
|
+
"name": "sinn1636.lan",
|
3
|
+
"facts": {
|
4
|
+
"processor3": "Intel(R) Xeon(R) CPU E5620 @ 2.40GHz",
|
5
|
+
"productname": "IBM System x -[7870K4G]-",
|
6
|
+
"kernelmajversion": "2.6",
|
7
|
+
"kernelversion": "2.6.32",
|
8
|
+
"macaddress_vnet0": "FE:54:00:1E:45:13",
|
9
|
+
"macaddress_br181": "E4:1F:13:CC:36:58",
|
10
|
+
"macaddress_usb0": "E6:1F:13:D0:43:A3",
|
11
|
+
"macaddress_vnet1": "FE:54:00:45:E5:3E",
|
12
|
+
"rubysitedir": "/usr/lib/ruby/site_ruby/1.8",
|
13
|
+
"macaddress_br182": "E4:1F:13:CC:36:58",
|
14
|
+
"processor4": "Intel(R) Xeon(R) CPU E5620 @ 2.40GHz",
|
15
|
+
"macaddress_vnet2": "FE:54:00:93:F5:56",
|
16
|
+
"macaddress_br183": "E4:1F:13:CC:36:58",
|
17
|
+
"ps": "ps -ef",
|
18
|
+
"processor5": "Intel(R) Xeon(R) CPU E5620 @ 2.40GHz",
|
19
|
+
"macaddress_vnet10": "FE:54:00:7D:F8:24",
|
20
|
+
"uniqueid": "230a021b",
|
21
|
+
"macaddress_vnet3": "FE:54:00:05:49:DE",
|
22
|
+
"lsbdistcodename": "Santiago",
|
23
|
+
"hardwareisa": "x86_64",
|
24
|
+
"lsbdistrelease": "6.2",
|
25
|
+
"processor6": "Intel(R) Xeon(R) CPU E5620 @ 2.40GHz",
|
26
|
+
"serialnumber": "abcdefg",
|
27
|
+
"processor7": "Intel(R) Xeon(R) CPU E5620 @ 2.40GHz",
|
28
|
+
"macaddress_vnet4": "FE:54:00:62:53:67",
|
29
|
+
"hostname": "h02",
|
30
|
+
"osfamily": "RedHat",
|
31
|
+
"gateway_if": "br180",
|
32
|
+
"lsbrelease": ":core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch",
|
33
|
+
"kernelrelease": "2.6.32-131.12.1.el6.x86_64",
|
34
|
+
"kernel": "Linux",
|
35
|
+
"facterversion": "1.6.2",
|
36
|
+
"uptime_seconds": "13651752",
|
37
|
+
"macaddress_vnet5": "FE:54:00:01:B9:9C",
|
38
|
+
"interfaces": "br180,br181,br182,br183,eth0,eth0_181,eth0_182,eth0_183,eth1,lo,usb0,vnet0,vnet1,vnet2,vnet3,vnet4,vnet5,vnet7,vnet10",
|
39
|
+
"macaddress_vnet7": "FE:54:00:D8:F9:38",
|
40
|
+
"netmask_br180": "255.255.255.192",
|
41
|
+
"macaddress_eth0": "E4:1F:13:CC:36:58",
|
42
|
+
"is_virtual": "false",
|
43
|
+
"macaddress": "E4:1F:13:CC:36:58",
|
44
|
+
"sshdsakey": "AAAAB3NzaC1kc3MAAACBAIbK60jlhYKSd4Nx6LCQPMUZcq/P1lTY3sQVrwpmfbF7d4JOGed2RWSoTBAzP3/Tjwlf+8DZ3Jd8a6Yhd6WuBzinE+owym8LXo2gDTvelhnzOVrTytM8hAi8uFEiBTGbnN1zka2y7qCPVxEu+kV20qC3mPODGxpV6y/4KOZ5Y4SHAAAAFQCyjeF+Jy9CDhiD2tfnmtMGAn1xzQAAAIBwtnUhhkB0r3ivPdQZgVy6qha8AJQG94I9FU9FnGJJEjkkfqlgNrj9SxV6Cg9EcrntnAKxZxk7PQhgvDesx69Lap9PAx3Ffb5Pl47cd7ilOXv2RJGKuxZQHNdKUF2445POwNjxSuhEkIB3/zpFXBB/zPMRfqUtlXJEwP9m6z9UFgAAAIAQDBpmcGChFP7i8T2RdMZo3hSMnU4y5lpEGhmwfbODoLSAX37wWQwUmwRP8byTEqFL0+5bp3hRbt/67EoD1O6n39/We19g/UqHkbUdZQqLqFjJfyzqfepq4HXtIIT8GbqW+FGJkH9x2fY5gtQrn9nVdmPDTwERFS98qU9glufbIw==",
|
45
|
+
"uptime": "158 days",
|
46
|
+
"manufacturer": "IBM",
|
47
|
+
"macaddress_eth1": "E4:1F:13:CC:36:5A",
|
48
|
+
"timezone": "GMT",
|
49
|
+
"fqdn": "a.server.b.domain",
|
50
|
+
"ipaddress_br180": "10.35.27.2",
|
51
|
+
"puppetversion": "2.6.12",
|
52
|
+
"path": "/root/.gem/bin:/root/.gem/ruby/1.8/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/sbin:/usr/sbin:/root/scripts",
|
53
|
+
"hardwaremodel": "x86_64",
|
54
|
+
"macaddress_eth0_181": "E4:1F:13:CC:36:58",
|
55
|
+
"netmask_lo": "255.0.0.0",
|
56
|
+
"uptime_days": "158",
|
57
|
+
"virtual": "physical",
|
58
|
+
"operatingsystemrelease": "6.2",
|
59
|
+
"processorcount": "8",
|
60
|
+
"sshrsakey": "AAAAB3NzaC1xcEabbAABIwAAAQEAwXfnuA0+6C6G152kzCbSZvTyUBrMwc0PGnmZgFpC3x4SkcMgRmtayPNqmY1vyYwyka1lNUoyU9u3TXOUkd7WrodoNYBbDQXWCAVpUci5099zUuZ8RVLcokKwNmQO0d1URgSLt2TtuLiUDB7JU2mHkoOuW9n7ODq+UzYsd2wf+/TQrvgsuyi25MROH2Z3WfMO+fmsj77h34gkuaavwB4e6lNRynjZLuEc4POFvDEW6kGCYm1g/8kRwUlB/Z1Cu0egxtxnTjILFFwfYFQu2Ksig020q1gLX3o4YL9X/YZz+JQuAOLGpK3F0owQUL7Ie3vokDsVmz2AweuLDFeh54i2Bw==",
|
61
|
+
"macaddress_eth0_182": "E4:1F:13:CC:36:58",
|
62
|
+
"memorysize": "15.57 GB",
|
63
|
+
"ipaddress": "10.35.27.2",
|
64
|
+
"rubyversion": "1.8.7",
|
65
|
+
"macaddress_eth0_183": "E4:1F:13:CC:36:58",
|
66
|
+
"physicalprocessorcount": "1",
|
67
|
+
"network_lo": "127.0.0.0",
|
68
|
+
"gateway": "10.35.27.62",
|
69
|
+
"lsbdistid": "RedHatEnterpriseServer",
|
70
|
+
"network_br180": "10.35.27.0",
|
71
|
+
"lsbdistdescription": "Red Hat Enterprise Linux Server release 6.2 (Santiago)",
|
72
|
+
"swapsize": "17.70 GB",
|
73
|
+
"processor0": "Intel(R) Xeon(R) CPU E5620 @ 2.40GHz",
|
74
|
+
"processor1": "Intel(R) Xeon(R) CPU E5620 @ 2.40GHz",
|
75
|
+
"macaddress_br180": "E4:1F:13:CC:36:58",
|
76
|
+
"selinux": "false",
|
77
|
+
"domain": "server.b.domain",
|
78
|
+
"architecture": "x86_64",
|
79
|
+
"uptime_hours": "3792",
|
80
|
+
"memoryfree": "6.87 GB",
|
81
|
+
"augeasversion": "0.9.0",
|
82
|
+
"operatingsystem": "RedHat",
|
83
|
+
"ipaddress_lo": "127.0.0.1",
|
84
|
+
"processor2": "Intel(R) Xeon(R) CPU E5620 @ 2.40GHz",
|
85
|
+
"type": "Main Server Chassis",
|
86
|
+
"id": "root",
|
87
|
+
"vlans": "181,182,183",
|
88
|
+
"lsbmajdistrelease": "6",
|
89
|
+
"swapfree": "16.72 GB",
|
90
|
+
"netmask": "255.255.255.192"
|
91
|
+
}
|
92
|
+
}
|
@@ -3,6 +3,10 @@ require 'test_helper'
|
|
3
3
|
class HostDiscoveredTest < ActiveSupport::TestCase
|
4
4
|
setup do
|
5
5
|
User.current = User.find_by_login "admin"
|
6
|
+
FactoryGirl.create(:setting,
|
7
|
+
name: 'discovery_fact',
|
8
|
+
value: 'macaddress',
|
9
|
+
category: 'Setting::Discovered')
|
6
10
|
end
|
7
11
|
|
8
12
|
test "should be able to create Host::Discovered objects" do
|
@@ -11,13 +15,27 @@ class HostDiscoveredTest < ActiveSupport::TestCase
|
|
11
15
|
end
|
12
16
|
|
13
17
|
test "should import facts from yaml as Host::Discovered" do
|
14
|
-
|
18
|
+
raw = parse_json_fixture('/facts.json')
|
19
|
+
assert Host::Discovered.importHostAndFacts(raw['facts'])
|
20
|
+
end
|
21
|
+
|
22
|
+
test "should raise when fact_name setting isn't present" do
|
23
|
+
raw = parse_json_fixture('/facts.json')
|
24
|
+
Setting[:discovery_fact] = 'macaddress_foo'
|
25
|
+
assert_raises Foreman::Exception do
|
26
|
+
Host::Discovered.importHostAndFacts(raw['facts'])
|
27
|
+
end
|
15
28
|
end
|
16
29
|
|
17
30
|
test "should be able to refresh facts" do
|
18
31
|
host = Host.create :name => "mydiscoveredhost", :ip => "1.2.3.4", :type => "Host::Discovered"
|
19
|
-
|
32
|
+
raw = parse_json_fixture('/facts.json')
|
33
|
+
ForemanDiscovery::Facts.any_instance.stubs(:facts).returns(raw['facts'])
|
20
34
|
assert host.refresh_facts
|
21
35
|
end
|
22
36
|
|
37
|
+
def parse_json_fixture(relative_path)
|
38
|
+
return JSON.parse(File.read(File.expand_path(File.dirname(__FILE__) + relative_path)))
|
39
|
+
end
|
40
|
+
|
23
41
|
end
|
metadata
CHANGED
@@ -1,58 +1,58 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman_discovery
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0.rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Greg Sutcliffe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-01-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: open4
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - '>='
|
17
|
+
- - ! '>='
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - '>='
|
24
|
+
- - ! '>='
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: ftools
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - '>='
|
31
|
+
- - ! '>='
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - '>='
|
38
|
+
- - ! '>='
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: deface
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - '>='
|
45
|
+
- - ! '>='
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - '>='
|
52
|
+
- - ! '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
-
description: 'MaaS Discovery Plugin engine for Foreman '
|
55
|
+
description: ! 'MaaS Discovery Plugin engine for Foreman '
|
56
56
|
email: gsutclif@redhat.com
|
57
57
|
executables: []
|
58
58
|
extensions: []
|
@@ -60,39 +60,56 @@ extra_rdoc_files:
|
|
60
60
|
- LICENSE
|
61
61
|
- README.md
|
62
62
|
files:
|
63
|
-
-
|
64
|
-
-
|
65
|
-
-
|
66
|
-
- app/
|
67
|
-
- app/views/discovers/_selected_hosts.html.erb
|
68
|
-
- app/views/discovers/select_multiple_location.html.erb
|
69
|
-
- app/views/discovers/multiple_destroy.html.erb
|
63
|
+
- LICENSE
|
64
|
+
- README.md
|
65
|
+
- Rakefile
|
66
|
+
- app/controllers/discovers_controller.rb
|
70
67
|
- app/helpers/discovers_helper.rb
|
71
|
-
- app/models/host/managed_extensions.rb
|
72
68
|
- app/models/host/discovered.rb
|
69
|
+
- app/models/host/managed_extensions.rb
|
73
70
|
- app/models/setting/discovered.rb
|
74
71
|
- app/overrides/add_dashboard_table.rb
|
75
|
-
- app/
|
76
|
-
-
|
72
|
+
- app/views/discovers/_discovers_list.html.erb
|
73
|
+
- app/views/discovers/_selected_hosts.html.erb
|
74
|
+
- app/views/discovers/index.html.erb
|
75
|
+
- app/views/discovers/multiple_destroy.html.erb
|
76
|
+
- app/views/discovers/select_multiple_location.html.erb
|
77
|
+
- app/views/discovers/select_multiple_organization.html.erb
|
78
|
+
- app/views/discovers/show.html.erb
|
79
|
+
- config/initializers/discovery_setup.rb
|
80
|
+
- config/routes.rb
|
77
81
|
- extra/build_iso.sh
|
78
82
|
- extra/discover_host
|
79
|
-
- extra/
|
83
|
+
- extra/discovery_init.sh.example
|
80
84
|
- extra/disk_facts.rb
|
81
|
-
-
|
82
|
-
-
|
83
|
-
-
|
84
|
-
-
|
85
|
+
- extra/foreman_startup.rb
|
86
|
+
- extra/ovirt-node-plugin-foreman/COPYING
|
87
|
+
- extra/ovirt-node-plugin-foreman/Makefile.am
|
88
|
+
- extra/ovirt-node-plugin-foreman/README.md
|
89
|
+
- extra/ovirt-node-plugin-foreman/autogen.sh
|
90
|
+
- extra/ovirt-node-plugin-foreman/conf/Makefile.am
|
91
|
+
- extra/ovirt-node-plugin-foreman/conf/foreman-plugin.firewall.in
|
92
|
+
- extra/ovirt-node-plugin-foreman/conf/foreman-plugin.logs
|
93
|
+
- extra/ovirt-node-plugin-foreman/configure.ac
|
94
|
+
- extra/ovirt-node-plugin-foreman/ovirt-node-plugin-foreman.spec.in
|
95
|
+
- extra/ovirt-node-plugin-foreman/recipe/Makefile.am
|
96
|
+
- extra/ovirt-node-plugin-foreman/recipe/foreman-plugin-iso.ks
|
97
|
+
- extra/ovirt-node-plugin-foreman/recipe/foreman-plugin-minimizer.ks
|
98
|
+
- extra/ovirt-node-plugin-foreman/src/Makefile.am
|
99
|
+
- extra/ovirt-node-plugin-foreman/src/discover-host.rb.in
|
100
|
+
- extra/ovirt-node-plugin-foreman/src/discover-host.service
|
101
|
+
- extra/ovirt-node-plugin-foreman/src/discovery-version-fact.rb.in
|
102
|
+
- extra/ovirt-node-plugin-foreman/src/find-missing-libs
|
103
|
+
- lib/discovery.rake
|
85
104
|
- lib/foreman_discovery.rb
|
86
|
-
- lib/foreman_discovery/version.rb
|
87
|
-
- lib/foreman_discovery/facts.rb
|
88
105
|
- lib/foreman_discovery/engine.rb
|
89
|
-
-
|
90
|
-
-
|
91
|
-
- README.md
|
106
|
+
- lib/foreman_discovery/facts.rb
|
107
|
+
- lib/foreman_discovery/version.rb
|
92
108
|
- test/functional/discovers_controller_test.rb
|
93
109
|
- test/test_helper.rb
|
110
|
+
- test/test_plugin_helper.rb
|
111
|
+
- test/unit/facts.json
|
94
112
|
- test/unit/host_discovered_test.rb
|
95
|
-
- test/unit/facts.yml
|
96
113
|
- test/unit/setting_discovered_test.rb
|
97
114
|
homepage: http://github.com/theforeman/foreman_discovery
|
98
115
|
licenses:
|
@@ -104,23 +121,24 @@ require_paths:
|
|
104
121
|
- lib
|
105
122
|
required_ruby_version: !ruby/object:Gem::Requirement
|
106
123
|
requirements:
|
107
|
-
- - '>='
|
124
|
+
- - ! '>='
|
108
125
|
- !ruby/object:Gem::Version
|
109
126
|
version: '0'
|
110
127
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
111
128
|
requirements:
|
112
|
-
- - '
|
129
|
+
- - ! '>'
|
113
130
|
- !ruby/object:Gem::Version
|
114
|
-
version:
|
131
|
+
version: 1.3.1
|
115
132
|
requirements: []
|
116
133
|
rubyforge_project:
|
117
|
-
rubygems_version: 2.
|
134
|
+
rubygems_version: 2.2.1
|
118
135
|
signing_key:
|
119
136
|
specification_version: 4
|
120
137
|
summary: MaaS Discovery Plugin for Foreman
|
121
138
|
test_files:
|
122
139
|
- test/functional/discovers_controller_test.rb
|
123
|
-
- test/
|
124
|
-
- test/unit/host_discovered_test.rb
|
125
|
-
- test/unit/facts.yml
|
140
|
+
- test/unit/facts.json
|
126
141
|
- test/unit/setting_discovered_test.rb
|
142
|
+
- test/unit/host_discovered_test.rb
|
143
|
+
- test/test_plugin_helper.rb
|
144
|
+
- test/test_helper.rb
|
@@ -1,18 +0,0 @@
|
|
1
|
-
module DiscoveryHomeHelperPatch
|
2
|
-
def self.included(base)
|
3
|
-
base.send(:include, InstanceMethods)
|
4
|
-
|
5
|
-
base.class_eval do
|
6
|
-
alias_method_chain :settings_menu_items, :discovers_link
|
7
|
-
end
|
8
|
-
end
|
9
|
-
|
10
|
-
module InstanceMethods
|
11
|
-
# Adds a discovers link to the More menu
|
12
|
-
def settings_menu_items_with_discovers_link
|
13
|
-
menu_items = settings_menu_items_without_discovers_link
|
14
|
-
menu_items[2][2].insert(2,['Discovered Hosts', :discovers]) if menu_items[2]
|
15
|
-
menu_items
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
data/test/unit/facts.yml
DELETED
@@ -1,91 +0,0 @@
|
|
1
|
-
--- !ruby/object:Puppet::Node::Facts
|
2
|
-
expiration: 2009-08-20 21:07:46.053586 +08:00
|
3
|
-
name: sinn1636.lan
|
4
|
-
values:
|
5
|
-
processor3: Intel(R) Xeon(R) CPU E5620 @ 2.40GHz
|
6
|
-
productname: "IBM System x -[7870K4G]-"
|
7
|
-
kernelmajversion: "2.6"
|
8
|
-
kernelversion: 2.6.32
|
9
|
-
macaddress_vnet0: FE:54:00:1E:45:13
|
10
|
-
macaddress_br181: E4:1F:13:CC:36:58
|
11
|
-
macaddress_usb0: E6:1F:13:D0:43:A3
|
12
|
-
macaddress_vnet1: FE:54:00:45:E5:3E
|
13
|
-
rubysitedir: /usr/lib/ruby/site_ruby/1.8
|
14
|
-
macaddress_br182: E4:1F:13:CC:36:58
|
15
|
-
processor4: Intel(R) Xeon(R) CPU E5620 @ 2.40GHz
|
16
|
-
macaddress_vnet2: FE:54:00:93:F5:56
|
17
|
-
macaddress_br183: E4:1F:13:CC:36:58
|
18
|
-
ps: ps -ef
|
19
|
-
processor5: Intel(R) Xeon(R) CPU E5620 @ 2.40GHz
|
20
|
-
macaddress_vnet10: FE:54:00:7D:F8:24
|
21
|
-
uniqueid: 230a021b
|
22
|
-
macaddress_vnet3: FE:54:00:05:49:DE
|
23
|
-
lsbdistcodename: Santiago
|
24
|
-
hardwareisa: x86_64
|
25
|
-
lsbdistrelease: "6.2"
|
26
|
-
processor6: Intel(R) Xeon(R) CPU E5620 @ 2.40GHz
|
27
|
-
serialnumber: abcdefg
|
28
|
-
processor7: Intel(R) Xeon(R) CPU E5620 @ 2.40GHz
|
29
|
-
macaddress_vnet4: FE:54:00:62:53:67
|
30
|
-
hostname: h02
|
31
|
-
osfamily: RedHat
|
32
|
-
gateway_if: br180
|
33
|
-
lsbrelease: ":core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch"
|
34
|
-
kernelrelease: 2.6.32-131.12.1.el6.x86_64
|
35
|
-
kernel: Linux
|
36
|
-
facterversion: 1.6.2
|
37
|
-
uptime_seconds: 13651752
|
38
|
-
macaddress_vnet5: FE:54:00:01:B9:9C
|
39
|
-
interfaces: "br180,br181,br182,br183,eth0,eth0_181,eth0_182,eth0_183,eth1,lo,usb0,vnet0,vnet1,vnet2,vnet3,vnet4,vnet5,vnet7,vnet10"
|
40
|
-
macaddress_vnet7: FE:54:00:D8:F9:38
|
41
|
-
netmask_br180: 255.255.255.192
|
42
|
-
macaddress_eth0: E4:1F:13:CC:36:58
|
43
|
-
is_virtual: "false"
|
44
|
-
macaddress: E4:1F:13:CC:36:58
|
45
|
-
sshdsakey: AAAAB3NzaC1kc3MAAACBAIbK60jlhYKSd4Nx6LCQPMUZcq/P1lTY3sQVrwpmfbF7d4JOGed2RWSoTBAzP3/Tjwlf+8DZ3Jd8a6Yhd6WuBzinE+owym8LXo2gDTvelhnzOVrTytM8hAi8uFEiBTGbnN1zka2y7qCPVxEu+kV20qC3mPODGxpV6y/4KOZ5Y4SHAAAAFQCyjeF+Jy9CDhiD2tfnmtMGAn1xzQAAAIBwtnUhhkB0r3ivPdQZgVy6qha8AJQG94I9FU9FnGJJEjkkfqlgNrj9SxV6Cg9EcrntnAKxZxk7PQhgvDesx69Lap9PAx3Ffb5Pl47cd7ilOXv2RJGKuxZQHNdKUF2445POwNjxSuhEkIB3/zpFXBB/zPMRfqUtlXJEwP9m6z9UFgAAAIAQDBpmcGChFP7i8T2RdMZo3hSMnU4y5lpEGhmwfbODoLSAX37wWQwUmwRP8byTEqFL0+5bp3hRbt/67EoD1O6n39/We19g/UqHkbUdZQqLqFjJfyzqfepq4HXtIIT8GbqW+FGJkH9x2fY5gtQrn9nVdmPDTwERFS98qU9glufbIw==
|
46
|
-
uptime: 158 days
|
47
|
-
manufacturer: IBM
|
48
|
-
macaddress_eth1: E4:1F:13:CC:36:5A
|
49
|
-
timezone: GMT
|
50
|
-
fqdn: a.server.b.domain
|
51
|
-
ipaddress_br180: 10.35.27.2
|
52
|
-
puppetversion: 2.6.12
|
53
|
-
path: /root/.gem/bin:/root/.gem/ruby/1.8/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/sbin:/usr/sbin:/root/scripts
|
54
|
-
hardwaremodel: x86_64
|
55
|
-
macaddress_eth0_181: E4:1F:13:CC:36:58
|
56
|
-
netmask_lo: 255.0.0.0
|
57
|
-
uptime_days: 158
|
58
|
-
virtual: physical
|
59
|
-
operatingsystemrelease: "6.2"
|
60
|
-
processorcount: "8"
|
61
|
-
sshrsakey: AAAAB3NzaC1xcEabbAABIwAAAQEAwXfnuA0+6C6G152kzCbSZvTyUBrMwc0PGnmZgFpC3x4SkcMgRmtayPNqmY1vyYwyka1lNUoyU9u3TXOUkd7WrodoNYBbDQXWCAVpUci5099zUuZ8RVLcokKwNmQO0d1URgSLt2TtuLiUDB7JU2mHkoOuW9n7ODq+UzYsd2wf+/TQrvgsuyi25MROH2Z3WfMO+fmsj77h34gkuaavwB4e6lNRynjZLuEc4POFvDEW6kGCYm1g/8kRwUlB/Z1Cu0egxtxnTjILFFwfYFQu2Ksig020q1gLX3o4YL9X/YZz+JQuAOLGpK3F0owQUL7Ie3vokDsVmz2AweuLDFeh54i2Bw==
|
62
|
-
macaddress_eth0_182: E4:1F:13:CC:36:58
|
63
|
-
memorysize: 15.57 GB
|
64
|
-
ipaddress: 10.35.27.2
|
65
|
-
rubyversion: 1.8.7
|
66
|
-
macaddress_eth0_183: E4:1F:13:CC:36:58
|
67
|
-
physicalprocessorcount: 1
|
68
|
-
network_lo: 127.0.0.0
|
69
|
-
gateway: 10.35.27.62
|
70
|
-
lsbdistid: RedHatEnterpriseServer
|
71
|
-
network_br180: 10.35.27.0
|
72
|
-
lsbdistdescription: Red Hat Enterprise Linux Server release 6.2 (Santiago)
|
73
|
-
swapsize: 17.70 GB
|
74
|
-
processor0: Intel(R) Xeon(R) CPU E5620 @ 2.40GHz
|
75
|
-
processor1: Intel(R) Xeon(R) CPU E5620 @ 2.40GHz
|
76
|
-
macaddress_br180: E4:1F:13:CC:36:58
|
77
|
-
selinux: "false"
|
78
|
-
domain: server.b.domain
|
79
|
-
architecture: x86_64
|
80
|
-
uptime_hours: 3792
|
81
|
-
memoryfree: 6.87 GB
|
82
|
-
augeasversion: 0.9.0
|
83
|
-
operatingsystem: RedHat
|
84
|
-
ipaddress_lo: 127.0.0.1
|
85
|
-
processor2: Intel(R) Xeon(R) CPU E5620 @ 2.40GHz
|
86
|
-
type: Main Server Chassis
|
87
|
-
id: root
|
88
|
-
vlans: "181,182,183"
|
89
|
-
lsbmajdistrelease: "6"
|
90
|
-
swapfree: 16.72 GB
|
91
|
-
netmask: 255.255.255.192
|