foreman_salt 0.0.2
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 +7 -0
- data/LICENSE +619 -0
- data/README.md +29 -0
- data/Rakefile +40 -0
- data/app/controllers/foreman_salt/concerns/hostgroups_controller_extensions.rb +19 -0
- data/app/controllers/foreman_salt/concerns/hosts_controller_extensions.rb +69 -0
- data/app/controllers/foreman_salt/concerns/smart_proxy_auth_extensions.rb +24 -0
- data/app/controllers/foreman_salt/concerns/unattended_controller_extensions.rb +18 -0
- data/app/controllers/foreman_salt/salt_autosign_controller.rb +43 -0
- data/app/controllers/foreman_salt/salt_keys_controller.rb +59 -0
- data/app/controllers/foreman_salt/salt_modules_controller.rb +45 -0
- data/app/helpers/concerns/foreman_salt/hosts_helper_extensions.rb +28 -0
- data/app/helpers/concerns/foreman_salt/smart_proxies_helper_extensions.rb +22 -0
- data/app/helpers/foreman_salt/salt_keys_helper.rb +9 -0
- data/app/lib/proxy_api/salt.rb +60 -0
- data/app/models/concerns/foreman_salt/host_managed_extensions.rb +64 -0
- data/app/models/concerns/foreman_salt/hostgroup_extensions.rb +49 -0
- data/app/models/concerns/foreman_salt/orchestration/salt.rb +72 -0
- data/app/models/foreman_salt/fact_name.rb +4 -0
- data/app/models/foreman_salt/salt_module.rb +22 -0
- data/app/overrides/foreman/salt_modules/_host_tab.html.erb +2 -0
- data/app/overrides/foreman/salt_modules/_host_tab_pane.html.erb +22 -0
- data/app/overrides/salt_modules_selector.rb +19 -0
- data/app/overrides/salt_proxy_selector.rb +13 -0
- data/app/services/foreman_salt/fact_importer.rb +108 -0
- data/app/services/foreman_salt/smart_proxies/salt_keys.rb +68 -0
- data/app/views/foreman_salt/salt_autosign/_form.html.erb +8 -0
- data/app/views/foreman_salt/salt_autosign/index.html.erb +21 -0
- data/app/views/foreman_salt/salt_autosign/new.html.erb +3 -0
- data/app/views/foreman_salt/salt_keys/index.erb +34 -0
- data/app/views/foreman_salt/salt_modules/_form.html.erb +15 -0
- data/app/views/foreman_salt/salt_modules/edit.html.erb +4 -0
- data/app/views/foreman_salt/salt_modules/index.html.erb +23 -0
- data/app/views/foreman_salt/salt_modules/new.html.erb +4 -0
- data/config/routes.rb +32 -0
- data/db/migrate/20140813081913_add_salt_proxy_to_host_and_host_group.rb +12 -0
- data/db/migrate/20140817210214_create_salt_modules.rb +20 -0
- data/db/migrate/20140829210214_add_salt_modules_to_hostgroups.rb +12 -0
- data/db/seeds.d/75-salt-seeds.rb +31 -0
- data/lib/foreman_salt/engine.rb +90 -0
- data/lib/foreman_salt/version.rb +3 -0
- data/lib/foreman_salt.rb +4 -0
- data/lib/tasks/foreman_salt_tasks.rake +31 -0
- data/test/factories/foreman_salt_factories.rb +32 -0
- data/test/functional/hosts_controller_test.rb +17 -0
- data/test/integration/salt_autosign_test.rb +29 -0
- data/test/integration/salt_keys_test.rb +45 -0
- data/test/integration/salt_module_test.rb +27 -0
- data/test/test_plugin_helper.rb +14 -0
- data/test/unit/grains_centos.json +108 -0
- data/test/unit/grains_importer_test.rb +38 -0
- data/test/unit/host_extensions_test.rb +32 -0
- data/test/unit/hostgroup_extensions_test.rb +40 -0
- data/test/unit/salt_keys_test.rb +46 -0
- metadata +122 -0
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'test_plugin_helper'
|
2
|
+
|
3
|
+
module ForemanSalt
|
4
|
+
class SaltKeysTest < ActionDispatch::IntegrationTest
|
5
|
+
setup do
|
6
|
+
@proxy = FactoryGirl.create :smart_proxy, :with_salt_feature
|
7
|
+
|
8
|
+
::ProxyAPI::Salt.any_instance.stubs(:autosign_list).returns(
|
9
|
+
['foo.example.com']
|
10
|
+
)
|
11
|
+
end
|
12
|
+
|
13
|
+
test "smart proxy page has autosign link" do
|
14
|
+
assert_row_button(smart_proxies_path, @proxy.name, 'Salt Autosign', dropdown = true)
|
15
|
+
end
|
16
|
+
|
17
|
+
test "index page" do
|
18
|
+
visit smart_proxy_salt_autosign_index_path(:smart_proxy_id => @proxy.id)
|
19
|
+
assert find_link('Keys').visible?, "Keys is not visible"
|
20
|
+
assert has_content?("Autosign entries for #{@proxy.name}"), "Page title does not appear"
|
21
|
+
assert has_content?("Displaying"), "Pagination 'Display ...' does not appear"
|
22
|
+
end
|
23
|
+
|
24
|
+
test "has list of autosign" do
|
25
|
+
visit smart_proxy_salt_autosign_index_path(:smart_proxy_id => @proxy.id)
|
26
|
+
assert has_content?("foo.example.com"), "Missing autosign entry on index page"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'test_plugin_helper'
|
2
|
+
|
3
|
+
module ForemanSalt
|
4
|
+
class SaltKeysTest < ActionDispatch::IntegrationTest
|
5
|
+
setup do
|
6
|
+
@proxy = FactoryGirl.create :smart_proxy, :with_salt_feature
|
7
|
+
|
8
|
+
::ProxyAPI::Salt.any_instance.stubs(:key_list).returns(
|
9
|
+
{
|
10
|
+
"saltstack.example.com" => {"state"=>"accepted", "fingerprint"=>"98:c2:63:c1:57:59:bc:bd:f1:ef:5a:38:b2:e9:71:c0"},
|
11
|
+
"saltclient01.example.com" => {"state"=>"unaccepted", "fingerprint"=>"98:c2:63:c1:57:59:bc:bd:f1:ef:5a:38:b2:e9:71:c1"},
|
12
|
+
"saltclient02.example.com" => {"state"=>"unaccepted", "fingerprint"=>"98:c2:63:c1:57:59:bc:bd:f1:ef:5a:38:b2:e9:71:c2"},
|
13
|
+
"saltclient03.example.com "=> {"state"=>"rejected", "fingerprint"=>"98:c2:63:c1:57:59:bc:bd:f1:ef:5a:38:b2:e9:71:c3"}
|
14
|
+
}
|
15
|
+
)
|
16
|
+
end
|
17
|
+
|
18
|
+
test "smart proxy page has keys link" do
|
19
|
+
assert_row_button(smart_proxies_path, @proxy.name, 'Salt Keys', dropdown = true)
|
20
|
+
end
|
21
|
+
|
22
|
+
test "index page" do
|
23
|
+
visit smart_proxy_salt_keys_path(:smart_proxy_id => @proxy.id)
|
24
|
+
assert find_link('Autosign').visible?, "Autosign is not visible"
|
25
|
+
assert has_content?("Salt Keys on #{@proxy.name}"), "Page title does not appear"
|
26
|
+
assert has_content?("Displaying"), "Pagination 'Display ...' does not appear"
|
27
|
+
end
|
28
|
+
|
29
|
+
test "has list of keys" do
|
30
|
+
visit smart_proxy_salt_keys_path(:smart_proxy_id => @proxy.id)
|
31
|
+
assert has_content?("saltclient01.example.com"), "Missing key on index page"
|
32
|
+
assert has_content?("98:c2:63:c1:57:59:bc:bd:f1:ef:5a:38:b2:e9:71:c1"), "Missing fingerprint on index page"
|
33
|
+
end
|
34
|
+
|
35
|
+
test "has accept link" do
|
36
|
+
::ProxyAPI::Salt.any_instance.stubs(:key_accept).returns(true)
|
37
|
+
assert_row_button(smart_proxy_salt_keys_path(:smart_proxy_id => @proxy.id), 'saltclient01.example.com', 'Accept', dropdown = true)
|
38
|
+
end
|
39
|
+
|
40
|
+
test "has reject link" do
|
41
|
+
::ProxyAPI::Salt.any_instance.stubs(:key_reject).returns(true)
|
42
|
+
assert_row_button(smart_proxy_salt_keys_path(:smart_proxy_id => @proxy.id), 'saltclient01.example.com', 'Reject', dropdown = true)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'test_plugin_helper'
|
2
|
+
|
3
|
+
module ForemanSalt
|
4
|
+
class SaltModuleTest < ActionDispatch::IntegrationTest
|
5
|
+
|
6
|
+
test "index page" do
|
7
|
+
FactoryGirl.create_list :salt_module, 50
|
8
|
+
assert_index_page(salt_modules_path, "Salt modules", "New Salt module")
|
9
|
+
end
|
10
|
+
|
11
|
+
test "create new page" do
|
12
|
+
assert_new_button(salt_modules_path, "New Salt module", new_salt_module_path)
|
13
|
+
fill_in "foreman_salt_salt_module_name", :with => "common"
|
14
|
+
assert_submit_button(salt_modules_path)
|
15
|
+
assert page.has_link? 'common'
|
16
|
+
end
|
17
|
+
|
18
|
+
test "edit page" do
|
19
|
+
salt_module = FactoryGirl.create :salt_module
|
20
|
+
visit salt_modules_path
|
21
|
+
click_link salt_module.name
|
22
|
+
fill_in "foreman_salt_salt_module_name", :with => "some_other_name"
|
23
|
+
assert_submit_button(salt_modules_path)
|
24
|
+
assert page.has_link? 'some_other_name'
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# This calls the main test_helper in Foreman-core
|
2
|
+
require 'test_helper'
|
3
|
+
|
4
|
+
def assert_row_button(index_path, link_text, button_text, dropdown = false)
|
5
|
+
visit index_path
|
6
|
+
within(:xpath, "//tr[contains(.,'#{link_text}')]") do
|
7
|
+
find("i.caret").click if dropdown
|
8
|
+
click_link(button_text)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
# Add plugin to FactoryGirl's paths
|
13
|
+
FactoryGirl.definition_file_paths << File.join(File.dirname(__FILE__), 'factories')
|
14
|
+
FactoryGirl.reload
|
@@ -0,0 +1,108 @@
|
|
1
|
+
{
|
2
|
+
"facts": {
|
3
|
+
"kernelrelease": "2.6.32-431.23.3.el6.x86_64",
|
4
|
+
"ipv6::0": "::1",
|
5
|
+
"ipv6::1": "fe80::5054:ff:fe35:302a",
|
6
|
+
"saltversioninfo": [
|
7
|
+
2014,
|
8
|
+
1,
|
9
|
+
7
|
10
|
+
],
|
11
|
+
"operatingsystem": "CentOS",
|
12
|
+
"lsb_distrib_id": "CentOS",
|
13
|
+
"pythonversion::2": 6,
|
14
|
+
"pythonversion::3": "final",
|
15
|
+
"pythonversion::0": 2,
|
16
|
+
"pythonversion::1": 6,
|
17
|
+
"cpu_model": "QEMU Virtual CPU version (cpu64-rhel6)",
|
18
|
+
"pythonversion::4": 0,
|
19
|
+
"oscodename": "Final",
|
20
|
+
"num_gpus": 1,
|
21
|
+
"productname": "KVM",
|
22
|
+
"osarch": "x86_64",
|
23
|
+
"biosversion": "0.5.1",
|
24
|
+
"kernel": "Linux",
|
25
|
+
"domain": "example.com",
|
26
|
+
"pythonpath::4": "/usr/lib64/python2.6/lib-tk",
|
27
|
+
"pythonpath::5": "/usr/lib64/python2.6/lib-old",
|
28
|
+
"pythonpath::6": "/usr/lib64/python2.6/lib-dynload",
|
29
|
+
"pythonpath::7": "/usr/lib64/python2.6/site-packages",
|
30
|
+
"pythonpath::0": "/usr/bin",
|
31
|
+
"mem_total": 742,
|
32
|
+
"pythonpath::2": "/usr/lib64/python2.6",
|
33
|
+
"pythonpath::3": "/usr/lib64/python2.6/plat-linux2",
|
34
|
+
"pythonpath::8": "/usr/lib/python2.6/site-packages",
|
35
|
+
"cpu_flags::25": "pni",
|
36
|
+
"cpu_flags::24": "unfair_spinlock",
|
37
|
+
"cpu_flags::27": "hypervisor",
|
38
|
+
"cpu_flags::26": "cx16",
|
39
|
+
"cpu_flags::21": "nx",
|
40
|
+
"cpu_flags::20": "syscall",
|
41
|
+
"cpu_flags::23": "up",
|
42
|
+
"cpu_flags::22": "lm",
|
43
|
+
"cpu_flags::28": "lahf_lm",
|
44
|
+
"defaultlanguage": "en_US",
|
45
|
+
"osfullname": "CentOS",
|
46
|
+
"localhost": "saltclient01.example.com",
|
47
|
+
"lsb_distrib_release": "6.5",
|
48
|
+
"saltpath": "/usr/lib/python2.6/site-packages/salt",
|
49
|
+
"biosreleasedate": "01/01/2007",
|
50
|
+
"host": "saltclient01",
|
51
|
+
"defaultencoding": "UTF8",
|
52
|
+
"path": "/sbin:/usr/sbin:/bin:/usr/bin",
|
53
|
+
"ip_interfaces::eth0::0": "10.7.13.141",
|
54
|
+
"manufacturer": "Red Hat",
|
55
|
+
"fqdn": "saltclient01.example.com",
|
56
|
+
"os": "CentOS",
|
57
|
+
"osfinger": "CentOS-6",
|
58
|
+
"ps": "ps -efH",
|
59
|
+
"server_id": 654860635,
|
60
|
+
"zmqversion": "3.2.4",
|
61
|
+
"osmajorrelease::1": "5",
|
62
|
+
"osmajorrelease::0": "6",
|
63
|
+
"ip_interfaces::lo::0": "127.0.0.1",
|
64
|
+
"master": "saltstack.example.com",
|
65
|
+
"shell": "/bin/sh",
|
66
|
+
"saltversion": "2014.1.7",
|
67
|
+
"hwaddr_interfaces::lo": "00:00:00:00:00:00",
|
68
|
+
"_timestamp": "2014-08-28 10:02:16 ",
|
69
|
+
"cpu_flags::18": "sse",
|
70
|
+
"cpu_flags::19": "sse2",
|
71
|
+
"cpu_flags::14": "pse36",
|
72
|
+
"cpu_flags::15": "clflush",
|
73
|
+
"cpu_flags::16": "mmx",
|
74
|
+
"cpu_flags::17": "fxsr",
|
75
|
+
"cpu_flags::10": "mtrr",
|
76
|
+
"cpu_flags::11": "pge",
|
77
|
+
"cpu_flags::12": "mca",
|
78
|
+
"cpu_flags::13": "cmov",
|
79
|
+
"cpuarch": "x86_64",
|
80
|
+
"pythonpath::1": "/usr/lib64/python26.zip",
|
81
|
+
"cpu_flags::6": "mce",
|
82
|
+
"cpu_flags::7": "cx8",
|
83
|
+
"cpu_flags::4": "msr",
|
84
|
+
"cpu_flags::5": "pae",
|
85
|
+
"cpu_flags::2": "pse",
|
86
|
+
"cpu_flags::3": "tsc",
|
87
|
+
"cpu_flags::0": "fpu",
|
88
|
+
"cpu_flags::1": "de",
|
89
|
+
"serialnumber": "Not Specified",
|
90
|
+
"hwaddr_interfaces::eth0": "52:54:00:35:30:2a",
|
91
|
+
"cpu_flags::8": "apic",
|
92
|
+
"cpu_flags::9": "sep",
|
93
|
+
"gpus::0::model": "GD 5446",
|
94
|
+
"id": "saltclient01.example.com",
|
95
|
+
"osrelease": "6.5",
|
96
|
+
"num_cpus": 1,
|
97
|
+
"virtual": "kvm",
|
98
|
+
"ipv4::0": "10.7.13.141",
|
99
|
+
"ipv4::1": "127.0.0.1",
|
100
|
+
"_type": "foreman_salt",
|
101
|
+
"nodename": "saltclient01.example.com",
|
102
|
+
"os_family": "RedHat",
|
103
|
+
"operatingsystemrelease": "6.5",
|
104
|
+
"gpus::0::vendor": "unknown",
|
105
|
+
"lsb_distrib_codename": "Final"
|
106
|
+
},
|
107
|
+
"name": "saltclient01.example.com"
|
108
|
+
}
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'test_plugin_helper'
|
2
|
+
|
3
|
+
module ForemanSalt
|
4
|
+
class GrainsImporterTest < ActiveSupport::TestCase
|
5
|
+
setup do
|
6
|
+
User.current = User.find_by_login "admin"
|
7
|
+
Setting[:create_new_host_when_facts_are_uploaded] = true
|
8
|
+
|
9
|
+
# I don't even know, the plug-in successfully registers the importer
|
10
|
+
# in development, and even on the Rails test console but not here
|
11
|
+
# in the test itself...
|
12
|
+
::FactImporter.stubs(:importer_for).returns(ForemanSalt::FactImporter)
|
13
|
+
|
14
|
+
grains = JSON.parse(File.read(File.join(Engine.root, "test", "unit", "grains_centos.json")))
|
15
|
+
@host = grains["name"]
|
16
|
+
@facts = grains["facts"]
|
17
|
+
end
|
18
|
+
|
19
|
+
test "importing salt grains creates a host" do
|
20
|
+
refute Host.find_by_name(@host)
|
21
|
+
::Host::Managed.import_host_and_facts @host, @facts
|
22
|
+
assert Host.find_by_name(@host)
|
23
|
+
end
|
24
|
+
|
25
|
+
test "grains are successfully imported for a host" do
|
26
|
+
(host, state) = ::Host::Managed.import_host_and_facts @host, @facts
|
27
|
+
assert_equal 'CentOS', host.facts_hash['operatingsystem']
|
28
|
+
end
|
29
|
+
|
30
|
+
test "nested facts have valid parents" do
|
31
|
+
(host, state) = ::Host::Managed.import_host_and_facts @host, @facts
|
32
|
+
parent = ::FactName.find_by_name('cpu_flags')
|
33
|
+
children = host.fact_values.with_fact_parent_id(parent)
|
34
|
+
assert_not_empty children
|
35
|
+
assert_empty children.map(&:fact_name).reject { |fact| fact.name =~ /\Acpu_flags#{FactName::SEPARATOR}[0-9]+/ }
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'test_plugin_helper'
|
2
|
+
|
3
|
+
module ForemanSalt
|
4
|
+
class HostExtensionsTest < ActiveSupport::TestCase
|
5
|
+
setup do
|
6
|
+
User.current = User.find_by_login "admin"
|
7
|
+
end
|
8
|
+
|
9
|
+
test "host has a salt smart proxy" do
|
10
|
+
host = FactoryGirl.create :host, :with_salt_proxy
|
11
|
+
assert host.salt_proxy.features.map(&:name).include? 'Salt'
|
12
|
+
end
|
13
|
+
|
14
|
+
test "smart_proxy_ids returns salt smart proxy" do
|
15
|
+
host = FactoryGirl.create :host, :with_salt_proxy
|
16
|
+
assert host.smart_proxy_ids.include? host.salt_proxy_id
|
17
|
+
end
|
18
|
+
|
19
|
+
test "host params includes salt_master" do
|
20
|
+
host = FactoryGirl.create :host, :with_salt_proxy
|
21
|
+
assert host.params.key? "salt_master"
|
22
|
+
assert_equal host.params["salt_master"], host.salt_master
|
23
|
+
end
|
24
|
+
|
25
|
+
test "host inherits salt proxy from host group" do
|
26
|
+
hostgroup = FactoryGirl.create :hostgroup, :with_salt_proxy
|
27
|
+
host = FactoryGirl.create :host, :hostgroup => hostgroup
|
28
|
+
host.set_hostgroup_defaults
|
29
|
+
assert_equal host.salt_proxy, hostgroup.salt_proxy
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'test_plugin_helper'
|
2
|
+
|
3
|
+
module ForemanSalt
|
4
|
+
class HostgroupExtensionsTest < ActiveSupport::TestCase
|
5
|
+
setup do
|
6
|
+
User.current = User.find_by_login "admin"
|
7
|
+
end
|
8
|
+
|
9
|
+
test "host group has a salt smart proxy" do
|
10
|
+
hostgroup = FactoryGirl.create :hostgroup, :with_salt_proxy
|
11
|
+
assert hostgroup.salt_proxy.features.map(&:name).include? 'Salt'
|
12
|
+
end
|
13
|
+
|
14
|
+
test "nested host group inherits salt modules from parent" do
|
15
|
+
parent = FactoryGirl.create :hostgroup, :with_salt_modules
|
16
|
+
child = FactoryGirl.create :hostgroup, :parent => parent
|
17
|
+
assert_equal [], parent.salt_modules - child.salt_modules
|
18
|
+
end
|
19
|
+
|
20
|
+
test "child host group inherits salt proxy from child parent" do
|
21
|
+
parent = FactoryGirl.create :hostgroup
|
22
|
+
child_one = FactoryGirl.create :hostgroup, :with_salt_proxy, :parent => parent
|
23
|
+
child_two = FactoryGirl.create :hostgroup, :parent => child_one
|
24
|
+
assert_equal child_two.salt_proxy, child_one.salt_proxy
|
25
|
+
end
|
26
|
+
|
27
|
+
test "child and parent salt modules are combined" do
|
28
|
+
parent = FactoryGirl.create :hostgroup, :with_salt_modules
|
29
|
+
child = FactoryGirl.create :hostgroup, :with_salt_modules, :parent => parent
|
30
|
+
assert_equal 10, (child.salt_modules - parent.salt_modules).length
|
31
|
+
end
|
32
|
+
|
33
|
+
test "second child inherits from parent" do
|
34
|
+
parent = FactoryGirl.create :hostgroup, :with_salt_modules
|
35
|
+
child_one = FactoryGirl.create :hostgroup, :parent => parent
|
36
|
+
child_two = FactoryGirl.create :hostgroup, :parent => child_one
|
37
|
+
assert_equal [], parent.salt_modules - child_two.salt_modules
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'test_plugin_helper'
|
2
|
+
|
3
|
+
class SaltKeysTest < ActiveSupport::TestCase
|
4
|
+
setup do
|
5
|
+
User.current = User.find_by_login "admin"
|
6
|
+
|
7
|
+
@proxy = OpenStruct.new(:id => 1, :url => 'http://dummy.example.com:9090')
|
8
|
+
|
9
|
+
ProxyAPI::Salt.any_instance.stubs(:key_list).returns(
|
10
|
+
{
|
11
|
+
"saltstack.example.com" => {"state"=>"accepted", "fingerprint"=>"98:c2:63:c1:57:59:bc:bd:f1:ef:5a:38:b2:e9:71:c0"},
|
12
|
+
"saltclient01.example.com" => {"state"=>"unaccepted", "fingerprint"=>"98:c2:63:c1:57:59:bc:bd:f1:ef:5a:38:b2:e9:71:c1"},
|
13
|
+
"saltclient02.example.com" => {"state"=>"unaccepted", "fingerprint"=>"98:c2:63:c1:57:59:bc:bd:f1:ef:5a:38:b2:e9:71:c2"},
|
14
|
+
"saltclient03.example.com "=> {"state"=>"rejected", "fingerprint"=>"98:c2:63:c1:57:59:bc:bd:f1:ef:5a:38:b2:e9:71:c3"}
|
15
|
+
}
|
16
|
+
)
|
17
|
+
end
|
18
|
+
|
19
|
+
test "key has a name" do
|
20
|
+
assert_not_empty ForemanSalt::SmartProxies::SaltKeys.all(@proxy).first.name
|
21
|
+
end
|
22
|
+
|
23
|
+
test "key has a state" do
|
24
|
+
assert_not_empty ForemanSalt::SmartProxies::SaltKeys.all(@proxy).first.state
|
25
|
+
end
|
26
|
+
|
27
|
+
test "key has a fingerprint" do
|
28
|
+
assert_not_empty ForemanSalt::SmartProxies::SaltKeys.all(@proxy).first.fingerprint
|
29
|
+
end
|
30
|
+
|
31
|
+
test "key has a smart proxy id" do
|
32
|
+
assert_equal 1, ForemanSalt::SmartProxies::SaltKeys.all(@proxy).first.smart_proxy_id
|
33
|
+
end
|
34
|
+
|
35
|
+
test "returns all keys" do
|
36
|
+
assert_equal 4, ForemanSalt::SmartProxies::SaltKeys.all(@proxy).count
|
37
|
+
end
|
38
|
+
|
39
|
+
test "finds a key by name" do
|
40
|
+
assert_equal ForemanSalt::SmartProxies::SaltKeys.find(@proxy, 'saltstack.example.com').name, 'saltstack.example.com'
|
41
|
+
end
|
42
|
+
|
43
|
+
test "find keys by state" do
|
44
|
+
assert_equal 2, ForemanSalt::SmartProxies::SaltKeys.find_by_state(@proxy, 'unaccepted').count
|
45
|
+
end
|
46
|
+
end
|
metadata
ADDED
@@ -0,0 +1,122 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: foreman_salt
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Stephen Benjamin
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-08-31 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: deface
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
description: Foreman Plug-in for Salt
|
28
|
+
email:
|
29
|
+
- stephen@redhat.com
|
30
|
+
executables: []
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- app/helpers/foreman_salt/salt_keys_helper.rb
|
35
|
+
- app/helpers/concerns/foreman_salt/smart_proxies_helper_extensions.rb
|
36
|
+
- app/helpers/concerns/foreman_salt/hosts_helper_extensions.rb
|
37
|
+
- app/overrides/salt_modules_selector.rb
|
38
|
+
- app/overrides/foreman/salt_modules/_host_tab.html.erb
|
39
|
+
- app/overrides/foreman/salt_modules/_host_tab_pane.html.erb
|
40
|
+
- app/overrides/salt_proxy_selector.rb
|
41
|
+
- app/views/foreman_salt/salt_modules/index.html.erb
|
42
|
+
- app/views/foreman_salt/salt_modules/new.html.erb
|
43
|
+
- app/views/foreman_salt/salt_modules/_form.html.erb
|
44
|
+
- app/views/foreman_salt/salt_modules/edit.html.erb
|
45
|
+
- app/views/foreman_salt/salt_keys/index.erb
|
46
|
+
- app/views/foreman_salt/salt_autosign/index.html.erb
|
47
|
+
- app/views/foreman_salt/salt_autosign/new.html.erb
|
48
|
+
- app/views/foreman_salt/salt_autosign/_form.html.erb
|
49
|
+
- app/services/foreman_salt/smart_proxies/salt_keys.rb
|
50
|
+
- app/services/foreman_salt/fact_importer.rb
|
51
|
+
- app/models/foreman_salt/salt_module.rb
|
52
|
+
- app/models/foreman_salt/fact_name.rb
|
53
|
+
- app/models/concerns/foreman_salt/hostgroup_extensions.rb
|
54
|
+
- app/models/concerns/foreman_salt/host_managed_extensions.rb
|
55
|
+
- app/models/concerns/foreman_salt/orchestration/salt.rb
|
56
|
+
- app/controllers/foreman_salt/salt_modules_controller.rb
|
57
|
+
- app/controllers/foreman_salt/salt_autosign_controller.rb
|
58
|
+
- app/controllers/foreman_salt/salt_keys_controller.rb
|
59
|
+
- app/controllers/foreman_salt/concerns/hostgroups_controller_extensions.rb
|
60
|
+
- app/controllers/foreman_salt/concerns/smart_proxy_auth_extensions.rb
|
61
|
+
- app/controllers/foreman_salt/concerns/hosts_controller_extensions.rb
|
62
|
+
- app/controllers/foreman_salt/concerns/unattended_controller_extensions.rb
|
63
|
+
- app/lib/proxy_api/salt.rb
|
64
|
+
- config/routes.rb
|
65
|
+
- db/seeds.d/75-salt-seeds.rb
|
66
|
+
- db/migrate/20140817210214_create_salt_modules.rb
|
67
|
+
- db/migrate/20140829210214_add_salt_modules_to_hostgroups.rb
|
68
|
+
- db/migrate/20140813081913_add_salt_proxy_to_host_and_host_group.rb
|
69
|
+
- lib/foreman_salt/engine.rb
|
70
|
+
- lib/foreman_salt/version.rb
|
71
|
+
- lib/tasks/foreman_salt_tasks.rake
|
72
|
+
- lib/foreman_salt.rb
|
73
|
+
- LICENSE
|
74
|
+
- Rakefile
|
75
|
+
- README.md
|
76
|
+
- test/integration/salt_keys_test.rb
|
77
|
+
- test/integration/salt_module_test.rb
|
78
|
+
- test/integration/salt_autosign_test.rb
|
79
|
+
- test/unit/salt_keys_test.rb
|
80
|
+
- test/unit/grains_centos.json
|
81
|
+
- test/unit/host_extensions_test.rb
|
82
|
+
- test/unit/grains_importer_test.rb
|
83
|
+
- test/unit/hostgroup_extensions_test.rb
|
84
|
+
- test/test_plugin_helper.rb
|
85
|
+
- test/factories/foreman_salt_factories.rb
|
86
|
+
- test/functional/hosts_controller_test.rb
|
87
|
+
homepage: http://github.com/theforeman/foreman_salt
|
88
|
+
licenses:
|
89
|
+
- GPL-3
|
90
|
+
metadata: {}
|
91
|
+
post_install_message:
|
92
|
+
rdoc_options: []
|
93
|
+
require_paths:
|
94
|
+
- lib
|
95
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
96
|
+
requirements:
|
97
|
+
- - '>='
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: '0'
|
100
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - '>='
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0'
|
105
|
+
requirements: []
|
106
|
+
rubyforge_project:
|
107
|
+
rubygems_version: 2.1.11
|
108
|
+
signing_key:
|
109
|
+
specification_version: 4
|
110
|
+
summary: Foreman Plug-in for Salt
|
111
|
+
test_files:
|
112
|
+
- test/integration/salt_keys_test.rb
|
113
|
+
- test/integration/salt_module_test.rb
|
114
|
+
- test/integration/salt_autosign_test.rb
|
115
|
+
- test/unit/salt_keys_test.rb
|
116
|
+
- test/unit/grains_centos.json
|
117
|
+
- test/unit/host_extensions_test.rb
|
118
|
+
- test/unit/grains_importer_test.rb
|
119
|
+
- test/unit/hostgroup_extensions_test.rb
|
120
|
+
- test/test_plugin_helper.rb
|
121
|
+
- test/factories/foreman_salt_factories.rb
|
122
|
+
- test/functional/hosts_controller_test.rb
|