foreman_discovery 9.1.5 → 10.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/api/v2/discovered_hosts_controller.rb +5 -4
- data/app/controllers/api/v2/discovery_rules_controller.rb +1 -1
- data/app/controllers/concerns/foreman/controller/parameters/discovered_host.rb +2 -9
- data/app/controllers/discovered_hosts_controller.rb +10 -21
- data/app/controllers/discovery_rules_controller.rb +1 -1
- data/app/controllers/foreman_discovery/concerns/hosts_controller_extensions.rb +1 -1
- data/app/helpers/discovered_hosts_helper.rb +2 -3
- data/app/models/discovery_attribute_set.rb +1 -1
- data/app/models/discovery_rule.rb +1 -1
- data/app/models/host/discovered.rb +23 -17
- data/app/models/host/managed_extensions.rb +2 -5
- data/app/services/foreman_discovery/host_converter.rb +0 -6
- data/app/services/foreman_discovery/node_api/power.rb +0 -8
- data/app/views/discovered_hosts/_discovered_host_modal.html.erb +12 -13
- data/app/views/discovered_hosts/_selected_hosts.html.erb +1 -1
- data/app/views/discovered_hosts/multiple_destroy.html.erb +5 -4
- data/app/views/discovered_hosts/show.html.erb +9 -1
- data/app/views/discovered_hosts/welcome.html.erb +10 -0
- data/db/migrate/20141223142759_fill_discovery_attribute_sets_for_existing_hosts.rb +1 -1
- data/db/migrate/20150714144500_review_discovery_permissions.rb +9 -7
- data/db/migrate/20161006094714_add_constraints_on_subnets_smart_proxies.rb +0 -3
- data/extra/discover-host +18 -11
- data/extra/discovery/rhel7-vlan.json +352 -0
- data/lib/foreman_discovery/engine.rb +2 -1
- data/lib/foreman_discovery/version.rb +1 -1
- data/locale/ca/LC_MESSAGES/foreman_discovery.mo +0 -0
- data/locale/ca/foreman_discovery.edit.po +1 -1
- data/locale/ca/foreman_discovery.po +1 -1
- data/locale/de/LC_MESSAGES/foreman_discovery.mo +0 -0
- data/locale/de/foreman_discovery.edit.po +2 -2
- data/locale/de/foreman_discovery.po +2 -2
- data/locale/en/LC_MESSAGES/foreman_discovery.mo +0 -0
- data/locale/en/foreman_discovery.edit.po +79 -75
- data/locale/en/foreman_discovery.po +13 -10
- data/locale/en_GB/LC_MESSAGES/foreman_discovery.mo +0 -0
- data/locale/en_GB/foreman_discovery.edit.po +1 -1
- data/locale/en_GB/foreman_discovery.po +1 -1
- data/locale/es/LC_MESSAGES/foreman_discovery.mo +0 -0
- data/locale/es/foreman_discovery.edit.po +2 -2
- data/locale/es/foreman_discovery.po +2 -2
- data/locale/foreman_discovery.pot +89 -81
- data/locale/fr/LC_MESSAGES/foreman_discovery.mo +0 -0
- data/locale/fr/foreman_discovery.edit.po +2 -2
- data/locale/fr/foreman_discovery.po +2 -2
- data/locale/gl/LC_MESSAGES/foreman_discovery.mo +0 -0
- data/locale/gl/foreman_discovery.edit.po +1 -1
- data/locale/gl/foreman_discovery.po +1 -1
- data/locale/it/LC_MESSAGES/foreman_discovery.mo +0 -0
- data/locale/it/foreman_discovery.edit.po +2 -2
- data/locale/it/foreman_discovery.po +2 -2
- data/locale/ja/LC_MESSAGES/foreman_discovery.mo +0 -0
- data/locale/ja/foreman_discovery.edit.po +2 -2
- data/locale/ja/foreman_discovery.po +2 -2
- data/locale/ko/LC_MESSAGES/foreman_discovery.mo +0 -0
- data/locale/ko/foreman_discovery.edit.po +2 -2
- data/locale/ko/foreman_discovery.po +2 -2
- data/locale/pt_BR/LC_MESSAGES/foreman_discovery.mo +0 -0
- data/locale/pt_BR/foreman_discovery.edit.po +2 -2
- data/locale/pt_BR/foreman_discovery.po +2 -2
- data/locale/ru/LC_MESSAGES/foreman_discovery.mo +0 -0
- data/locale/ru/foreman_discovery.edit.po +2 -2
- data/locale/ru/foreman_discovery.po +2 -2
- data/locale/sv_SE/LC_MESSAGES/foreman_discovery.mo +0 -0
- data/locale/sv_SE/foreman_discovery.edit.po +1 -1
- data/locale/sv_SE/foreman_discovery.po +1 -1
- data/locale/zh_CN/LC_MESSAGES/foreman_discovery.mo +0 -0
- data/locale/zh_CN/foreman_discovery.edit.po +2 -2
- data/locale/zh_CN/foreman_discovery.po +2 -2
- data/locale/zh_TW/LC_MESSAGES/foreman_discovery.mo +0 -0
- data/locale/zh_TW/foreman_discovery.edit.po +2 -2
- data/locale/zh_TW/foreman_discovery.po +2 -2
- data/test/functional/api/v2/discovered_hosts_controller_test.rb +16 -17
- data/test/functional/api/v2/discovery_rules_controller_test.rb +2 -3
- data/test/functional/api/v2/fact_value_extensions_test.rb +1 -1
- data/test/functional/discovered_hosts_controller_test.rb +102 -133
- data/test/functional/foreman_discovery/concerns/hosts_controller_extensions_test.rb +5 -6
- data/test/test_helper_discovery.rb +18 -0
- data/test/unit/discovered_extensions_test.rb +25 -33
- data/test/unit/discovery_attribute_set_test.rb +5 -8
- data/test/unit/discovery_taxonomy_extensions_test.rb +2 -2
- data/test/unit/host_discovered_test.rb +30 -30
- data/test/unit/managed_extensions_test.rb +0 -1
- metadata +6 -4
- data/app/services/foreman_discovery/node_api/power_legacy_direct_service.rb +0 -15
- data/app/services/foreman_discovery/node_api/power_legacy_proxied_service.rb +0 -12
Binary file
|
@@ -7,10 +7,10 @@
|
|
7
7
|
# Pierre-Emmanuel Dutang <dutangp@gmail.com>, 2014,2016-2017
|
8
8
|
msgid ""
|
9
9
|
msgstr ""
|
10
|
-
"Project-Id-Version: foreman_discovery 9.1.
|
10
|
+
"Project-Id-Version: foreman_discovery 9.1.0\n"
|
11
11
|
"Report-Msgid-Bugs-To: \n"
|
12
12
|
"POT-Creation-Date: 2017-10-17 15:39+0200\n"
|
13
|
-
"PO-Revision-Date: 2017-10-
|
13
|
+
"PO-Revision-Date: 2017-10-17 23:23+0000\n"
|
14
14
|
"Last-Translator: Lukáš Zapletal\n"
|
15
15
|
"Language-Team: French (http://www.transifex.com/foreman/foreman/language/fr/)\n"
|
16
16
|
"MIME-Version: 1.0\n"
|
@@ -7,9 +7,9 @@
|
|
7
7
|
# Pierre-Emmanuel Dutang <dutangp@gmail.com>, 2014,2016-2017
|
8
8
|
msgid ""
|
9
9
|
msgstr ""
|
10
|
-
"Project-Id-Version: foreman_discovery 9.1.
|
10
|
+
"Project-Id-Version: foreman_discovery 9.1.0\n"
|
11
11
|
"Report-Msgid-Bugs-To: \n"
|
12
|
-
"PO-Revision-Date: 2017-10-
|
12
|
+
"PO-Revision-Date: 2017-10-17 23:23+0000\n"
|
13
13
|
"Last-Translator: Lukáš Zapletal\n"
|
14
14
|
"Language-Team: French (http://www.transifex.com/foreman/foreman/language/fr/)\n"
|
15
15
|
"MIME-Version: 1.0\n"
|
Binary file
|
Binary file
|
@@ -7,10 +7,10 @@
|
|
7
7
|
# caifti <caifti@gmail.com>, 2014
|
8
8
|
msgid ""
|
9
9
|
msgstr ""
|
10
|
-
"Project-Id-Version: foreman_discovery 9.1.
|
10
|
+
"Project-Id-Version: foreman_discovery 9.1.0\n"
|
11
11
|
"Report-Msgid-Bugs-To: \n"
|
12
12
|
"POT-Creation-Date: 2017-10-17 15:39+0200\n"
|
13
|
-
"PO-Revision-Date: 2017-10-
|
13
|
+
"PO-Revision-Date: 2017-10-17 23:23+0000\n"
|
14
14
|
"Last-Translator: Lukáš Zapletal\n"
|
15
15
|
"Language-Team: Italian (http://www.transifex.com/foreman/foreman/language/it/)\n"
|
16
16
|
"MIME-Version: 1.0\n"
|
@@ -7,9 +7,9 @@
|
|
7
7
|
# caifti <caifti@gmail.com>, 2014
|
8
8
|
msgid ""
|
9
9
|
msgstr ""
|
10
|
-
"Project-Id-Version: foreman_discovery 9.1.
|
10
|
+
"Project-Id-Version: foreman_discovery 9.1.0\n"
|
11
11
|
"Report-Msgid-Bugs-To: \n"
|
12
|
-
"PO-Revision-Date: 2017-10-
|
12
|
+
"PO-Revision-Date: 2017-10-17 23:23+0000\n"
|
13
13
|
"Last-Translator: Lukáš Zapletal\n"
|
14
14
|
"Language-Team: Italian (http://www.transifex.com/foreman/foreman/language/it/)"
|
15
15
|
"\n"
|
Binary file
|
@@ -6,10 +6,10 @@
|
|
6
6
|
# Shuji Yamada <uzy.exe@gmail.com>, 2015
|
7
7
|
msgid ""
|
8
8
|
msgstr ""
|
9
|
-
"Project-Id-Version: foreman_discovery 9.1.
|
9
|
+
"Project-Id-Version: foreman_discovery 9.1.0\n"
|
10
10
|
"Report-Msgid-Bugs-To: \n"
|
11
11
|
"POT-Creation-Date: 2017-10-17 15:39+0200\n"
|
12
|
-
"PO-Revision-Date: 2017-10-
|
12
|
+
"PO-Revision-Date: 2017-10-17 23:23+0000\n"
|
13
13
|
"Last-Translator: Lukáš Zapletal\n"
|
14
14
|
"Language-Team: Japanese (http://www.transifex.com/foreman/foreman/language/ja/)\n"
|
15
15
|
"MIME-Version: 1.0\n"
|
@@ -6,9 +6,9 @@
|
|
6
6
|
# Shuji Yamada <uzy.exe@gmail.com>, 2015
|
7
7
|
msgid ""
|
8
8
|
msgstr ""
|
9
|
-
"Project-Id-Version: foreman_discovery 9.1.
|
9
|
+
"Project-Id-Version: foreman_discovery 9.1.0\n"
|
10
10
|
"Report-Msgid-Bugs-To: \n"
|
11
|
-
"PO-Revision-Date: 2017-10-
|
11
|
+
"PO-Revision-Date: 2017-10-17 23:23+0000\n"
|
12
12
|
"Last-Translator: Lukáš Zapletal\n"
|
13
13
|
"Language-Team: Japanese (http://www.transifex.com/foreman/foreman/language/ja/"
|
14
14
|
")\n"
|
Binary file
|
@@ -5,10 +5,10 @@
|
|
5
5
|
# Translators:
|
6
6
|
msgid ""
|
7
7
|
msgstr ""
|
8
|
-
"Project-Id-Version: foreman_discovery 9.1.
|
8
|
+
"Project-Id-Version: foreman_discovery 9.1.0\n"
|
9
9
|
"Report-Msgid-Bugs-To: \n"
|
10
10
|
"POT-Creation-Date: 2017-10-17 15:39+0200\n"
|
11
|
-
"PO-Revision-Date: 2017-10-
|
11
|
+
"PO-Revision-Date: 2017-10-17 23:23+0000\n"
|
12
12
|
"Last-Translator: Lukáš Zapletal\n"
|
13
13
|
"Language-Team: Korean (http://www.transifex.com/foreman/foreman/language/ko/)\n"
|
14
14
|
"MIME-Version: 1.0\n"
|
@@ -5,9 +5,9 @@
|
|
5
5
|
# Translators:
|
6
6
|
msgid ""
|
7
7
|
msgstr ""
|
8
|
-
"Project-Id-Version: foreman_discovery 9.1.
|
8
|
+
"Project-Id-Version: foreman_discovery 9.1.0\n"
|
9
9
|
"Report-Msgid-Bugs-To: \n"
|
10
|
-
"PO-Revision-Date: 2017-10-
|
10
|
+
"PO-Revision-Date: 2017-10-17 23:23+0000\n"
|
11
11
|
"Last-Translator: Lukáš Zapletal\n"
|
12
12
|
"Language-Team: Korean (http://www.transifex.com/foreman/foreman/language/ko/)\n"
|
13
13
|
"MIME-Version: 1.0\n"
|
Binary file
|
@@ -10,10 +10,10 @@
|
|
10
10
|
# Valeria S Silva <valeriassilva@live.com>, 2015
|
11
11
|
msgid ""
|
12
12
|
msgstr ""
|
13
|
-
"Project-Id-Version: foreman_discovery 9.1.
|
13
|
+
"Project-Id-Version: foreman_discovery 9.1.0\n"
|
14
14
|
"Report-Msgid-Bugs-To: \n"
|
15
15
|
"POT-Creation-Date: 2017-10-17 15:39+0200\n"
|
16
|
-
"PO-Revision-Date: 2017-10-
|
16
|
+
"PO-Revision-Date: 2017-10-17 23:23+0000\n"
|
17
17
|
"Last-Translator: Lukáš Zapletal\n"
|
18
18
|
"Language-Team: Portuguese (Brazil) (http://www.transifex.com/foreman/foreman/language/pt_BR/)\n"
|
19
19
|
"MIME-Version: 1.0\n"
|
@@ -10,9 +10,9 @@
|
|
10
10
|
# Valeria S Silva <valeriassilva@live.com>, 2015
|
11
11
|
msgid ""
|
12
12
|
msgstr ""
|
13
|
-
"Project-Id-Version: foreman_discovery 9.1.
|
13
|
+
"Project-Id-Version: foreman_discovery 9.1.0\n"
|
14
14
|
"Report-Msgid-Bugs-To: \n"
|
15
|
-
"PO-Revision-Date: 2017-10-
|
15
|
+
"PO-Revision-Date: 2017-10-17 23:23+0000\n"
|
16
16
|
"Last-Translator: Lukáš Zapletal\n"
|
17
17
|
"Language-Team: Portuguese (Brazil) (http://www.transifex.com/foreman/foreman/l"
|
18
18
|
"anguage/pt_BR/)\n"
|
Binary file
|
@@ -10,10 +10,10 @@
|
|
10
10
|
# Yulia <yulia.poyarkova@redhat.com>, 2016
|
11
11
|
msgid ""
|
12
12
|
msgstr ""
|
13
|
-
"Project-Id-Version: foreman_discovery 9.1.
|
13
|
+
"Project-Id-Version: foreman_discovery 9.1.0\n"
|
14
14
|
"Report-Msgid-Bugs-To: \n"
|
15
15
|
"POT-Creation-Date: 2017-10-17 15:39+0200\n"
|
16
|
-
"PO-Revision-Date: 2017-10-
|
16
|
+
"PO-Revision-Date: 2017-10-17 23:23+0000\n"
|
17
17
|
"Last-Translator: Lukáš Zapletal\n"
|
18
18
|
"Language-Team: Russian (http://www.transifex.com/foreman/foreman/language/ru/)\n"
|
19
19
|
"MIME-Version: 1.0\n"
|
@@ -10,9 +10,9 @@
|
|
10
10
|
# Yulia <yulia.poyarkova@redhat.com>, 2016
|
11
11
|
msgid ""
|
12
12
|
msgstr ""
|
13
|
-
"Project-Id-Version: foreman_discovery 9.1.
|
13
|
+
"Project-Id-Version: foreman_discovery 9.1.0\n"
|
14
14
|
"Report-Msgid-Bugs-To: \n"
|
15
|
-
"PO-Revision-Date: 2017-10-
|
15
|
+
"PO-Revision-Date: 2017-10-17 23:23+0000\n"
|
16
16
|
"Last-Translator: Lukáš Zapletal\n"
|
17
17
|
"Language-Team: Russian (http://www.transifex.com/foreman/foreman/language/ru/)"
|
18
18
|
"\n"
|
Binary file
|
@@ -8,7 +8,7 @@
|
|
8
8
|
# johnny.westerlund <johnny.westerlund@gmail.com>, 2014
|
9
9
|
msgid ""
|
10
10
|
msgstr ""
|
11
|
-
"Project-Id-Version: foreman_discovery 9.1.
|
11
|
+
"Project-Id-Version: foreman_discovery 9.1.0\n"
|
12
12
|
"Report-Msgid-Bugs-To: \n"
|
13
13
|
"POT-Creation-Date: 2017-10-17 15:39+0200\n"
|
14
14
|
"PO-Revision-Date: 2017-10-17 23:23+0000\n"
|
@@ -8,7 +8,7 @@
|
|
8
8
|
# johnny.westerlund <johnny.westerlund@gmail.com>, 2014
|
9
9
|
msgid ""
|
10
10
|
msgstr ""
|
11
|
-
"Project-Id-Version: foreman_discovery 9.1.
|
11
|
+
"Project-Id-Version: foreman_discovery 9.1.0\n"
|
12
12
|
"Report-Msgid-Bugs-To: \n"
|
13
13
|
"PO-Revision-Date: 2017-10-17 23:23+0000\n"
|
14
14
|
"Last-Translator: Lukáš Zapletal\n"
|
Binary file
|
@@ -5,10 +5,10 @@
|
|
5
5
|
# Translators:
|
6
6
|
msgid ""
|
7
7
|
msgstr ""
|
8
|
-
"Project-Id-Version: foreman_discovery 9.1.
|
8
|
+
"Project-Id-Version: foreman_discovery 9.1.0\n"
|
9
9
|
"Report-Msgid-Bugs-To: \n"
|
10
10
|
"POT-Creation-Date: 2017-10-17 15:39+0200\n"
|
11
|
-
"PO-Revision-Date: 2017-10-
|
11
|
+
"PO-Revision-Date: 2017-10-17 23:23+0000\n"
|
12
12
|
"Last-Translator: Lukáš Zapletal\n"
|
13
13
|
"Language-Team: Chinese (China) (http://www.transifex.com/foreman/foreman/language/zh_CN/)\n"
|
14
14
|
"MIME-Version: 1.0\n"
|
@@ -5,9 +5,9 @@
|
|
5
5
|
# Translators:
|
6
6
|
msgid ""
|
7
7
|
msgstr ""
|
8
|
-
"Project-Id-Version: foreman_discovery 9.1.
|
8
|
+
"Project-Id-Version: foreman_discovery 9.1.0\n"
|
9
9
|
"Report-Msgid-Bugs-To: \n"
|
10
|
-
"PO-Revision-Date: 2017-10-
|
10
|
+
"PO-Revision-Date: 2017-10-17 23:23+0000\n"
|
11
11
|
"Last-Translator: Lukáš Zapletal\n"
|
12
12
|
"Language-Team: Chinese (China) (http://www.transifex.com/foreman/foreman/langu"
|
13
13
|
"age/zh_CN/)\n"
|
Binary file
|
@@ -5,10 +5,10 @@
|
|
5
5
|
# Translators:
|
6
6
|
msgid ""
|
7
7
|
msgstr ""
|
8
|
-
"Project-Id-Version: foreman_discovery 9.1.
|
8
|
+
"Project-Id-Version: foreman_discovery 9.1.0\n"
|
9
9
|
"Report-Msgid-Bugs-To: \n"
|
10
10
|
"POT-Creation-Date: 2017-10-17 15:39+0200\n"
|
11
|
-
"PO-Revision-Date: 2017-10-
|
11
|
+
"PO-Revision-Date: 2017-10-17 23:23+0000\n"
|
12
12
|
"Last-Translator: Lukáš Zapletal\n"
|
13
13
|
"Language-Team: Chinese (Taiwan) (http://www.transifex.com/foreman/foreman/language/zh_TW/)\n"
|
14
14
|
"MIME-Version: 1.0\n"
|
@@ -5,9 +5,9 @@
|
|
5
5
|
# Translators:
|
6
6
|
msgid ""
|
7
7
|
msgstr ""
|
8
|
-
"Project-Id-Version: foreman_discovery 9.1.
|
8
|
+
"Project-Id-Version: foreman_discovery 9.1.0\n"
|
9
9
|
"Report-Msgid-Bugs-To: \n"
|
10
|
-
"PO-Revision-Date: 2017-10-
|
10
|
+
"PO-Revision-Date: 2017-10-17 23:23+0000\n"
|
11
11
|
"Last-Translator: Lukáš Zapletal\n"
|
12
12
|
"Language-Team: Chinese (Taiwan) (http://www.transifex.com/foreman/foreman/lang"
|
13
13
|
"uage/zh_TW/)\n"
|
@@ -35,7 +35,7 @@ class Api::V2::DiscoveredHostsControllerTest < ActionController::TestCase
|
|
35
35
|
def test_show_host
|
36
36
|
FactoryGirl.create(:organization, :name => 'SomeOrg')
|
37
37
|
FactoryGirl.create(:location, :name => 'SomeLoc')
|
38
|
-
host =
|
38
|
+
host = discover_host_from_facts(@facts)
|
39
39
|
get :show, { :id => host.id }
|
40
40
|
assert_response :success
|
41
41
|
show_response = ActiveSupport::JSON.decode(@response.body)
|
@@ -48,7 +48,7 @@ class Api::V2::DiscoveredHostsControllerTest < ActionController::TestCase
|
|
48
48
|
end
|
49
49
|
|
50
50
|
def test_delete_discovered_host
|
51
|
-
host =
|
51
|
+
host = discover_host_from_facts(@facts)
|
52
52
|
delete :destroy, { :id => host.id }
|
53
53
|
assert_response :success
|
54
54
|
end
|
@@ -56,7 +56,7 @@ class Api::V2::DiscoveredHostsControllerTest < ActionController::TestCase
|
|
56
56
|
def test_provision_host
|
57
57
|
FactoryGirl.create(:organization, :name => 'SomeOrg')
|
58
58
|
FactoryGirl.create(:location, :name => 'SomeLoc')
|
59
|
-
host =
|
59
|
+
host = discover_host_from_facts(@facts)
|
60
60
|
hostgroup = setup_hostgroup(host)
|
61
61
|
put :update,
|
62
62
|
id: host.id,
|
@@ -64,7 +64,7 @@ class Api::V2::DiscoveredHostsControllerTest < ActionController::TestCase
|
|
64
64
|
hostgroup_id: hostgroup.id
|
65
65
|
}
|
66
66
|
|
67
|
-
assert_match
|
67
|
+
assert_match(/#{host.name}/, @response.body)
|
68
68
|
assert_response :success
|
69
69
|
|
70
70
|
# Get the managed host instance from the DB
|
@@ -83,7 +83,6 @@ class Api::V2::DiscoveredHostsControllerTest < ActionController::TestCase
|
|
83
83
|
|
84
84
|
def test_auto_provision_success_via_upload
|
85
85
|
reset_api_credentials
|
86
|
-
User.current = nil
|
87
86
|
disable_orchestration
|
88
87
|
facts = @facts.merge({"somefact" => "abc"})
|
89
88
|
taxonomy = { :organizations => [organization_one], :locations => [location_one] }
|
@@ -102,11 +101,11 @@ class Api::V2::DiscoveredHostsControllerTest < ActionController::TestCase
|
|
102
101
|
def test_auto_provision_success
|
103
102
|
disable_orchestration
|
104
103
|
facts = @facts.merge({"somefact" => "abc", "discovery_version" => "2.9.9"})
|
105
|
-
host =
|
104
|
+
host = discover_host_from_facts(facts)
|
106
105
|
taxonomy = { :organizations => [host.organization], :locations => [host.location] }
|
107
106
|
rule = FactoryGirl.create(:discovery_rule, {:priority => 1, :search => "facts.somefact = abc", :hostgroup => FactoryGirl.create(:hostgroup, :with_os, :with_rootpass, taxonomy)}.merge(taxonomy))
|
108
107
|
post :auto_provision, { :id => host.id }
|
109
|
-
assert_match
|
108
|
+
assert_match(/Host #{host.name} was provisioned with rule #{rule.name}/, @response.body)
|
110
109
|
managed_host = Host.unscoped.find(host.id)
|
111
110
|
assert managed_host.build
|
112
111
|
assert_response :success
|
@@ -116,11 +115,11 @@ class Api::V2::DiscoveredHostsControllerTest < ActionController::TestCase
|
|
116
115
|
::ForemanDiscovery::NodeAPI::PowerService.any_instance.stubs(:kexec).returns(true)
|
117
116
|
Host::Managed::any_instance.stubs(:provisioning_template).with(:kind => 'kexec').returns("")
|
118
117
|
facts = @facts.merge({"somefact" => "abc", "discovery_kexec" => "kexec-tools 2.0.8 released 15 February 2015"})
|
119
|
-
host =
|
118
|
+
host = discover_host_from_facts(facts)
|
120
119
|
taxonomy = { :organizations => [host.organization], :locations => [host.location] }
|
121
120
|
rule = FactoryGirl.create(:discovery_rule, {:priority => 1, :search => "facts.somefact = abc", :hostgroup => FactoryGirl.create(:hostgroup, :with_os, :with_rootpass, taxonomy)}.merge(taxonomy))
|
122
121
|
post :auto_provision, { :id => host.id }
|
123
|
-
assert_match
|
122
|
+
assert_match(/Host #{host.name} was provisioned with rule #{rule.name}/, @response.body)
|
124
123
|
managed_host = Host.unscoped.find(host.id)
|
125
124
|
assert managed_host.build
|
126
125
|
assert_response :success
|
@@ -129,7 +128,7 @@ class Api::V2::DiscoveredHostsControllerTest < ActionController::TestCase
|
|
129
128
|
def test_auto_provision_with_wrong_org_or_loc_fail
|
130
129
|
disable_orchestration
|
131
130
|
facts = @facts.merge({"somefact" => "abc"})
|
132
|
-
host =
|
131
|
+
host = discover_host_from_facts(facts)
|
133
132
|
taxonomy = { :organizations => [FactoryGirl.create(:organization)], :locations => [FactoryGirl.create(:location)] }
|
134
133
|
FactoryGirl.create(:discovery_rule, {:priority => 1, :search => "facts.somefact = abc", :hostgroup => FactoryGirl.create(:hostgroup, :with_os, :with_rootpass, taxonomy)}.merge(taxonomy))
|
135
134
|
post :auto_provision, { :id => host.id }
|
@@ -141,7 +140,7 @@ class Api::V2::DiscoveredHostsControllerTest < ActionController::TestCase
|
|
141
140
|
disable_orchestration
|
142
141
|
SETTINGS[:organizations_enabled] = false
|
143
142
|
facts = @facts.merge({"somefact" => "abc"})
|
144
|
-
host =
|
143
|
+
host = discover_host_from_facts(facts)
|
145
144
|
taxonomy = { :locations => [host.location] }
|
146
145
|
FactoryGirl.create(:discovery_rule, {:priority => 1, :search => "facts.somefact = abc", :hostgroup => FactoryGirl.create(:hostgroup, :with_os, :with_rootpass, taxonomy)}.merge(taxonomy))
|
147
146
|
post :auto_provision, { :id => host.id }
|
@@ -154,7 +153,7 @@ class Api::V2::DiscoveredHostsControllerTest < ActionController::TestCase
|
|
154
153
|
def test_auto_provision_success_and_delete
|
155
154
|
disable_orchestration
|
156
155
|
facts = @facts.merge({"somefact" => "abc"})
|
157
|
-
host =
|
156
|
+
host = discover_host_from_facts(facts)
|
158
157
|
taxonomy = { :organizations => [host.organization], :locations => [host.location] }
|
159
158
|
FactoryGirl.create(:discovery_rule, {:priority => 1, :search => "facts.somefact = abc", :hostgroup => FactoryGirl.create(:hostgroup, :with_os, :with_rootpass, taxonomy)}.merge(taxonomy))
|
160
159
|
post :auto_provision, { :id => host.id }
|
@@ -170,7 +169,7 @@ class Api::V2::DiscoveredHostsControllerTest < ActionController::TestCase
|
|
170
169
|
def test_auto_provision_no_rule_error
|
171
170
|
disable_orchestration
|
172
171
|
facts = @facts.merge({"somefact" => "abc"})
|
173
|
-
host =
|
172
|
+
host = discover_host_from_facts(facts)
|
174
173
|
post :auto_provision, { :id => host.id }
|
175
174
|
assert_response :not_found
|
176
175
|
show_response = ActiveSupport::JSON.decode(@response.body)
|
@@ -180,11 +179,11 @@ class Api::V2::DiscoveredHostsControllerTest < ActionController::TestCase
|
|
180
179
|
def test_auto_provision_all_success
|
181
180
|
disable_orchestration
|
182
181
|
facts = @facts.merge({"somefact" => "abc"})
|
183
|
-
host =
|
182
|
+
host = discover_host_from_facts(facts)
|
184
183
|
taxonomy = { :organizations => [host.organization], :locations => [host.location] }
|
185
184
|
FactoryGirl.create(:discovery_rule, {:priority => 1, :search => "facts.somefact = abc", :hostgroup => FactoryGirl.create(:hostgroup, :with_os, :with_rootpass, taxonomy)}.merge(taxonomy))
|
186
185
|
post :auto_provision_all, {}
|
187
|
-
assert_match
|
186
|
+
assert_match(/1 discovered hosts were provisioned/, @response.body)
|
188
187
|
managed_host = Host.unscoped.find(host.id)
|
189
188
|
assert managed_host.build
|
190
189
|
assert_response :success
|
@@ -193,9 +192,9 @@ class Api::V2::DiscoveredHostsControllerTest < ActionController::TestCase
|
|
193
192
|
def test_auto_provision_all_no_rule_success
|
194
193
|
disable_orchestration
|
195
194
|
facts = @facts.merge({"somefact" => "abc"})
|
196
|
-
|
195
|
+
discover_host_from_facts(facts)
|
197
196
|
post :auto_provision_all, {}
|
198
|
-
assert_match
|
197
|
+
assert_match(/0 discovered hosts were provisioned/, @response.body)
|
199
198
|
assert_response :success
|
200
199
|
end
|
201
200
|
|
@@ -2,7 +2,6 @@ require 'test_plugin_helper'
|
|
2
2
|
|
3
3
|
class Api::V2::DiscoveryRulesControllerTest < ActionController::TestCase
|
4
4
|
setup do
|
5
|
-
User.current = User.find_by_login "admin"
|
6
5
|
set_default_settings
|
7
6
|
end
|
8
7
|
|
@@ -39,10 +38,11 @@ class Api::V2::DiscoveryRulesControllerTest < ActionController::TestCase
|
|
39
38
|
:name => "foo",
|
40
39
|
:search => "bar",
|
41
40
|
:hostgroup_id => hostgroup.id,
|
42
|
-
:organization_ids => [organization_one],
|
41
|
+
:organization_ids => [organization_one.id],
|
43
42
|
:location_ids => [location_one.id],
|
44
43
|
:hostname => "",
|
45
44
|
:priority => 1}}
|
45
|
+
refute_match /error/, response.body
|
46
46
|
end
|
47
47
|
assert_response :success
|
48
48
|
end
|
@@ -55,7 +55,6 @@ class Api::V2::DiscoveryRulesControllerTest < ActionController::TestCase
|
|
55
55
|
|
56
56
|
test "should update taxonomy for discovery rule" do
|
57
57
|
rule = FactoryGirl.create(:discovery_rule)
|
58
|
-
organization = FactoryGirl.create(:organization)
|
59
58
|
put :update, { :id => rule.to_param, :discovery_rule => { :organization_ids => [rule.organizations.first.id] } }
|
60
59
|
assert_response :success
|
61
60
|
end
|
@@ -26,7 +26,7 @@ module Api
|
|
26
26
|
test 'list discovered host facts' do
|
27
27
|
disable_orchestration
|
28
28
|
facts = @facts.merge({ "somefact" => "abc" })
|
29
|
-
host =
|
29
|
+
host = discover_host_from_facts(facts)
|
30
30
|
get :index, { :host_id => host.id }
|
31
31
|
assert_response :success
|
32
32
|
show_response = ActiveSupport::JSON.decode(@response.body)
|
@@ -30,14 +30,14 @@ class DiscoveredHostsControllerTest < ActionController::TestCase
|
|
30
30
|
:value => "bios_vendor",
|
31
31
|
:category => 'Setting::Discovered')
|
32
32
|
facts = @facts.merge({"bios_vendor" => "QEMU"})
|
33
|
-
|
33
|
+
discover_host_from_facts(facts)
|
34
34
|
get :index, {}, set_session_user_default_reader
|
35
35
|
assert_select "td", /QEMU/
|
36
36
|
assert_response :success
|
37
37
|
end
|
38
38
|
|
39
39
|
def test_show_multiple_actions
|
40
|
-
host =
|
40
|
+
host = discover_host_from_facts(@facts)
|
41
41
|
[:multiple_destroy, :select_multiple_organization, :select_multiple_location].each do |path|
|
42
42
|
xhr :post, path, {:host_ids => [host.id]}, set_session_user
|
43
43
|
assert_response :success
|
@@ -46,7 +46,7 @@ class DiscoveredHostsControllerTest < ActionController::TestCase
|
|
46
46
|
end
|
47
47
|
|
48
48
|
def test_show_page_categories
|
49
|
-
host =
|
49
|
+
host = discover_host_from_facts(@facts)
|
50
50
|
get :show, {:id => host.id}, set_session_user_default_reader
|
51
51
|
assert_select "#category-highlights" do
|
52
52
|
assert_select "#fact-ipaddress" do
|
@@ -57,7 +57,7 @@ class DiscoveredHostsControllerTest < ActionController::TestCase
|
|
57
57
|
end
|
58
58
|
|
59
59
|
def test_edit_form_elements
|
60
|
-
host =
|
60
|
+
host = discover_host_from_facts(@facts)
|
61
61
|
get :edit, {:id => host.id}, set_session_user_default_manager
|
62
62
|
assert_select "select" do |elements|
|
63
63
|
elements.each do |element|
|
@@ -68,7 +68,7 @@ class DiscoveredHostsControllerTest < ActionController::TestCase
|
|
68
68
|
end
|
69
69
|
|
70
70
|
def test_edit_form_attributes
|
71
|
-
host =
|
71
|
+
host = discover_host_from_facts(@facts)
|
72
72
|
get :edit, {:id => host.id}, set_session_user_default_reader
|
73
73
|
assert_not_nil host.cpu_count
|
74
74
|
end
|
@@ -82,7 +82,7 @@ class DiscoveredHostsControllerTest < ActionController::TestCase
|
|
82
82
|
|
83
83
|
def test_edit_form_quick_submit
|
84
84
|
disable_taxonomies do
|
85
|
-
host =
|
85
|
+
host = discover_host_from_facts(@facts)
|
86
86
|
domain = FactoryGirl.create(:domain)
|
87
87
|
hostgroup = FactoryGirl.create(:hostgroup, :with_subnet, :with_environment, :with_rootpass, :with_os, :domain => domain)
|
88
88
|
get :edit, {
|
@@ -101,7 +101,7 @@ class DiscoveredHostsControllerTest < ActionController::TestCase
|
|
101
101
|
end
|
102
102
|
|
103
103
|
def test_edit_form_submit_parameters
|
104
|
-
host =
|
104
|
+
host = discover_host_from_facts(@facts)
|
105
105
|
hostgroup = setup_hostgroup(host)
|
106
106
|
get :edit, {
|
107
107
|
:id => host.id,
|
@@ -134,31 +134,29 @@ class DiscoveredHostsControllerTest < ActionController::TestCase
|
|
134
134
|
end
|
135
135
|
|
136
136
|
def test_update_inheritance
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
assert_equal hostgroup.puppet_ca_proxy_id, actual.puppet_ca_proxy_id
|
161
|
-
end
|
137
|
+
host = discover_host_from_facts(@facts)
|
138
|
+
hostgroup = setup_hostgroup(host)
|
139
|
+
put :update, {
|
140
|
+
commit: 'Update',
|
141
|
+
id: host.id,
|
142
|
+
host: {
|
143
|
+
name: 'mytest',
|
144
|
+
hostgroup_id: hostgroup.id
|
145
|
+
}
|
146
|
+
}, set_session_user(User.current)
|
147
|
+
|
148
|
+
# Get the managed host instance from the DB
|
149
|
+
actual = Host.find(host.id)
|
150
|
+
|
151
|
+
assert_equal hostgroup.id, actual.hostgroup_id
|
152
|
+
assert_equal hostgroup.architecture_id, actual.architecture_id
|
153
|
+
assert_equal hostgroup.operatingsystem_id, actual.operatingsystem_id
|
154
|
+
assert_equal hostgroup.medium_id, actual.medium_id
|
155
|
+
assert_equal hostgroup.ptable_id, actual.ptable_id
|
156
|
+
assert_equal hostgroup.domain_id, actual.domain_id
|
157
|
+
assert_equal hostgroup.environment_id, actual.environment_id
|
158
|
+
assert_equal hostgroup.puppet_proxy_id, actual.puppet_proxy_id
|
159
|
+
assert_equal hostgroup.puppet_ca_proxy_id, actual.puppet_ca_proxy_id
|
162
160
|
end
|
163
161
|
|
164
162
|
def test_add_entry_to_nav_menu
|
@@ -168,7 +166,7 @@ class DiscoveredHostsControllerTest < ActionController::TestCase
|
|
168
166
|
|
169
167
|
def test_reboot_success
|
170
168
|
@request.env["HTTP_REFERER"] = discovered_hosts_url
|
171
|
-
host =
|
169
|
+
host = discover_host_from_facts(@facts)
|
172
170
|
::ForemanDiscovery::NodeAPI::PowerService.any_instance.expects(:reboot).returns(true)
|
173
171
|
post "reboot", { :id => host.id }, set_session_user_default_manager
|
174
172
|
assert_redirected_to discovered_hosts_url
|
@@ -176,24 +174,9 @@ class DiscoveredHostsControllerTest < ActionController::TestCase
|
|
176
174
|
assert_equal "Rebooting host #{host.name}", flash[:notice]
|
177
175
|
end
|
178
176
|
|
179
|
-
def test_reboot_success_legacy
|
180
|
-
@request.env["HTTP_REFERER"] = discovered_hosts_url
|
181
|
-
facts = @facts.merge({"somefact" => "abc", "discovery_version" => "2.9.9"})
|
182
|
-
host = Host::Discovered.import_host(facts)
|
183
|
-
Host::Discovered::any_instance.stubs(:proxied?).returns(false)
|
184
|
-
Host::Discovered::any_instance.stubs(:proxy_url).returns("http://1.2.3.4:8443")
|
185
|
-
::ForemanDiscovery::NodeAPI::PowerLegacyDirectService.any_instance.expects(:reboot).returns(true)
|
186
|
-
ActiveSupport::Deprecation.silence do
|
187
|
-
post "reboot", { :id => host.id }, set_session_user
|
188
|
-
end
|
189
|
-
assert_redirected_to discovered_hosts_url
|
190
|
-
assert_nil flash[:error]
|
191
|
-
assert_equal "Rebooting host #{host.name}", flash[:notice]
|
192
|
-
end
|
193
|
-
|
194
177
|
def test_reboot_failure
|
195
178
|
@request.env["HTTP_REFERER"] = discovered_hosts_url
|
196
|
-
host =
|
179
|
+
host = discover_host_from_facts(@facts)
|
197
180
|
::ForemanDiscovery::NodeAPI::PowerService.any_instance.expects(:reboot).returns(false)
|
198
181
|
post "reboot", { :id => host.id }, set_session_user_default_manager
|
199
182
|
assert_redirected_to discovered_hosts_url
|
@@ -202,7 +185,7 @@ class DiscoveredHostsControllerTest < ActionController::TestCase
|
|
202
185
|
|
203
186
|
def test_reboot_error
|
204
187
|
@request.env["HTTP_REFERER"] = discovered_hosts_url
|
205
|
-
host =
|
188
|
+
host = discover_host_from_facts(@facts)
|
206
189
|
::ForemanDiscovery::NodeAPI::PowerService.any_instance.expects(:reboot).raises("request failed")
|
207
190
|
post "reboot", { :id => host.id }, set_session_user_default_manager
|
208
191
|
assert_redirected_to discovered_hosts_url
|
@@ -210,68 +193,60 @@ class DiscoveredHostsControllerTest < ActionController::TestCase
|
|
210
193
|
end
|
211
194
|
|
212
195
|
def test_auto_provision_success
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
assert managed_host.build
|
225
|
-
end
|
196
|
+
disable_orchestration
|
197
|
+
facts = @facts.merge({"somefact" => "abc"})
|
198
|
+
host = discover_host_from_facts(facts)
|
199
|
+
hostgroup = setup_hostgroup(host)
|
200
|
+
FactoryGirl.create(:discovery_rule, :priority => 1, :search => "facts.somefact = abc", :hostgroup => hostgroup, :organizations => [host.organization], :locations => [host.location])
|
201
|
+
post :auto_provision, { :id => host.id }, set_session_user(User.current)
|
202
|
+
assert_response :redirect
|
203
|
+
assert_nil flash[:error]
|
204
|
+
assert_match(/^Host macaabbccddeeff.* was provisioned/, flash[:notice])
|
205
|
+
managed_host = Host.find(host.id)
|
206
|
+
assert managed_host.build
|
226
207
|
end
|
227
208
|
|
228
209
|
def test_auto_provision_no_rule_success
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
post :auto_provision, { :id => host.id }, set_session_user(User.current)
|
234
|
-
end
|
210
|
+
disable_orchestration
|
211
|
+
facts = @facts.merge({"somefact" => "abc"})
|
212
|
+
host = discover_host_from_facts(facts)
|
213
|
+
post :auto_provision, { :id => host.id }, set_session_user(User.current)
|
235
214
|
assert_response :redirect
|
236
215
|
assert_nil flash[:error]
|
237
216
|
assert_equal "No rule found for host macaabbccddeeff", flash[:notice]
|
238
217
|
end
|
239
218
|
|
240
219
|
def test_auto_provision_all_success
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
post :auto_provision_all, {}, set_session_user(User.current)
|
254
|
-
end
|
220
|
+
disable_orchestration
|
221
|
+
facts = @facts.merge({"somefact" => "abc"})
|
222
|
+
host = discover_host_from_facts(facts)
|
223
|
+
hostgroup = setup_hostgroup(host)
|
224
|
+
FactoryGirl.create(
|
225
|
+
:discovery_rule,
|
226
|
+
:priority => 1,
|
227
|
+
:search => "facts.somefact = abc",
|
228
|
+
:hostgroup => hostgroup,
|
229
|
+
:organizations => [host.organization], :locations => [host.location]
|
230
|
+
)
|
231
|
+
post :auto_provision_all, {}, set_session_user(User.current)
|
255
232
|
assert_response :redirect
|
256
233
|
assert_nil flash[:error]
|
257
234
|
assert_equal "Discovered hosts are provisioning now", flash[:notice]
|
258
235
|
end
|
259
236
|
|
260
237
|
def test_auto_provision_all_no_rule_success
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
post :auto_provision_all, {}, set_session_user(User.current)
|
274
|
-
end
|
238
|
+
disable_orchestration
|
239
|
+
facts = @facts.merge({"somefact" => "abc"})
|
240
|
+
host = discover_host_from_facts(facts)
|
241
|
+
hostgroup = setup_hostgroup(host)
|
242
|
+
FactoryGirl.create(
|
243
|
+
:discovery_rule,
|
244
|
+
:priority => 1,
|
245
|
+
:search => "facts.somefact = abc",
|
246
|
+
:hostgroup => hostgroup,
|
247
|
+
:organizations => [host.organization], :locations => [host.location]
|
248
|
+
)
|
249
|
+
post :auto_provision_all, {}, set_session_user(User.current)
|
275
250
|
assert_response :redirect
|
276
251
|
assert_nil flash[:error]
|
277
252
|
assert_equal "Discovered hosts are provisioning now", flash[:notice]
|
@@ -279,7 +254,7 @@ class DiscoveredHostsControllerTest < ActionController::TestCase
|
|
279
254
|
|
280
255
|
def test_reboot_all_success
|
281
256
|
@request.env["HTTP_REFERER"] = discovered_hosts_url
|
282
|
-
host =
|
257
|
+
host = discover_host_from_facts(@facts)
|
283
258
|
::ForemanDiscovery::NodeAPI::PowerService.any_instance.expects(:reboot).returns(true)
|
284
259
|
post "reboot", { :id => host.id }, set_session_user_default_manager
|
285
260
|
assert_redirected_to discovered_hosts_url
|
@@ -290,7 +265,7 @@ class DiscoveredHostsControllerTest < ActionController::TestCase
|
|
290
265
|
|
291
266
|
def test_reboot_all_failure
|
292
267
|
@request.env["HTTP_REFERER"] = discovered_hosts_url
|
293
|
-
host =
|
268
|
+
host = discover_host_from_facts(@facts)
|
294
269
|
::ForemanDiscovery::NodeAPI::PowerService.any_instance.expects(:reboot).returns(false)
|
295
270
|
post "reboot_all", { }, set_session_user_default_manager
|
296
271
|
assert_redirected_to discovered_hosts_url
|
@@ -300,7 +275,7 @@ class DiscoveredHostsControllerTest < ActionController::TestCase
|
|
300
275
|
|
301
276
|
def test_reboot_all_error
|
302
277
|
@request.env["HTTP_REFERER"] = discovered_hosts_url
|
303
|
-
|
278
|
+
discover_host_from_facts(@facts)
|
304
279
|
::ForemanDiscovery::NodeAPI::PowerService.any_instance.expects(:reboot).raises("request failed")
|
305
280
|
post "reboot_all", { }, set_session_user_default_manager
|
306
281
|
assert_redirected_to discovered_hosts_url
|
@@ -309,44 +284,38 @@ class DiscoveredHostsControllerTest < ActionController::TestCase
|
|
309
284
|
end
|
310
285
|
|
311
286
|
def test_no_dns_rebuild_if_dns_pending
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
}, set_session_user(User.current)
|
323
|
-
end
|
287
|
+
host = discover_host_from_facts(@facts)
|
288
|
+
hostgroup = prepare_hostgroup_for_dns_rebuild(host)
|
289
|
+
Nic::Managed.any_instance.expects(:rebuild_dns).never
|
290
|
+
Host::Managed.any_instance.stubs(:skip_orchestration?).returns(false)
|
291
|
+
put :update, {:commit => "Update", :id => host.id,
|
292
|
+
:host => {
|
293
|
+
:name => 'mytest',
|
294
|
+
:hostgroup_id => hostgroup.id,
|
295
|
+
}
|
296
|
+
}, set_session_user(User.current)
|
324
297
|
end
|
325
298
|
|
326
299
|
def test_dns_rebuild
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
}, set_session_user(User.current)
|
338
|
-
end
|
300
|
+
host = prepare_host_for_dns_rebuild
|
301
|
+
hostgroup = prepare_hostgroup_for_dns_rebuild(host)
|
302
|
+
Nic::Managed.any_instance.expects(:rebuild_dns)
|
303
|
+
Host::Managed.any_instance.stubs(:skip_orchestration?).returns(false)
|
304
|
+
put :update, {:commit => "Update", :id => host.id,
|
305
|
+
:host => {
|
306
|
+
:name => 'mytest',
|
307
|
+
:hostgroup_id => hostgroup.id,
|
308
|
+
}
|
309
|
+
}, set_session_user(User.current)
|
339
310
|
end
|
340
311
|
|
341
312
|
def test_dns_rebuild_with_auto_provision
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
post :auto_provision, { :id => host.id }, set_session_user(User.current)
|
349
|
-
end
|
313
|
+
host = prepare_host_for_dns_rebuild
|
314
|
+
hostgroup = prepare_hostgroup_for_dns_rebuild(host)
|
315
|
+
Nic::Managed.any_instance.expects(:rebuild_dns)
|
316
|
+
Host::Managed.any_instance.stubs(:skip_orchestration?).returns(false)
|
317
|
+
FactoryGirl.create(:discovery_rule, :priority => 1, :search => "name = mytest.myorchdomain.net", :hostgroup_id => hostgroup.id, :organizations => [host.organization], :locations => [host.location])
|
318
|
+
post :auto_provision, { :id => host.id }, set_session_user(User.current)
|
350
319
|
end
|
351
320
|
|
352
321
|
private
|
@@ -356,7 +325,7 @@ class DiscoveredHostsControllerTest < ActionController::TestCase
|
|
356
325
|
end
|
357
326
|
|
358
327
|
def prepare_host_for_dns_rebuild
|
359
|
-
host =
|
328
|
+
host = discover_host_from_facts(@facts)
|
360
329
|
host.name = 'mytest.myorchdomain.net'
|
361
330
|
host.save
|
362
331
|
host
|