foreman_default_hostgroup 1.0.1 → 1.1.0
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.
- checksums.yaml +15 -0
- data/lib/default_hostgroup.rake +6 -0
- data/lib/default_hostgroup_managed_host_patch.rb +2 -2
- data/lib/foreman_default_hostgroup/engine.rb +5 -0
- data/lib/foreman_default_hostgroup/version.rb +1 -1
- data/test/factories/environments.rb +5 -0
- data/test/test_plugin_helper.rb +6 -0
- data/test/unit/default_hostgroup_test.rb +13 -5
- metadata +13 -11
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
YjIyNTViYmQ0MmVjZTkxZDU2N2JlZDNkY2ZiNmRiNTJkNTE1MzYxOQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
MDQ1ZTIwZDczYWYyNzgwYzQxYTk1ODdiOTgzMmI5MWJmMzAyYzQzZA==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
ZDQyMTNlOWU0ZWIyYmQ0MzA5MGNiNmQ3Njc4M2JkMTBiMDM0MTA3OTlkMTNk
|
10
|
+
M2NmYzU2ZjNkMjc0MzYzZGEzNzhkNDM2MTlmODMwMWU5ZjIzOTEyYWEzZDU3
|
11
|
+
OTRhMWRiYTAxNzllOGE5ZjkwYmQyZTg5ZDY4MzM1ZmM1NDk1ODc=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
M2E4MDBlNDg2ZDBiYjMxNWE3OWY1OTJiMzU3NGMyYTQwOGYwNjNkMWIxZTg0
|
14
|
+
ZGU1ZTRmMzcxYmIxNDljNjc4OGEwNGRiZWUyODJjZWUxOTE5N2FmOTdiYmY1
|
15
|
+
ZWVkMzgwN2FlNWVlMDMxZmQ2YmU2Nzg2OTQ4OTgxNmFmNjdlNTk=
|
data/lib/default_hostgroup.rake
CHANGED
@@ -13,3 +13,9 @@ Rake::Task[:test].enhance do
|
|
13
13
|
Rake::Task['test:default_hostgroup'].invoke
|
14
14
|
end
|
15
15
|
|
16
|
+
load 'tasks/jenkins.rake'
|
17
|
+
if Rake::Task.task_defined?(:'jenkins:setup')
|
18
|
+
Rake::Task["jenkins:unit"].enhance do
|
19
|
+
Rake::Task['test:default_hostgroup'].invoke
|
20
|
+
end
|
21
|
+
end
|
@@ -10,8 +10,8 @@ module DefaultHostgroupManagedHostPatch
|
|
10
10
|
end
|
11
11
|
|
12
12
|
module ClassMethods
|
13
|
-
def importHostAndFacts_with_apply_hostgroup hostname, facts, certname = nil
|
14
|
-
host, result = importHostAndFacts_without_apply_hostgroup(hostname, facts, certname)
|
13
|
+
def importHostAndFacts_with_apply_hostgroup hostname, facts, certname = nil, proxy_id = nil
|
14
|
+
host, result = importHostAndFacts_without_apply_hostgroup(hostname, facts, certname, proxy_id)
|
15
15
|
Rails.logger.debug "DefaultHostgroup: performing Hostgroup check"
|
16
16
|
|
17
17
|
unless valid_hostgroup?
|
@@ -11,6 +11,11 @@ module ForemanDefaultHostgroup
|
|
11
11
|
require_dependency File.expand_path("../../../app/models/setting/default_hostgroup.rb", __FILE__) if (Setting.table_exists? rescue(false))
|
12
12
|
end
|
13
13
|
|
14
|
+
initializer 'foreman_default_hostgroup.register_plugin', :after=> :finisher_hook do |app|
|
15
|
+
Foreman::Plugin.register :foreman_default_hostgroup do
|
16
|
+
end if (Rails.env == "development" or defined? Foreman::Plugin)
|
17
|
+
end
|
18
|
+
|
14
19
|
config.to_prepare do
|
15
20
|
::Host::Managed.send :include, DefaultHostgroupManagedHostPatch
|
16
21
|
end
|
@@ -1,13 +1,9 @@
|
|
1
|
-
require '
|
1
|
+
require 'test_plugin_helper'
|
2
2
|
|
3
3
|
class DefaultHostgroupTest < ActiveSupport::TestCase
|
4
4
|
setup do
|
5
5
|
disable_orchestration
|
6
6
|
User.current = User.find_by_login "admin"
|
7
|
-
|
8
|
-
# this is not being run automatically by the
|
9
|
-
# initializers, for some strange reason....
|
10
|
-
Setting::DefaultHostgroup.load_defaults
|
11
7
|
end
|
12
8
|
|
13
9
|
def parse_json_fixture(relative_path)
|
@@ -15,6 +11,11 @@ class DefaultHostgroupTest < ActiveSupport::TestCase
|
|
15
11
|
end
|
16
12
|
|
17
13
|
def setup_hostgroup
|
14
|
+
# The settings.yml fixture in Core wipes out the Setting table,
|
15
|
+
# so we use FactoryGirl to re-create it
|
16
|
+
FactoryGirl.create(:setting,
|
17
|
+
:name => 'default_hostgroup',
|
18
|
+
:category => 'Setting::DefaultHostgroup')
|
18
19
|
@hostgroup = Hostgroup.create :name => "MyGroup"
|
19
20
|
Setting[:default_hostgroup] = @hostgroup.name
|
20
21
|
end
|
@@ -34,4 +35,11 @@ class DefaultHostgroupTest < ActiveSupport::TestCase
|
|
34
35
|
refute Host.find_by_name('sinn1636.lan').hostgroup
|
35
36
|
end
|
36
37
|
|
38
|
+
# Contrived example to check new plugin factories are loaded
|
39
|
+
test "my factory exists" do
|
40
|
+
refute Environment.find_by_name('defaulthostgrouptest')
|
41
|
+
FactoryGirl.create(:environment)
|
42
|
+
assert Environment.find_by_name('defaulthostgrouptest')
|
43
|
+
end
|
44
|
+
|
37
45
|
end
|
metadata
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman_default_hostgroup
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
5
|
-
prerelease:
|
4
|
+
version: 1.1.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Greg Sutcliffe
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2014-02-07 00:00:00.000000000 Z
|
13
12
|
dependencies: []
|
14
13
|
description: Adds the option to specify a default hostgroup for new hosts created
|
15
14
|
from facts/reports
|
@@ -20,42 +19,45 @@ extra_rdoc_files:
|
|
20
19
|
- LICENSE
|
21
20
|
- README.md
|
22
21
|
files:
|
22
|
+
- LICENSE
|
23
|
+
- README.md
|
23
24
|
- app/models/setting/default_hostgroup.rb
|
24
25
|
- config/environment.rb
|
25
26
|
- lib/default_hostgroup.rake
|
26
27
|
- lib/default_hostgroup_managed_host_patch.rb
|
28
|
+
- lib/foreman_default_hostgroup.rb
|
27
29
|
- lib/foreman_default_hostgroup/engine.rb
|
28
30
|
- lib/foreman_default_hostgroup/version.rb
|
29
|
-
-
|
30
|
-
-
|
31
|
-
- README.md
|
32
|
-
- test/unit/facts.json
|
31
|
+
- test/factories/environments.rb
|
32
|
+
- test/test_plugin_helper.rb
|
33
33
|
- test/unit/default_hostgroup_test.rb
|
34
|
+
- test/unit/facts.json
|
34
35
|
homepage: http://github.com/GregSutcliffe/foreman_default_hostgroup
|
35
36
|
licenses:
|
36
37
|
- GPL-3
|
38
|
+
metadata: {}
|
37
39
|
post_install_message:
|
38
40
|
rdoc_options: []
|
39
41
|
require_paths:
|
40
42
|
- lib
|
41
43
|
required_ruby_version: !ruby/object:Gem::Requirement
|
42
|
-
none: false
|
43
44
|
requirements:
|
44
45
|
- - ! '>='
|
45
46
|
- !ruby/object:Gem::Version
|
46
47
|
version: '0'
|
47
48
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
48
|
-
none: false
|
49
49
|
requirements:
|
50
50
|
- - ! '>='
|
51
51
|
- !ruby/object:Gem::Version
|
52
52
|
version: '0'
|
53
53
|
requirements: []
|
54
54
|
rubyforge_project:
|
55
|
-
rubygems_version:
|
55
|
+
rubygems_version: 2.2.1
|
56
56
|
signing_key:
|
57
|
-
specification_version:
|
57
|
+
specification_version: 4
|
58
58
|
summary: Default Hostgroup Plugin for Foreman
|
59
59
|
test_files:
|
60
|
+
- test/factories/environments.rb
|
60
61
|
- test/unit/facts.json
|
61
62
|
- test/unit/default_hostgroup_test.rb
|
63
|
+
- test/test_plugin_helper.rb
|