hammer_cli_katello 0.11.5.1 → 0.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/hammer_cli_katello.rb +5 -0
- data/lib/hammer_cli_katello/content_view.rb +22 -8
- data/lib/hammer_cli_katello/file.rb +72 -0
- data/lib/hammer_cli_katello/foreman_search_options_creators.rb +34 -34
- data/lib/hammer_cli_katello/host_collection.rb +18 -0
- data/lib/hammer_cli_katello/host_content_source_options.rb +25 -0
- data/lib/hammer_cli_katello/host_extensions.rb +34 -3
- data/lib/hammer_cli_katello/host_kickstart_repository_options.rb +49 -0
- data/lib/hammer_cli_katello/hostgroup_extensions.rb +25 -3
- data/lib/hammer_cli_katello/id_resolver.rb +15 -9
- data/lib/hammer_cli_katello/repository.rb +47 -1
- data/lib/hammer_cli_katello/search_options_creators.rb +23 -16
- data/lib/hammer_cli_katello/sync_plan.rb +5 -0
- data/lib/hammer_cli_katello/version.rb +1 -1
- data/test/functional/capsule/content/add_lifecycle_environment_test.rb +3 -3
- data/test/functional/capsule/content/cancel_synchronization_test.rb +3 -3
- data/test/functional/capsule/content/info_test.rb +3 -3
- data/test/functional/capsule/content/lifecycle_environments_test.rb +1 -1
- data/test/functional/capsule/content/remove_lifecycle_environment_test.rb +3 -3
- data/test/functional/capsule/content/synchronization_status_test.rb +3 -3
- data/test/functional/content_view/content_view_helpers.rb +4 -0
- data/test/functional/content_view/create_test.rb +2 -2
- data/test/functional/content_view/filter/delete_test.rb +1 -4
- data/test/functional/content_view/filter/info_test.rb +1 -4
- data/test/functional/content_view/filter/list_test.rb +1 -1
- data/test/functional/content_view/filter/update_test.rb +1 -4
- data/test/functional/erratum/list_test.rb +1 -1
- data/test/functional/file/file_helpers.rb +13 -0
- data/test/functional/file/info_test.rb +162 -0
- data/test/functional/file/list_test.rb +112 -0
- data/test/functional/filter_rule/info_test.rb +1 -1
- data/test/functional/filter_rule/update_test.rb +1 -1
- data/test/functional/host/extensions/create_test.rb +95 -0
- data/test/functional/host/extensions/data/host.json +4 -0
- data/test/functional/host/extensions/info_test.rb +5 -3
- data/test/functional/host/extensions/update_test.rb +69 -0
- data/test/functional/host_collection/add_host_test.rb +36 -3
- data/test/functional/host_collection/copy_test.rb +4 -4
- data/test/functional/host_collection/delete_test.rb +3 -3
- data/test/functional/host_collection/hosts_test.rb +1 -2
- data/test/functional/host_collection/info_test.rb +3 -3
- data/test/functional/host_collection/remove_host_test.rb +36 -3
- data/test/functional/host_collection/update_test.rb +3 -3
- data/test/functional/hostgroup/create_test.rb +46 -1
- data/test/functional/hostgroup/data/hostgroup.json +48 -46
- data/test/functional/hostgroup/info_test.rb +5 -3
- data/test/functional/hostgroup/update_test.rb +48 -1
- data/test/functional/lifecycle_environment/create_test.rb +1 -1
- data/test/functional/package/list_test.rb +1 -1
- data/test/functional/product/product_helpers.rb +6 -4
- data/test/functional/repository/upload_test.rb +32 -14
- data/test/functional/sync_plan/info_test.rb +37 -0
- data/test/functional/sync_plan/list_test.rb +31 -0
- metadata +21 -18
@@ -26,7 +26,6 @@ module HammerCLIKatello
|
|
26
26
|
|
27
27
|
expect_organization_search('pkd', 1)
|
28
28
|
expect_content_view_search(1, 'darkly', 1)
|
29
|
-
expect_content_view_search(1, 'darkly', 1) # redmine #15930
|
30
29
|
|
31
30
|
ex = api_expects(:content_view_filters, :index, 'Content view filters list') do |par|
|
32
31
|
par['content_view_id'] == 1 && par['name'] == 'scanner'
|
@@ -45,7 +44,6 @@ module HammerCLIKatello
|
|
45
44
|
|
46
45
|
expect_organization_search('pkd', 1, field: 'label')
|
47
46
|
expect_content_view_search(1, 'darkly', 1)
|
48
|
-
expect_content_view_search(1, 'darkly', 1) # redmine #15930
|
49
47
|
|
50
48
|
ex = api_expects(:content_view_filters, :index, 'Content view filters list') do |par|
|
51
49
|
par['content_view_id'] == 1 && par['name'] == 'scanner'
|
@@ -63,7 +61,6 @@ module HammerCLIKatello
|
|
63
61
|
params = ['--name=scanner', '--content-view=darkly', '--organization-id=1']
|
64
62
|
|
65
63
|
expect_content_view_search('1', 'darkly', 1)
|
66
|
-
expect_content_view_search('1', 'darkly', 1) # redmine #15930
|
67
64
|
|
68
65
|
ex = api_expects(:content_view_filters, :index, 'Content view filters list') do |par|
|
69
66
|
par['content_view_id'] == 1 && par['name'] == 'scanner'
|
@@ -82,7 +79,7 @@ module HammerCLIKatello
|
|
82
79
|
expected_result = usage_error_result(
|
83
80
|
@cmd,
|
84
81
|
'At least one of options --organization-id, --organization, --organization-label ' \
|
85
|
-
'is required'
|
82
|
+
'is required.'
|
86
83
|
)
|
87
84
|
api_expects_no_call
|
88
85
|
result = run_cmd(@cmd + params)
|
@@ -89,7 +89,7 @@ FILTER ID | NAME | TYPE | INCLUSION
|
|
89
89
|
params = ["--content-view=#{cv_name}"]
|
90
90
|
expected_result = usage_error_result(
|
91
91
|
@cmd,
|
92
|
-
'At least one of options --organization-id, --organization, --organization-label is required'
|
92
|
+
'At least one of options --organization-id, --organization, --organization-label is required.'
|
93
93
|
)
|
94
94
|
api_expects_no_call
|
95
95
|
result = run_cmd(@cmd + params)
|
@@ -26,7 +26,6 @@ module HammerCLIKatello
|
|
26
26
|
|
27
27
|
expect_organization_search('pkd', 1)
|
28
28
|
expect_content_view_search(1, 'darkly', 1)
|
29
|
-
expect_content_view_search(1, 'darkly', 1) # redmine #15930
|
30
29
|
|
31
30
|
ex = api_expects(:content_view_filters, :index, 'Content view filters list') do |par|
|
32
31
|
par['content_view_id'] == 1 && par['name'] == 'scanner'
|
@@ -46,7 +45,6 @@ module HammerCLIKatello
|
|
46
45
|
|
47
46
|
expect_organization_search('pkd', 1, field: 'label')
|
48
47
|
expect_content_view_search(1, 'darkly', 1)
|
49
|
-
expect_content_view_search(1, 'darkly', 1) # redmine #15930
|
50
48
|
|
51
49
|
ex = api_expects(:content_view_filters, :index, 'Content view filters list') do |par|
|
52
50
|
par['content_view_id'] == 1 && par['name'] == 'scanner'
|
@@ -64,7 +62,6 @@ module HammerCLIKatello
|
|
64
62
|
params = ['--name=scanner', '--content-view=darkly', '--organization-id=1', '--new-name=ubik']
|
65
63
|
|
66
64
|
expect_content_view_search('1', 'darkly', 1)
|
67
|
-
expect_content_view_search('1', 'darkly', 1) # redmine #15930
|
68
65
|
|
69
66
|
ex = api_expects(:content_view_filters, :index, 'Content view filters list') do |par|
|
70
67
|
par['content_view_id'] == 1 && par['name'] == 'scanner'
|
@@ -82,7 +79,7 @@ module HammerCLIKatello
|
|
82
79
|
params = ["--name=high-castle"]
|
83
80
|
expected_result = usage_error_result(
|
84
81
|
@cmd,
|
85
|
-
'At least one of options --content-view-id, --content-view is required',
|
82
|
+
'At least one of options --content-view-id, --content-view is required.',
|
86
83
|
'Could not update the filter'
|
87
84
|
)
|
88
85
|
api_expects_no_call
|
@@ -30,7 +30,7 @@ module HammerCLIKatello
|
|
30
30
|
ex.returns(index_response([{'id' => 2}, {'id' => 3}]))
|
31
31
|
|
32
32
|
r = run_cmd(%w(erratum list --product-id 1))
|
33
|
-
assert r.err.include?
|
33
|
+
assert r.err.include?("Found more than one repository."), r.err
|
34
34
|
end
|
35
35
|
|
36
36
|
it 'requires organization options to resolve ID by name' do
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require_relative '../search_helpers'
|
2
|
+
|
3
|
+
module FileHelpers
|
4
|
+
include SearchHelpers
|
5
|
+
|
6
|
+
def expect_file_search(params, returns)
|
7
|
+
expect_generic_search(:file_units, params: params, returns: returns)
|
8
|
+
end
|
9
|
+
|
10
|
+
def expect_file_show(params)
|
11
|
+
api_expects(:file_units, :show).with_params(params)
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,162 @@
|
|
1
|
+
require_relative '../test_helper.rb'
|
2
|
+
require_relative '../organization/organization_helpers'
|
3
|
+
require_relative '../content_view/content_view_helpers'
|
4
|
+
require_relative '../repository/repository_helpers'
|
5
|
+
require_relative '../product/product_helpers'
|
6
|
+
require_relative 'file_helpers'
|
7
|
+
require 'hammer_cli_katello/file'
|
8
|
+
|
9
|
+
# rubocop:disable ModuleLength
|
10
|
+
module HammerCLIKatello
|
11
|
+
describe FileCommand::InfoCommand do
|
12
|
+
include FileHelpers
|
13
|
+
include ContentViewHelpers
|
14
|
+
include RepositoryHelpers
|
15
|
+
include ProductHelpers
|
16
|
+
include OrganizationHelpers
|
17
|
+
|
18
|
+
it 'allows minimal options' do
|
19
|
+
expect_file_show('id' => '1')
|
20
|
+
run_cmd(%w(file info --id 1))
|
21
|
+
end
|
22
|
+
|
23
|
+
describe 'requires' do
|
24
|
+
describe 'organization options' do
|
25
|
+
it 'to resolve product ID' do
|
26
|
+
api_expects_no_call
|
27
|
+
result = run_cmd(%w(file list --product product1))
|
28
|
+
assert_match(/--organization-id/, result.err)
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'to resolve content view ID' do
|
32
|
+
api_expects_no_call
|
33
|
+
result = run_cmd(%w(file list --content-view cv1))
|
34
|
+
assert_match(/--organization-id/, result.err)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
describe 'product options' do
|
39
|
+
it 'to resolve repository ID' do
|
40
|
+
api_expects_no_call
|
41
|
+
result = run_cmd(%w(file list --repository repo1))
|
42
|
+
assert_match(/--product-id/, result.err)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
describe 'allows filtering by' do
|
48
|
+
it 'repository ID' do
|
49
|
+
expect_file_search({'repository_id' => 2}, {})
|
50
|
+
run_cmd(%w(file list --repository-id 2))
|
51
|
+
end
|
52
|
+
|
53
|
+
it 'content view version ID' do
|
54
|
+
expect_file_search({'content_view_version_id' => 2}, {})
|
55
|
+
run_cmd(%w(file list --content-view-version-id 2))
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
describe 'resolves ID from file name' do
|
60
|
+
it 'and repository ID' do
|
61
|
+
expect_file_search({'repository_id' => '2', search: "name = \"foo\""}, 'id' => 1)
|
62
|
+
expect_file_show('id' => 1)
|
63
|
+
run_cmd(%w(file info --name foo --repository-id 2))
|
64
|
+
end
|
65
|
+
|
66
|
+
describe 'repository name' do
|
67
|
+
it 'and product ID' do
|
68
|
+
expect_generic_repositories_search({'name' => 'repo2', 'product_id' => 1}, 'id' => 2)
|
69
|
+
expect_file_search({'repository_id' => '2', search: "name = \"foo\""}, 'id' => 1)
|
70
|
+
expect_file_show('id' => 1)
|
71
|
+
run_cmd(%w(file info --name foo --repository repo2 --product-id 1))
|
72
|
+
end
|
73
|
+
|
74
|
+
describe 'product name, and organization' do
|
75
|
+
it 'ID' do
|
76
|
+
expect_generic_product_search({'name' => 'product1', 'organization_id' => 3}, 'id' => 1)
|
77
|
+
expect_generic_repositories_search({'name' => 'repo2', 'product_id' => 1}, 'id' => 2)
|
78
|
+
expect_file_search({'repository_id' => '2', search: "name = \"foo\""}, 'id' => 1)
|
79
|
+
expect_file_show('id' => 1)
|
80
|
+
run_cmd(%w(file info --name foo --repository repo2 --product product1
|
81
|
+
--organization-id 3))
|
82
|
+
end
|
83
|
+
|
84
|
+
it 'name' do
|
85
|
+
expect_organization_search('org3', 3)
|
86
|
+
expect_generic_product_search({'name' => 'product1', 'organization_id' => 3}, 'id' => 1)
|
87
|
+
expect_generic_repositories_search({'name' => 'repo2', 'product_id' => 1}, 'id' => 2)
|
88
|
+
expect_file_search({'repository_id' => '2', search: "name = \"foo\""}, 'id' => 1)
|
89
|
+
expect_file_show('id' => 1)
|
90
|
+
run_cmd(%w(file info --name foo --repository repo2 --product product1
|
91
|
+
--organization org3))
|
92
|
+
end
|
93
|
+
|
94
|
+
it 'label' do
|
95
|
+
expect_organization_search('org3', 3, field: 'label')
|
96
|
+
expect_generic_product_search({'name' => 'product1', 'organization_id' => 3}, 'id' => 1)
|
97
|
+
expect_generic_repositories_search({'name' => 'repo2', 'product_id' => 1}, 'id' => 2)
|
98
|
+
expect_file_search({'repository_id' => '2', search: "name = \"foo\""}, 'id' => 1)
|
99
|
+
expect_file_show('id' => 1)
|
100
|
+
run_cmd(%w(file info --name foo --repository repo2 --product product1
|
101
|
+
--organization-label org3))
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
it 'and content view version ID' do
|
107
|
+
expect_file_search({'content_view_version_id' => '2', 'name' => 'foo'}, 'id' => 1)
|
108
|
+
expect_file_show('id' => 1)
|
109
|
+
run_cmd(%w(file info --name foo --content-view-version-id 2))
|
110
|
+
end
|
111
|
+
|
112
|
+
describe 'content view version' do
|
113
|
+
it 'and content view ID' do
|
114
|
+
expect_content_view_version_search({'version' => '2.0',
|
115
|
+
'content_view_id' => 3}, 'id' => 2)
|
116
|
+
expect_file_search({'content_view_version_id' => '2',
|
117
|
+
search: "name = \"foo\""}, 'id' => 1)
|
118
|
+
expect_file_show('id' => 1)
|
119
|
+
run_cmd(%w(file info --name foo --content-view-version 2.0 --content-view-id 3))
|
120
|
+
end
|
121
|
+
|
122
|
+
describe 'content view name, and organization' do
|
123
|
+
it 'ID' do
|
124
|
+
expect_content_view_search(4, 'cv3', 3)
|
125
|
+
expect_content_view_version_search({'version' => '2.0',
|
126
|
+
'content_view_id' => 3}, 'id' => 2)
|
127
|
+
expect_file_search({'content_view_version_id' => '2',
|
128
|
+
search: "name = \"foo\""}, 'id' => 1)
|
129
|
+
expect_file_show('id' => 1)
|
130
|
+
run_cmd(%w(file info --name foo --content-view-version 2.0 --content-view cv3
|
131
|
+
--organization-id 4))
|
132
|
+
end
|
133
|
+
|
134
|
+
it 'name' do
|
135
|
+
expect_organization_search('org4', 4)
|
136
|
+
expect_content_view_search(4, 'cv3', 3)
|
137
|
+
expect_content_view_version_search({'version' => '2.0',
|
138
|
+
'content_view_id' => 3}, 'id' => 2)
|
139
|
+
expect_file_search({'content_view_version_id' => '2',
|
140
|
+
search: "name = \"foo\""}, 'id' => 1)
|
141
|
+
expect_file_show('id' => 1)
|
142
|
+
run_cmd(%w(file info --name foo --content-view-version 2.0 --content-view cv3
|
143
|
+
--organization org4))
|
144
|
+
end
|
145
|
+
|
146
|
+
it 'label' do
|
147
|
+
expect_organization_search('org4', 4, field: 'label')
|
148
|
+
expect_content_view_search(4, 'cv3', 3)
|
149
|
+
expect_content_view_version_search({'version' => '2.0',
|
150
|
+
'content_view_id' => 3}, 'id' => 2)
|
151
|
+
expect_file_search({'content_view_version_id' => '2',
|
152
|
+
search: "name = \"foo\""}, 'id' => 1)
|
153
|
+
expect_file_show('id' => 1)
|
154
|
+
run_cmd(%w(file info --name foo --content-view-version 2.0 --content-view cv3
|
155
|
+
--organization-label org4))
|
156
|
+
end
|
157
|
+
end
|
158
|
+
end
|
159
|
+
end
|
160
|
+
end
|
161
|
+
end
|
162
|
+
# rubocop:enable ModuleLength
|
@@ -0,0 +1,112 @@
|
|
1
|
+
require_relative '../test_helper.rb'
|
2
|
+
require_relative '../organization/organization_helpers'
|
3
|
+
require_relative '../content_view/content_view_helpers'
|
4
|
+
require_relative '../repository/repository_helpers'
|
5
|
+
require_relative '../product/product_helpers'
|
6
|
+
require_relative 'file_helpers'
|
7
|
+
require 'hammer_cli_katello/file'
|
8
|
+
|
9
|
+
module HammerCLIKatello
|
10
|
+
describe FileCommand::ListCommand do
|
11
|
+
include FileHelpers
|
12
|
+
include ContentViewHelpers
|
13
|
+
include RepositoryHelpers
|
14
|
+
include ProductHelpers
|
15
|
+
include OrganizationHelpers
|
16
|
+
|
17
|
+
it 'allows minimal options' do
|
18
|
+
expect_file_search({}, {})
|
19
|
+
run_cmd(%w(file list))
|
20
|
+
end
|
21
|
+
|
22
|
+
describe 'requires' do
|
23
|
+
describe 'organization options' do
|
24
|
+
it 'to resolve product ID' do
|
25
|
+
api_expects_no_call
|
26
|
+
result = run_cmd(%w(file list --product product1))
|
27
|
+
assert_match(/--organization-id/, result.err)
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'to resolve content view ID' do
|
31
|
+
api_expects_no_call
|
32
|
+
result = run_cmd(%w(file list --content-view cv1))
|
33
|
+
assert_match(/--organization-id/, result.err)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
describe 'product options' do
|
38
|
+
it 'to resolve repository ID' do
|
39
|
+
api_expects_no_call
|
40
|
+
result = run_cmd(%w(file list --repository repo1))
|
41
|
+
assert_match(/--product-id/, result.err)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
describe 'allows filtering by' do
|
47
|
+
it 'repository ID' do
|
48
|
+
expect_file_search({'repository_id' => 2}, {})
|
49
|
+
run_cmd(%w(file list --repository-id 2))
|
50
|
+
end
|
51
|
+
|
52
|
+
it 'content view version ID' do
|
53
|
+
expect_file_search({'content_view_version_id' => 2}, {})
|
54
|
+
run_cmd(%w(file list --content-view-version-id 2))
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
describe 'resolves' do
|
59
|
+
describe 'repository ID' do
|
60
|
+
it 'from name and product ID' do
|
61
|
+
expect_generic_repositories_search(
|
62
|
+
{'name' => 'repo2', 'product_id' => 1}, 'id' => 2)
|
63
|
+
expect_file_search({'repository_id' => 2}, {})
|
64
|
+
run_cmd(%w(file list --repository repo2 --product-id 1))
|
65
|
+
end
|
66
|
+
|
67
|
+
it 'from name, product, and organization ID' do
|
68
|
+
expect_generic_product_search({'name' => 'product1', 'organization_id' => 3}, 'id' => 1)
|
69
|
+
expect_generic_repositories_search({'name' => 'repo2', 'product_id' => 1}, 'id' => 2)
|
70
|
+
expect_file_search({'repository_id' => 2}, {})
|
71
|
+
run_cmd(%w(file list --repository repo2 --product product1 --organization-id 3))
|
72
|
+
end
|
73
|
+
|
74
|
+
it 'from name, product, and organization name' do
|
75
|
+
expect_organization_search('org3', 3)
|
76
|
+
expect_generic_product_search({'name' => 'product1', 'organization_id' => 3}, 'id' => 1)
|
77
|
+
expect_generic_repositories_search({'name' => 'repo2', 'product_id' => 1}, 'id' => 2)
|
78
|
+
expect_file_search({'repository_id' => 2}, {})
|
79
|
+
run_cmd(%w(file list --repository repo2 --product product1 --organization org3))
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
describe 'content view version ID' do
|
84
|
+
it 'from version and content view ID' do
|
85
|
+
expect_content_view_version_search(
|
86
|
+
{'version' => '1.0', 'content_view_id' => 1}, 'id' => 2)
|
87
|
+
expect_file_search({'content_view_version_id' => 2}, {})
|
88
|
+
run_cmd(%w(file list --content-view-version 1.0 --content-view-id 1))
|
89
|
+
end
|
90
|
+
|
91
|
+
it 'from version, content view name, and organization ID' do
|
92
|
+
expect_generic_content_view_search(params: {'name' => 'cv1', 'organization_id' => 3},
|
93
|
+
returns: {'id' => 1})
|
94
|
+
expect_content_view_version_search(
|
95
|
+
{'version' => '1.0', 'content_view_id' => 1}, 'id' => 2)
|
96
|
+
expect_file_search({'content_view_version_id' => 2}, {})
|
97
|
+
run_cmd(%w(file list --content-view-version 1.0 --content-view cv1 --organization-id 3))
|
98
|
+
end
|
99
|
+
|
100
|
+
it 'from version, content view name, and organization name' do
|
101
|
+
expect_organization_search('org3', 3)
|
102
|
+
expect_generic_content_view_search(params: {'name' => 'cv1', 'organization_id' => 3},
|
103
|
+
returns: {'id' => 1})
|
104
|
+
expect_content_view_version_search(
|
105
|
+
{'version' => '1.0', 'content_view_id' => 1}, 'id' => 2)
|
106
|
+
expect_file_search({'content_view_version_id' => 2}, {})
|
107
|
+
run_cmd(%w(file list --content-view-version 1.0 --content-view cv1 --organization org3))
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
@@ -0,0 +1,95 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), '../../test_helper')
|
2
|
+
require 'hammer_cli_foreman/host'
|
3
|
+
|
4
|
+
module HammerCLIForeman
|
5
|
+
describe Host do
|
6
|
+
# These tests are only for the extensions Katello adds to the host command
|
7
|
+
# See hammer-cli-foreman for the core host tests
|
8
|
+
describe CreateCommand do
|
9
|
+
let(:env_name) { "world" }
|
10
|
+
let(:env_id) { 100 }
|
11
|
+
let(:cv_id) { 220 }
|
12
|
+
let(:repo_name) { "life_of_kickstart" }
|
13
|
+
let(:repo_id) { 12 }
|
14
|
+
let(:content_source_name) { "life_of_cs" }
|
15
|
+
let(:content_source_id) { 82 }
|
16
|
+
let(:host_name) { "mercury" }
|
17
|
+
let(:domain_id) { 134 }
|
18
|
+
let(:operatingsystem_id) { 103 }
|
19
|
+
let(:architecture_id) { 28 }
|
20
|
+
let(:partition_table_id) { 243 }
|
21
|
+
let(:location_id) { 213 }
|
22
|
+
let(:organization_id) { 324 }
|
23
|
+
|
24
|
+
it 'allows kickstart repository name' do
|
25
|
+
api_expects(:lifecycle_environments, :index).
|
26
|
+
with_params('name' => env_name,
|
27
|
+
'organization_id' => organization_id).
|
28
|
+
returns(index_response([{'id' => env_id}]))
|
29
|
+
|
30
|
+
api_expects(:repositories, :index).
|
31
|
+
with_params('name' => repo_name,
|
32
|
+
'environment_id' => env_id,
|
33
|
+
'content_view_id' => cv_id).
|
34
|
+
returns(index_response([{'id' => repo_id}]))
|
35
|
+
|
36
|
+
api_expects(:hosts, :create).
|
37
|
+
with_params('host' => {
|
38
|
+
'name' => host_name,
|
39
|
+
'location_id' => location_id,
|
40
|
+
'organization_id' => organization_id,
|
41
|
+
'operatingsystem_id' => operatingsystem_id,
|
42
|
+
'architecture_id' => architecture_id,
|
43
|
+
'ptable_id' => partition_table_id,
|
44
|
+
'domain_id' => domain_id,
|
45
|
+
'content_facet_attributes' => {
|
46
|
+
'lifecycle_environment_id' => env_id,
|
47
|
+
'content_view_id' => cv_id,
|
48
|
+
'kickstart_repository_id' => repo_id
|
49
|
+
}
|
50
|
+
})
|
51
|
+
|
52
|
+
cmd = "host create --name=#{host_name} --content-view-id=#{cv_id}"\
|
53
|
+
" --lifecycle-environment=#{env_name}"\
|
54
|
+
" --kickstart-repository=#{repo_name}"\
|
55
|
+
" --operatingsystem-id=#{operatingsystem_id}"\
|
56
|
+
" --architecture-id=#{architecture_id}"\
|
57
|
+
" --organization-id=#{organization_id}"\
|
58
|
+
" --partition-table-id=#{partition_table_id}"\
|
59
|
+
" --location-id=#{location_id}"\
|
60
|
+
" --domain-id=#{domain_id}"
|
61
|
+
run_cmd(cmd.split)
|
62
|
+
end
|
63
|
+
|
64
|
+
it 'allows content source name' do
|
65
|
+
api_expects(:smart_proxies, :index).
|
66
|
+
with_params(:search => "name = \"#{content_source_name}\"").
|
67
|
+
returns(index_response([{'id' => content_source_id}]))
|
68
|
+
|
69
|
+
api_expects(:hosts, :create).
|
70
|
+
with_params('host' => {
|
71
|
+
'name' => host_name,
|
72
|
+
'location_id' => location_id,
|
73
|
+
'organization_id' => organization_id,
|
74
|
+
'operatingsystem_id' => operatingsystem_id,
|
75
|
+
'architecture_id' => architecture_id,
|
76
|
+
'ptable_id' => partition_table_id,
|
77
|
+
'domain_id' => domain_id,
|
78
|
+
'content_facet_attributes' => {
|
79
|
+
'content_source_id' => content_source_id
|
80
|
+
}
|
81
|
+
})
|
82
|
+
|
83
|
+
cmd = "host create --name=#{host_name}"\
|
84
|
+
" --content-source=#{content_source_name}"\
|
85
|
+
" --operatingsystem-id=#{operatingsystem_id}"\
|
86
|
+
" --architecture-id=#{architecture_id}"\
|
87
|
+
" --organization-id=#{organization_id}"\
|
88
|
+
" --partition-table-id=#{partition_table_id}"\
|
89
|
+
" --location-id=#{location_id}"\
|
90
|
+
" --domain-id=#{domain_id}"
|
91
|
+
run_cmd(cmd.split)
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|