foreman_discovery 1.0.0.rc3 → 1.0.0.rc4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,6 +8,7 @@ class DiscoversController < ::ApplicationController
8
8
 
9
9
  before_filter :find_by_name, :only => %w[show edit update destroy refresh_facts convert]
10
10
  before_filter :find_multiple, :only => [:multiple_destroy, :submit_multiple_destroy]
11
+ before_filter :taxonomy_scope, :only => [:edit]
11
12
 
12
13
  helper :hosts
13
14
 
@@ -180,4 +181,20 @@ class DiscoversController < ::ApplicationController
180
181
  ip = ip.split(',').first
181
182
  end
182
183
 
184
+ def taxonomy_scope
185
+ if params[:host]
186
+ @organization = Organization.find_by_id(params[:host][:organization_id])
187
+ @location = Location.find_by_id(params[:host][:location_id])
188
+ end
189
+
190
+ if SETTINGS[:organizations_enabled]
191
+ @organization ||= Organization.current
192
+ @organization ||= Organization.my_organizations.first
193
+ end
194
+ if SETTINGS[:locations_enabled]
195
+ @location ||= Location.current
196
+ @location ||= Location.my_locations.first
197
+ end
198
+ end
199
+
183
200
  end
@@ -46,7 +46,7 @@ class Host::Discovered < ::Host::Base
46
46
  end
47
47
  h ||= Host.new :name => name, :type => "Host::Discovered"
48
48
  h.type = "Host::Discovered"
49
- h.mac = values["macaddress_eth0"]
49
+ h.mac = values["macaddress_eth0"].downcase
50
50
 
51
51
  if SETTINGS[:locations_enabled]
52
52
  begin
@@ -1,4 +1,3 @@
1
- require 'deface'
2
1
  require 'discovery_home_helper_patch'
3
2
 
4
3
  module ForemanDiscovery
@@ -9,7 +8,7 @@ module ForemanDiscovery
9
8
  # Load this before the Foreman config initizializers, so that the Setting.descendants
10
9
  # list includes the plugin STI setting class
11
10
  initializer 'foreman_discovery.load_default_settings', :before => :load_config_initializers do |app|
12
- require_dependency File.expand_path("../../../app/models/setting/discovered.rb", __FILE__)
11
+ require_dependency File.expand_path("../../../app/models/setting/discovered.rb", __FILE__) if (Setting.table_exists? rescue(false))
13
12
  end
14
13
 
15
14
  initializer 'foreman_discovery.helper' do |app|
@@ -1,3 +1,3 @@
1
1
  module ForemanDiscovery
2
- VERSION = "1.0.0.rc3"
2
+ VERSION = "1.0.0.rc4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_discovery
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.rc3
4
+ version: 1.0.0.rc4
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-05-06 00:00:00.000000000 Z
12
+ date: 2013-06-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -27,22 +27,6 @@ dependencies:
27
27
  - - ~>
28
28
  - !ruby/object:Gem::Version
29
29
  version: 3.2.13
30
- - !ruby/object:Gem::Dependency
31
- name: deface
32
- requirement: !ruby/object:Gem::Requirement
33
- none: false
34
- requirements:
35
- - - ! '>='
36
- - !ruby/object:Gem::Version
37
- version: '0'
38
- type: :runtime
39
- prerelease: false
40
- version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - ! '>='
44
- - !ruby/object:Gem::Version
45
- version: '0'
46
30
  - !ruby/object:Gem::Dependency
47
31
  name: open4
48
32
  requirement: !ruby/object:Gem::Requirement
@@ -84,7 +68,6 @@ extra_rdoc_files:
84
68
  - README.md
85
69
  files:
86
70
  - app/helpers/discovers_helper.rb
87
- - app/overrides/add_build_flag.rb
88
71
  - app/models/setting/discovered.rb
89
72
  - app/models/host/managed_extensions.rb
90
73
  - app/models/host/discovered.rb
@@ -1,4 +0,0 @@
1
- Deface::Override.new(:virtual_path => "hosts/_operating_system",
2
- :name => "add_build_flag",
3
- :insert_after => "span[id='os_select']",
4
- :text => "\n<% if request.fullpath =~ /^\\/discovers/ -%><%= f.hidden_field :build, :value => true %><% end -%>")