foreman_discovery 1.0.0.rc4 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -5,7 +5,7 @@ right now ;)
5
5
 
6
6
  # Dependencies
7
7
 
8
- * Foreman running from commit e36b1d6689773a9b (or newer)
8
+ * Foreman >= 1.2.0
9
9
 
10
10
  # Installation
11
11
 
@@ -24,7 +24,11 @@ Update & Restart Foreman:
24
24
 
25
25
  # Building the Discovery PXE Image
26
26
 
27
- There is a rake task for the discovery image. Run this in the Foreman app root:
27
+ There is a rake task for the discovery image. It requires Ruby 1.8, but should
28
+ appropriately detect and use ruby1.8 even if the system default is 1.9. If you
29
+ have trouble building it, try a ruby1.8-only system.
30
+
31
+ Run this in the Foreman app root:
28
32
 
29
33
  rake discovery:build_image
30
34
 
@@ -75,6 +79,20 @@ specify a DNS record (`foreman.server=myforemanhost`) but in this case the port
75
79
  be assumed to be http (80). If all else fails (say, USB boot where we can't provide
76
80
  options) it will look for a DNS record of `foreman`
77
81
 
82
+ ### Known Issues with the image
83
+
84
+ On some multi-core systems the TinyCore kernel may segfault on boot with an error message similar to :
85
+
86
+ "Fixing recursive fault but reboot is needed!"
87
+
88
+ If this happens, it can be fixed by changing the KERNEL line in the PXE config above to read :
89
+
90
+ KERNEL /boot/TinyCore-vmlinuz maxcpus=1
91
+
92
+ More information on the maxcpus kernel parameter can be found at <https://www.kernel.org/doc/Documentation/kernel-parameters.txt>
93
+
94
+ A currently unavoidable side effect of this setting is that the initial facts gathered during discovery will only show a single processor, since that is all that is visible to the kernel.
95
+
78
96
  ## UI config
79
97
 
80
98
  No configuration of the Foreman UI is required. If you are using Locations and/or Organisations,
@@ -0,0 +1,11 @@
1
+ Deface::Override.new(:virtual_path => "dashboard/_status_table",
2
+ :name => "add_dashboard_table",
3
+ :insert_after => "ul:last",
4
+ :text => '
5
+ <h4 class="header"><%= "Host Pool" -%></h4>
6
+ <ul>
7
+ <li>
8
+ <%= link_to("Unassigned Hosts", discovers_path, :class=>"dashboard-links" ) %>
9
+ <h4><%= Host::Discovered.count %></h4>
10
+ </li>
11
+ </ul>')
data/extra/build_iso.sh CHANGED
@@ -17,6 +17,8 @@ if [[ $MODE == 'debug' ]] ; then
17
17
  TGZS="$TGZS gcc_libs openssl-1.0.0 openssh"
18
18
  fi
19
19
 
20
+ DIRNAME=`dirname $0`
21
+ SCRIPT_DIR=`readlink -f $DIRNAME`
20
22
  LAUNCH_DIR=`pwd`
21
23
  TOPDIR=`mktemp -d`
22
24
  cd $TOPDIR
@@ -44,6 +46,7 @@ ln -s /usr/local/sbin/dmidecode usr/sbin/dmidecode
44
46
  mkdir ./additional_build_files
45
47
  wget -O ./additional_build_files/ipmi.rb https://github.com/zoide/puppet-ipmi/raw/master/lib/facter/ipmi.rb
46
48
  wget -O ./additional_build_files/lldp.rb https://github.com/mfournier/puppet-lldp/raw/master/lib/facter/lldp.rb
49
+ wget -O ./additional_build_files/netinfo.rb https://github.com/ohadlevy/puppet-network/raw/master/lib/facter/netinfo.rb
47
50
  if [ -d $LAUNCH_DIR/additional_build_files ]; then
48
51
  echo "including files from $LAUNCH_DIR/additional_build_files"
49
52
  cp -r $LAUNCH_DIR/additional_build_files .
@@ -90,7 +93,7 @@ echo "/opt/foreman_startup.rb" >> opt/bootlocal.sh
90
93
  echo "/opt/discovery_init.sh" >> opt/bootlocal.sh
91
94
 
92
95
  # Get the downloader
93
- cp `dirname $0`/foreman_startup.rb opt/foreman_startup.rb
96
+ cp $SCRIPT_DIR/foreman_startup.rb opt/foreman_startup.rb
94
97
  chmod 755 opt/foreman_startup.rb
95
98
 
96
99
  # Get the gems
@@ -132,9 +135,22 @@ wget http://production.cf.rubygems.org/rubygems/rubygems-1.8.24.tgz
132
135
  mkdir tmp-install-rubygems && cd tmp-install-rubygems
133
136
  mkdir rubygems
134
137
  tar xvzf ../rubygems-1.8.24.tgz && cd rubygems-1.8.24
135
- ruby setup.rb --destdir=../rubygems --prefix=/usr/local
138
+ if [[ `readlink -f /usr/bin/ruby` =~ 1.9 ]] ; then
139
+ rubybin=ruby1.8
140
+ else
141
+ rubybin=ruby
142
+ fi
143
+ $rubybin setup.rb --destdir=../rubygems --prefix=/usr/local
136
144
  cd ../rubygems
137
- sed -i 's?#!.*?#!/usr/local/bin/ruby?' ./usr/local/bin/gem
145
+ # Detect gem executable
146
+ if [ -f ./usr/local/bin/gem ] ; then
147
+ echo "Found proper gem executable"
148
+ sed -i 's?#!.*?#!/usr/local/bin/ruby?' ./usr/local/bin/gem
149
+ else
150
+ echo "Found gem1.8 executable"
151
+ sed -i 's?#!.*?#!/usr/local/bin/ruby?' ./usr/local/bin/gem1.8
152
+ ln -snf /usr/local/bin/gem1.8 ./usr/local/bin/gem
153
+ fi
138
154
  mkdir ./usr/local/lib/ruby/1.8 -p
139
155
  mv ./usr/local/lib/* ./usr/local/lib/ruby/1.8
140
156
  chown -R 0:0 .
@@ -148,7 +164,7 @@ mkdir -p ./proxy/usr/share
148
164
  mkdir -p ./proxy/var/run/foreman-proxy
149
165
  mkdir -p ./proxy/var/log/foreman-proxy
150
166
  git clone https://github.com/theforeman/smart-proxy.git ./proxy/usr/share/foreman-proxy
151
- cp `dirname $0`/discover_host ./proxy/usr/share/foreman-proxy/bin/discover_host
167
+ cp $SCRIPT_DIR/discover_host ./proxy/usr/share/foreman-proxy/bin/discover_host
152
168
  chmod 755 ./proxy/usr/share/foreman-proxy/bin/discover_host
153
169
  cp ./proxy/usr/share/foreman-proxy/config/settings.yml{.example,}
154
170
  sed -i 's/.*:bmc:.*/:bmc: true/' ./proxy/usr/share/foreman-proxy/config/settings.yml
data/extra/discover_host CHANGED
@@ -47,6 +47,8 @@ end
47
47
 
48
48
  def upload
49
49
  puts "#{Time.now}: Triggering import of facts from Foreman"
50
+ ip = Facter.value('ipaddress')
51
+ data = ip.nil? ? {} : {'ip' => ip}
50
52
  begin
51
53
  uri = URI.parse(discover_server)
52
54
  http = Net::HTTP.new(uri.host, uri.port)
@@ -55,7 +57,7 @@ def upload
55
57
  http.verify_mode = OpenSSL::SSL::VERIFY_NONE
56
58
  end
57
59
  req = Net::HTTP::Post.new("/discovers")
58
- req.set_form_data({})
60
+ req.set_form_data(data)
59
61
  response = http.request(req)
60
62
  puts response.body
61
63
  rescue Exception => e
@@ -3,16 +3,16 @@ module DiscoveryHomeHelperPatch
3
3
  base.send(:include, InstanceMethods)
4
4
 
5
5
  base.class_eval do
6
- alias_method_chain :setting_options, :discovers_link
6
+ alias_method_chain :settings_menu_items, :discovers_link
7
7
  end
8
8
  end
9
9
 
10
10
  module InstanceMethods
11
11
  # Adds a discovers link to the More menu
12
- def setting_options_with_discovers_link
13
- choices = setting_options_without_discovers_link
14
- choices[2][2].insert(2,['Discovered Hosts', :discovers])
15
- authorized_menu_actions(choices)
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
16
  end
17
17
  end
18
18
  end
@@ -1,3 +1,4 @@
1
+ require 'deface'
1
2
  require 'discovery_home_helper_patch'
2
3
 
3
4
  module ForemanDiscovery
@@ -1,3 +1,3 @@
1
1
  module ForemanDiscovery
2
- VERSION = "1.0.0.rc4"
2
+ VERSION = "1.0.0"
3
3
  end
data/lib/tasks.rake CHANGED
@@ -49,7 +49,7 @@ namespace :discovery do
49
49
  status = Open4::popen4("#{prefix} #{script} #{mode}") do |pid, stdin, stdout, stderr|
50
50
  puts "pid : #{ pid }" if verbose
51
51
  stdrout=stdout.read.strip
52
- builddir = stdrout.split("\n").delete_if {|x| x !~ /#TMPDIR#/}.to_s.split(' ').last
52
+ builddir = stdrout.split("\n").delete_if {|x| x !~ /#TMPDIR#/}.to_s.split(' ').last.sub(/[\]\"]+/,"")
53
53
  puts "stdout : #{ stdrout }" if verbose
54
54
  puts "stderr : #{ stderr.read.strip }" if verbose
55
55
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_discovery
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.rc4
5
- prerelease: 6
4
+ version: 1.0.0
5
+ prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - Greg Sutcliffe
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-06-14 00:00:00.000000000 Z
12
+ date: 2013-07-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -18,7 +18,7 @@ dependencies:
18
18
  requirements:
19
19
  - - ~>
20
20
  - !ruby/object:Gem::Version
21
- version: 3.2.13
21
+ version: 3.2.8
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - ~>
28
28
  - !ruby/object:Gem::Version
29
- version: 3.2.13
29
+ version: 3.2.8
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: open4
32
32
  requirement: !ruby/object:Gem::Requirement
@@ -59,6 +59,22 @@ dependencies:
59
59
  - - ! '>='
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: deface
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :runtime
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
62
78
  description: ! 'MaaS Discovery Plugin engine for Foreman '
63
79
  email: gsutclif@redhat.com
64
80
  executables: []
@@ -68,6 +84,7 @@ extra_rdoc_files:
68
84
  - README.md
69
85
  files:
70
86
  - app/helpers/discovers_helper.rb
87
+ - app/overrides/add_dashboard_table.rb
71
88
  - app/models/setting/discovered.rb
72
89
  - app/models/host/managed_extensions.rb
73
90
  - app/models/host/discovered.rb
@@ -1451,9 +1468,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
1451
1468
  required_rubygems_version: !ruby/object:Gem::Requirement
1452
1469
  none: false
1453
1470
  requirements:
1454
- - - ! '>'
1471
+ - - ! '>='
1455
1472
  - !ruby/object:Gem::Version
1456
- version: 1.3.1
1473
+ version: '0'
1457
1474
  requirements: []
1458
1475
  rubyforge_project:
1459
1476
  rubygems_version: 1.8.23