hammer_cli_katello 0.0.26 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (118) hide show
  1. checksums.yaml +4 -4
  2. data/lib/hammer_cli_katello/activation_key.rb +23 -43
  3. data/lib/hammer_cli_katello/associating_commands.rb +3 -5
  4. data/lib/hammer_cli_katello/capsule.rb +1 -3
  5. data/lib/hammer_cli_katello/commands.rb +1 -7
  6. data/lib/hammer_cli_katello/content_view.rb +6 -3
  7. data/lib/hammer_cli_katello/content_view_name_resolvable.rb +21 -0
  8. data/lib/hammer_cli_katello/content_view_puppet_module.rb +11 -7
  9. data/lib/hammer_cli_katello/content_view_version.rb +30 -29
  10. data/lib/hammer_cli_katello/erratum.rb +0 -1
  11. data/lib/hammer_cli_katello/exception_handler.rb +0 -2
  12. data/lib/hammer_cli_katello/filter.rb +11 -3
  13. data/lib/hammer_cli_katello/filter_rule.rb +8 -2
  14. data/lib/hammer_cli_katello/foreman_search_options_creators.rb +71 -0
  15. data/lib/hammer_cli_katello/gpg_key.rb +0 -5
  16. data/lib/hammer_cli_katello/host.rb +1 -0
  17. data/lib/hammer_cli_katello/host_collection.rb +48 -16
  18. data/lib/hammer_cli_katello/host_errata.rb +0 -1
  19. data/lib/hammer_cli_katello/host_extensions.rb +56 -0
  20. data/lib/hammer_cli_katello/host_package.rb +0 -3
  21. data/lib/hammer_cli_katello/host_package_group.rb +0 -3
  22. data/lib/hammer_cli_katello/host_subscription.rb +67 -1
  23. data/lib/hammer_cli_katello/hostgroup.rb +2 -0
  24. data/lib/hammer_cli_katello/hostgroup_extensions.rb +48 -0
  25. data/lib/hammer_cli_katello/i18n.rb +0 -3
  26. data/lib/hammer_cli_katello/id_resolver.rb +25 -16
  27. data/lib/hammer_cli_katello/katello_environment_name_resolvable.rb +4 -3
  28. data/lib/hammer_cli_katello/lifecycle_environment.rb +0 -3
  29. data/lib/hammer_cli_katello/lifecycle_environment_name_resolvable.rb +4 -3
  30. data/lib/hammer_cli_katello/organization.rb +0 -3
  31. data/lib/hammer_cli_katello/organization_options.rb +12 -0
  32. data/lib/hammer_cli_katello/ostree_branch.rb +0 -1
  33. data/lib/hammer_cli_katello/output/fields.rb +0 -2
  34. data/lib/hammer_cli_katello/output/formatters.rb +0 -4
  35. data/lib/hammer_cli_katello/package.rb +0 -1
  36. data/lib/hammer_cli_katello/package_group.rb +0 -1
  37. data/lib/hammer_cli_katello/ping.rb +0 -6
  38. data/lib/hammer_cli_katello/product.rb +1 -7
  39. data/lib/hammer_cli_katello/puppet_module.rb +0 -1
  40. data/lib/hammer_cli_katello/repository.rb +36 -35
  41. data/lib/hammer_cli_katello/repository_scoped_to_product.rb +0 -4
  42. data/lib/hammer_cli_katello/repository_set.rb +0 -3
  43. data/lib/hammer_cli_katello/search_options_creators.rb +40 -18
  44. data/lib/hammer_cli_katello/subscription.rb +20 -13
  45. data/lib/hammer_cli_katello/sync_plan.rb +4 -8
  46. data/lib/hammer_cli_katello/version.rb +1 -1
  47. data/lib/hammer_cli_katello.rb +21 -26
  48. data/test/data/3.0/foreman_api.json +1 -1
  49. data/test/data/3.2/foreman_api.json +1 -0
  50. data/test/data/Readme.md +5 -0
  51. data/test/functional/activaton_key/add_host_collection_test.rb +62 -0
  52. data/test/functional/activaton_key/create_test.rb +33 -0
  53. data/test/functional/activaton_key/list_test.rb +15 -16
  54. data/test/functional/activaton_key/product_content_test.rb +23 -0
  55. data/test/functional/activaton_key/remove_host_collection_test.rb +62 -0
  56. data/test/functional/activaton_key/subscriptions_test.rb +57 -0
  57. data/test/functional/activaton_key/update_test.rb +26 -0
  58. data/test/functional/capsule/content/cancel_synchronization_test.rb +1 -1
  59. data/test/functional/capsule/content/capsule_content_helpers.rb +0 -2
  60. data/test/functional/content_view/add_content_view_version_test.rb +34 -0
  61. data/test/functional/content_view/add_repository_test.rb +20 -0
  62. data/test/functional/content_view/content_view_helpers.rb +0 -2
  63. data/test/functional/content_view/create_test.rb +3 -3
  64. data/test/functional/content_view/filter/create_test.rb +63 -0
  65. data/test/functional/content_view/list_test.rb +23 -20
  66. data/test/functional/content_view/publish_test.rb +23 -0
  67. data/test/functional/content_view/puppet_module/add_test.rb +23 -0
  68. data/test/functional/content_view/remove_content_view_version_test.rb +34 -0
  69. data/test/functional/content_view/version/incremental_update_test.rb +4 -4
  70. data/test/functional/content_view/version/list_test.rb +44 -0
  71. data/test/functional/content_view/version/promote_test.rb +35 -0
  72. data/test/functional/filter_rule/create_test.rb +20 -0
  73. data/test/functional/host/errata/apply_test.rb +5 -4
  74. data/test/functional/host/extensions/data/host.json +310 -0
  75. data/test/functional/host/extensions/data/host_list.json +115 -0
  76. data/test/functional/host/extensions/info_test.rb +27 -0
  77. data/test/functional/host/extensions/list_test.rb +21 -0
  78. data/test/functional/host/host_helpers.rb +0 -2
  79. data/test/functional/host/subscription/attach_test.rb +54 -0
  80. data/test/functional/host/subscription/auto_attach_test.rb +35 -0
  81. data/test/functional/host/subscription/register_test.rb +2 -2
  82. data/test/functional/host/subscription/remove_test.rb +52 -0
  83. data/test/functional/host_collection/add_host_test.rb +57 -0
  84. data/test/functional/host_collection/copy_test.rb +64 -0
  85. data/test/functional/host_collection/create_test.rb +43 -0
  86. data/test/functional/host_collection/delete_test.rb +57 -0
  87. data/test/functional/host_collection/hosts_test.rb +40 -0
  88. data/test/functional/host_collection/info_test.rb +57 -0
  89. data/test/functional/host_collection/list_test.rb +42 -0
  90. data/test/functional/host_collection/remove_host_test.rb +57 -0
  91. data/test/functional/host_collection/update_test.rb +57 -0
  92. data/test/functional/hostgroup/create_test.rb +55 -0
  93. data/test/functional/hostgroup/data/hostgroup.json +48 -0
  94. data/test/functional/hostgroup/info_test.rb +30 -0
  95. data/test/functional/hostgroup/update_test.rb +55 -0
  96. data/test/functional/lifecycle_environment/lifecycle_environment_helpers.rb +0 -2
  97. data/test/functional/organization/organization_helpers.rb +0 -2
  98. data/test/functional/product/create_test.rb +54 -0
  99. data/test/functional/product/delete_test.rb +41 -0
  100. data/test/functional/product/info_test.rb +33 -0
  101. data/test/functional/product/list_test.rb +58 -0
  102. data/test/functional/product/product_helpers.rb +14 -0
  103. data/test/functional/product/remove_sync_plan_test.rb +35 -0
  104. data/test/functional/product/set_sync_plan_test.rb +49 -0
  105. data/test/functional/product/update_test.rb +46 -0
  106. data/test/functional/repository/info_test.rb +3 -3
  107. data/test/functional/repository/list_test.rb +14 -13
  108. data/test/functional/repository/remove_content_test.rb +18 -0
  109. data/test/functional/repository/repository_helpers.rb +9 -3
  110. data/test/functional/repository/synchronize_test.rb +3 -3
  111. data/test/functional/repository/upload_test.rb +17 -5
  112. data/test/functional/subscription/list_test.rb +92 -0
  113. data/test/functional/sync_plan/sync_plan_helpers.rb +8 -0
  114. data/test/test_helper.rb +3 -3
  115. data/test/unit/id_resolver_test.rb +17 -2
  116. data/test/unit/search_options_creators_test.rb +49 -12
  117. metadata +105 -7
  118. data/lib/hammer_cli_katello/content_host.rb +0 -111
@@ -27,7 +27,7 @@ describe 'content-view version incremental-update' do
27
27
  expect_foreman_task('3')
28
28
 
29
29
  result = run_cmd(@cmd + params)
30
- assert(result.exit_code, 0)
30
+ assert_equal(result.exit_code, 0)
31
31
  end
32
32
 
33
33
  it "performs incremental update with update all hosts" do
@@ -45,7 +45,7 @@ describe 'content-view version incremental-update' do
45
45
  expect_foreman_task('3')
46
46
 
47
47
  result = run_cmd(@cmd + params)
48
- assert(result.exit_code, 0)
48
+ assert_equal(result.exit_code, 0)
49
49
  end
50
50
 
51
51
  it "performs incremental update with no environment" do
@@ -62,7 +62,7 @@ describe 'content-view version incremental-update' do
62
62
  expect_foreman_task('3')
63
63
 
64
64
  result = run_cmd(@cmd + params)
65
- assert(result.exit_code, 0)
65
+ assert_equal(result.exit_code, 0)
66
66
  end
67
67
 
68
68
  it "performs incremental update with names" do
@@ -86,6 +86,6 @@ describe 'content-view version incremental-update' do
86
86
  expect_foreman_task('3')
87
87
 
88
88
  result = run_cmd(@cmd + params)
89
- assert(result.exit_code, 0)
89
+ assert_equal(result.exit_code, 0)
90
90
  end
91
91
  end
@@ -0,0 +1,44 @@
1
+ require_relative '../../test_helper'
2
+ require 'hammer_cli_katello/content_view_version'
3
+
4
+ module HammerCLIKatello
5
+ describe ContentViewVersion::ListCommand do
6
+ it 'allows minimal options' do
7
+ api_expects(:content_view_versions, :index)
8
+
9
+ run_cmd(%w(content-view version list))
10
+ end
11
+
12
+ describe 'allows organization' do
13
+ it 'id' do
14
+ api_expects(:content_view_versions, :index) do |p|
15
+ p['organization_id'] == 1
16
+ end
17
+
18
+ run_cmd(%w(content-view version list --organization-id 1))
19
+ end
20
+
21
+ it 'name' do
22
+ api_expects(:organizations, :index) { |par| par[:search] == "name = \"org1\"" }
23
+ .at_least_once.returns(index_response([{'id' => 1}]))
24
+
25
+ api_expects(:content_view_versions, :index) do |p|
26
+ p['organization_id'] == 1
27
+ end
28
+
29
+ run_cmd(%w(content-view version list --organization org1))
30
+ end
31
+
32
+ it 'label' do
33
+ api_expects(:organizations, :index) { |par| par[:search] == "label = \"org1\"" }
34
+ .at_least_once.returns(index_response([{'id' => 1}]))
35
+
36
+ api_expects(:content_view_versions, :index) do |p|
37
+ p['organization_id'] == 1
38
+ end
39
+
40
+ run_cmd(%w(content-view version list --organization-label org1))
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,35 @@
1
+ require_relative '../../test_helper'
2
+ require 'hammer_cli_katello/content_view_puppet_module'
3
+
4
+ module HammerCLIKatello
5
+ describe ContentViewPuppetModule do
6
+ it 'allows promoting a content view' do
7
+ ex = api_expects(:organizations, :index) do |p|
8
+ p[:search] == "name = \"org1\""
9
+ end
10
+ ex.at_least_once.returns(index_response([{'id' => 1}]))
11
+
12
+ ex = api_expects(:content_views, :index) do |p|
13
+ p['name'] == 'cv' && p['organization_id'] == 1
14
+ end
15
+ ex.returns(index_response([{'id' => 3}]))
16
+
17
+ ex = api_expects(:content_view_versions, :index) do |p|
18
+ p['version'] == '1' && p['content_view_id'] == 3
19
+ end
20
+ ex.returns(index_response([{'id' => 6}]))
21
+
22
+ ex = api_expects(:lifecycle_environments, :index) do |p|
23
+ p['organization_id'] == 1 && p['name'] == 'test'
24
+ end
25
+ ex.returns(index_response([{'id' => 9}]))
26
+
27
+ api_expects(:content_view_versions, :promote) do |p|
28
+ p['id'] == 6 && p['environment_id'] == 9
29
+ end
30
+
31
+ run_cmd(%w(content-view version promote --organization org1 --content-view cv
32
+ --to-lifecycle-environment test --version 1 --async))
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,20 @@
1
+ require_relative '../test_helper'
2
+ require 'hammer_cli_katello/filter_rule'
3
+
4
+ module HammerCLIKatello
5
+ describe FilterRule::CreateCommand do
6
+ it 'allows minimal options' do
7
+ api_expects(:content_view_filter_rules, :create) do |p|
8
+ p['content_view_filter_id'] == 1 && p['name'] == %w(rpm1)
9
+ end
10
+ run_cmd(%w(content-view filter rule create --content-view-filter-id 1 --name rpm1))
11
+ end
12
+
13
+ it 'allows multiple package names' do
14
+ api_expects(:content_view_filter_rules, :create) do |p|
15
+ p['content_view_filter_id'] == 1 && p['name'] == %w(rpm1 rpm2)
16
+ end
17
+ run_cmd(%w(content-view filter rule create --content-view-filter-id 1 --names rpm1,rpm2))
18
+ end
19
+ end
20
+ end
@@ -12,10 +12,11 @@ describe 'apply an errata' do
12
12
  let(:errata_id) { "RHEA-1111:1111" }
13
13
  let(:host_id) { 1 }
14
14
  let(:task_id) { 5 }
15
- let(:response) do {
16
- 'id' => task_id,
17
- 'state' => 'stopped'
18
- }
15
+ let(:response) do
16
+ {
17
+ 'id' => task_id,
18
+ 'state' => 'stopped'
19
+ }
19
20
  end
20
21
 
21
22
  it "applies an errata to a host" do
@@ -0,0 +1,310 @@
1
+ {
2
+ "ip":"192.168.121.86",
3
+ "environment_id":null,
4
+ "environment_name":null,
5
+ "last_report":null,
6
+ "mac":"52:54:00:bc:d3:71",
7
+ "realm_id":null,
8
+ "realm_name":null,
9
+ "sp_mac":null,
10
+ "sp_ip":null,
11
+ "sp_name":null,
12
+ "domain_id":null,
13
+ "domain_name":null,
14
+ "architecture_id":1,
15
+ "architecture_name":"x86_64",
16
+ "operatingsystem_id":null,
17
+ "operatingsystem_name":null,
18
+ "subnet_id":null,
19
+ "subnet_name":null,
20
+ "sp_subnet_id":null,
21
+ "ptable_id":null,
22
+ "ptable_name":null,
23
+ "medium_id":null,
24
+ "medium_name":null,
25
+ "build":false,
26
+ "comment":null,
27
+ "disk":null,
28
+ "installed_at":null,
29
+ "model_id":1,
30
+ "hostgroup_id":null,
31
+ "owner_id":3,
32
+ "owner_type":"User",
33
+ "enabled":true,
34
+ "puppet_ca_proxy_id":null,
35
+ "managed":false,
36
+ "use_image":null,
37
+ "image_file":"",
38
+ "uuid":null,
39
+ "compute_resource_id":null,
40
+ "compute_resource_name":null,
41
+ "compute_profile_id":null,
42
+ "compute_profile_name":null,
43
+ "capabilities":[
44
+ "build"
45
+ ],
46
+ "provision_method":"build",
47
+ "puppet_proxy_id":null,
48
+ "certname":"robot.example.com",
49
+ "image_id":null,
50
+ "image_name":null,
51
+ "created_at":"2016-05-25 09:39:20 -0400",
52
+ "updated_at":"2016-05-26 10:46:26 -0400",
53
+ "last_compile":"2016-05-26 10:46:19 -0400",
54
+ "global_status":1,
55
+ "global_status_label":"Warning",
56
+ "organization_id":1,
57
+ "organization_name":"Default Organization",
58
+ "location_id":2,
59
+ "location_name":"Default Location",
60
+ "puppet_status":0,
61
+ "model_name":"Standard PC (i440FX + PIIX, 1996)",
62
+ "errata_status":1,
63
+ "errata_status_label":"Could not calculate errata status, ensure host is registered and katello-agent is installed",
64
+ "subscription_status":0,
65
+ "subscription_status_label":"Fully entitled",
66
+ "name":"robot.example.com",
67
+ "id":1,
68
+ "hostgroup_name":null,
69
+ "hostgroup_title":null,
70
+ "content_facet_attributes":{
71
+ "id":1,
72
+ "uuid":"179834bf-779a-457f-a1fa-b06ae0acb21a",
73
+ "content_view_id":1,
74
+ "content_view_name":"Default Organization View",
75
+ "lifecycle_environment_id":1,
76
+ "lifecycle_environment_name":"Library",
77
+ "content_view":{
78
+ "id":1,
79
+ "name":"Default Organization View"
80
+ },
81
+ "lifecycle_environment":{
82
+ "id":1,
83
+ "name":"Library"
84
+ },
85
+ "errata_counts":{
86
+ "security":0,
87
+ "bugfix":0,
88
+ "enhancement":0,
89
+ "total":0
90
+ },
91
+ "content_view_version":"1.0",
92
+ "content_view_version_id":1,
93
+ "content_view_default?":true,
94
+ "lifecycle_environment_library?":true,
95
+ "katello_agent_installed":true
96
+ },
97
+ "subscription_facet_attributes":{
98
+ "id":2,
99
+ "uuid":"179834bf-779a-457f-a1fa-b06ae0acb21a",
100
+ "last_checkin":"2016-05-26 10:46:18 -0400",
101
+ "service_level":"high",
102
+ "release_version":"7Server",
103
+ "autoheal":true,
104
+ "registered_at":"2016-05-26 10:46:22 -0400",
105
+ "activation_keys":[
106
+
107
+ ],
108
+ "compliance_reasons":[
109
+
110
+ ],
111
+ "virtual_host":null,
112
+ "virtual_guests":[
113
+
114
+ ],
115
+ "installed_products":[
116
+
117
+ ]
118
+ },
119
+ "content_host_id":2,
120
+ "parameters":[
121
+
122
+ ],
123
+ "interfaces":[
124
+ {
125
+ "id":2,
126
+ "name":null,
127
+ "ip":"172.17.42.1",
128
+ "mac":"02:42:d1:70:84:d0",
129
+ "identifier":"docker0",
130
+ "primary":false,
131
+ "provision":false,
132
+ "type":"interface"
133
+ },
134
+ {
135
+ "id":1,
136
+ "name":"robot.example.com",
137
+ "ip":"192.168.121.86",
138
+ "mac":"52:54:00:bc:d3:71",
139
+ "identifier":"eth0",
140
+ "primary":true,
141
+ "provision":true,
142
+ "type":"interface"
143
+ }
144
+ ],
145
+ "puppetclasses":[
146
+
147
+ ],
148
+ "config_groups":[
149
+
150
+ ],
151
+ "all_parameters":[
152
+
153
+ ],
154
+ "all_puppetclasses":[
155
+
156
+ ],
157
+ "facts":{
158
+ "dmi::system::uuid":"63C9E5F3-0CC7-47B2-BD76-FE3B2E947F7A",
159
+ "lscpu::l1d_cache":"32K",
160
+ "distribution::name":"CentOS Linux",
161
+ "dmi::memory::manufacturer":"QEMU",
162
+ "net::interface::eth0::mac_address":"52:54:00:BC:D3:71",
163
+ "dmi::bios::address":"0xe8000",
164
+ "distribution::id":"Core",
165
+ "dmi::processor::family":"Other",
166
+ "dmi::memory::assettag":"Not Specified",
167
+ "dmi::chassis::manufacturer":"QEMU",
168
+ "dmi::memory::bank_locator":"Not Specified",
169
+ "lscpu::numa_node(s)":"1",
170
+ "virt::host_type":"kvm",
171
+ "lscpu::l1i_cache":"32K",
172
+ "lscpu::vendor_id":"GenuineIntel",
173
+ "virt::is_guest":"true",
174
+ "dmi::chassis::security_status":"Unknown",
175
+ "uname::sysname":"Linux",
176
+ "dmi::processor::type":"Central Processor",
177
+ "lscpu::hypervisor_vendor":"KVM",
178
+ "lscpu::cpu_op-mode(s)":"32-bit, 64-bit",
179
+ "net::interface::eth0::ipv4_netmask":"24",
180
+ "net::interface::eth0::ipv4_address":"192.168.121.86",
181
+ "dmi::system::family":"Not Specified",
182
+ "cpu::core(s)_per_socket":"1",
183
+ "distribution::version":"7",
184
+ "network::ipv4_address":"127.0.0.1",
185
+ "dmi::bios::vendor":"SeaBIOS",
186
+ "net::interface::eth0::ipv6_address::link":"fe80::5054:ff:febc:d371",
187
+ "dmi::bios::bios_revision":"0.0",
188
+ "dmi::system::version":"pc-i440fx-2.4",
189
+ "net::interface::eth0::ipv6_netmask::link":"64",
190
+ "lscpu::stepping":"3",
191
+ "dmi::chassis::type":"Other",
192
+ "dmi::chassis::serial_number":"Not Specified",
193
+ "dmi::chassis::power_supply_state":"Safe",
194
+ "net::interface::lo::ipv6_netmask::host":"128",
195
+ "lscpu::bogomips":"5387.52",
196
+ "dmi::chassis::lock":"Not Present",
197
+ "network::ipv6_address":"fe80::5054:ff:febc:d371",
198
+ "net::interface::lo::ipv4_address":"127.0.0.1",
199
+ "lscpu::thread(s)_per_core":"1",
200
+ "dmi::system::serial_number":"Not Specified",
201
+ "dmi::chassis::boot-up_state":"Safe",
202
+ "dmi::processor::status":"Populated:Enabled",
203
+ "net::interface::lo::ipv4_broadcast":"Unknown",
204
+ "lscpu::on-line_cpu(s)_list":"0-2",
205
+ "dmi::memory::locator":"DIMM 0",
206
+ "dmi::chassis::asset_tag":"Not Specified",
207
+ "dmi::system::status":"No errors detected",
208
+ "dmi::chassis::version":"pc-i440fx-2.4",
209
+ "dmi::processor::part_number":"Not Specified",
210
+ "dmi::memory::location":"Other",
211
+ "net::interface::lo::ipv4_netmask":"8",
212
+ "cpu::cpu(s)":"3",
213
+ "network::hostname":"robot.example.com",
214
+ "dmi::system::manufacturer":"QEMU",
215
+ "net::interface::lo::ipv6_address::host":"::1",
216
+ "uname::version":"#1 SMP Tue Feb 16 17:03:50 UTC 2016",
217
+ "dmi::memory::use":"System Memory",
218
+ "lscpu::cpu(s)":"3",
219
+ "dmi::processor::upgrade":"Other",
220
+ "lscpu::byte_order":"Little Endian",
221
+ "memory::memtotal":"5356760",
222
+ "dmi::bios::version":"1.8.2-20150714_191134-",
223
+ "lscpu::model_name":"QEMU Virtual CPU version 2.4.1",
224
+ "dmi::bios::runtime_size":"96 KB",
225
+ "lscpu::cpu_family":"6",
226
+ "lscpu::virtualization_type":"full",
227
+ "system::certificate_version":"3.2",
228
+ "dmi::memory::part_number":"Not Specified",
229
+ "dmi::chassis::thermal_state":"Safe",
230
+ "lscpu::numa_node0_cpu(s)":"0-2",
231
+ "lscpu::architecture":"x86_64",
232
+ "lscpu::model":"6",
233
+ "dmi::memory::maximum_capacity":"5560 MB",
234
+ "dmi::memory::error_correction_type":"Multi-bit ECC",
235
+ "lscpu::core(s)_per_socket":"1",
236
+ "net::interface::docker0::ipv4_netmask":"16",
237
+ "virt::uuid":"63C9E5F3-0CC7-47B2-BD76-FE3B2E947F7A",
238
+ "lscpu::cpu_mhz":"2693.762",
239
+ "dmi::system::product_name":"Standard PC (i440FX + PIIX, 1996)",
240
+ "dmi::processor::version":"pc-i440fx-2.4",
241
+ "dmi::memory::form_factor":"DIMM",
242
+ "memory::swaptotal":"1048572",
243
+ "net::interface::eth0::ipv4_broadcast":"192.168.121.255",
244
+ "net::interface::docker0::ipv4_address":"172.17.42.1",
245
+ "uname::release":"3.10.0-327.10.1.el7.x86_64",
246
+ "cpu::topology_source":"kernel /sys cpu sibling lists",
247
+ "dmi::bios::rom_size":"64 KB",
248
+ "dmi::memory::type":"RAM",
249
+ "net::interface::docker0::ipv4_broadcast":"Unknown",
250
+ "dmi::processor::socket_designation":"CPU 1",
251
+ "dmi::processor::serial_number":"Not Specified",
252
+ "dmi::memory::size":"5560 MB",
253
+ "cpu::thread(s)_per_core":"1",
254
+ "dmi::bios::relase_date":"04/01/2014",
255
+ "dmi::memory::serial_number":"Not Specified",
256
+ "uname::machine":"x86_64",
257
+ "dmi::memory::error_information_handle":"Not Provided",
258
+ "uname::nodename":"robot.example.com",
259
+ "dmi::memory::array_handle":"0x1000",
260
+ "dmi::system::sku_number":"Not Specified",
261
+ "dmi::processor::asset_tag":"Not Specified",
262
+ "lscpu::socket(s)":"3",
263
+ "lscpu::l2_cache":"4096K",
264
+ "dmi::system::wake-up_type":"Power Switch",
265
+ "cpu::cpu_socket(s)":"3",
266
+ "dmi::memory::speed":" (ns)",
267
+ "dmi":null,
268
+ "dmi::system":null,
269
+ "lscpu":null,
270
+ "distribution":null,
271
+ "dmi::memory":null,
272
+ "net":null,
273
+ "net::interface":null,
274
+ "net::interface::eth0":null,
275
+ "dmi::bios":null,
276
+ "dmi::processor":null,
277
+ "dmi::chassis":null,
278
+ "virt":null,
279
+ "uname":null,
280
+ "cpu":null,
281
+ "network":null,
282
+ "net::interface::eth0::ipv6_address":null,
283
+ "net::interface::eth0::ipv6_netmask":null,
284
+ "net::interface::docker0":null,
285
+ "net::interface::lo":null,
286
+ "net::interface::lo::ipv6_netmask":null,
287
+ "net::interface::lo::ipv6_address":null,
288
+ "memory":null,
289
+ "system":null,
290
+ "net::interface::docker0::mac_address":"02:42:BB:4D:22:C5",
291
+ "_timestamp":"2016-05-26T10:46:19-04:00"
292
+ },
293
+ "host_collections":[
294
+ {
295
+ "id":1,
296
+ "name":"my host collection"
297
+ }
298
+ ],
299
+ "permissions":{
300
+ "view_hosts":true,
301
+ "create_hosts":true,
302
+ "edit_hosts":true,
303
+ "destroy_hosts":true,
304
+ "build_hosts":true,
305
+ "power_hosts":true,
306
+ "console_hosts":true,
307
+ "ipmi_boot":true,
308
+ "puppetrun_hosts":true
309
+ }
310
+ }
@@ -0,0 +1,115 @@
1
+ {
2
+ "total":1,
3
+ "subtotal":1,
4
+ "page":1,
5
+ "per_page":20,
6
+ "search":null,
7
+ "sort":{
8
+ "by":null,
9
+ "order":null
10
+ },
11
+ "results":[
12
+ {
13
+ "ip":"192.168.121.86",
14
+ "environment_id":null,
15
+ "environment_name":null,
16
+ "last_report":null,
17
+ "mac":"52:54:00:bc:d3:71",
18
+ "realm_id":null,
19
+ "realm_name":null,
20
+ "sp_mac":null,
21
+ "sp_ip":null,
22
+ "sp_name":null,
23
+ "domain_id":null,
24
+ "domain_name":null,
25
+ "architecture_id":1,
26
+ "architecture_name":"x86_64",
27
+ "operatingsystem_id":null,
28
+ "operatingsystem_name":null,
29
+ "subnet_id":null,
30
+ "subnet_name":null,
31
+ "sp_subnet_id":null,
32
+ "ptable_id":null,
33
+ "ptable_name":null,
34
+ "medium_id":null,
35
+ "medium_name":null,
36
+ "build":false,
37
+ "comment":null,
38
+ "disk":null,
39
+ "installed_at":null,
40
+ "model_id":1,
41
+ "hostgroup_id":null,
42
+ "owner_id":3,
43
+ "owner_type":"User",
44
+ "enabled":true,
45
+ "puppet_ca_proxy_id":null,
46
+ "managed":false,
47
+ "use_image":null,
48
+ "image_file":"",
49
+ "uuid":null,
50
+ "compute_resource_id":null,
51
+ "compute_resource_name":null,
52
+ "compute_profile_id":null,
53
+ "compute_profile_name":null,
54
+ "capabilities":[
55
+ "build"
56
+ ],
57
+ "provision_method":"build",
58
+ "puppet_proxy_id":null,
59
+ "certname":"robot.example.com",
60
+ "image_id":null,
61
+ "image_name":null,
62
+ "created_at":"2016-05-25 09:39:20 -0400",
63
+ "updated_at":"2016-05-26 10:46:26 -0400",
64
+ "last_compile":"2016-05-26 10:46:19 -0400",
65
+ "global_status":1,
66
+ "global_status_label":"Warning",
67
+ "organization_id":1,
68
+ "organization_name":"Default Organization",
69
+ "location_id":2,
70
+ "location_name":"Default Location",
71
+ "puppet_status":0,
72
+ "model_name":"Standard PC (i440FX + PIIX, 1996)",
73
+ "errata_status":1,
74
+ "errata_status_label":"Could not calculate errata status, ensure host is registered and katello-agent is installed",
75
+ "subscription_status":0,
76
+ "subscription_status_label":"Fully entitled",
77
+ "name":"robot.example.com",
78
+ "id":1,
79
+ "hostgroup_name":null,
80
+ "hostgroup_title":null,
81
+ "content_facet_attributes":{
82
+ "id":1,
83
+ "uuid":"179834bf-779a-457f-a1fa-b06ae0acb21a",
84
+ "content_view_id":1,
85
+ "content_view_name":"Default Organization View",
86
+ "lifecycle_environment_id":1,
87
+ "lifecycle_environment_name":"Library",
88
+ "content_view":{
89
+ "id":1,
90
+ "name":"Default Organization View"
91
+ },
92
+ "lifecycle_environment":{
93
+ "id":1,
94
+ "name":"Library"
95
+ },
96
+ "errata_counts":{
97
+ "security":0,
98
+ "bugfix":0,
99
+ "enhancement":0,
100
+ "total":0
101
+ }
102
+ },
103
+ "subscription_facet_attributes":{
104
+ "id":2,
105
+ "uuid":"179834bf-779a-457f-a1fa-b06ae0acb21a",
106
+ "last_checkin":"2016-05-26 10:46:18 -0400",
107
+ "service_level":null,
108
+ "release_version":"{\"releaseVer\"=>nil}",
109
+ "autoheal":true,
110
+ "registered_at":"2016-05-26 10:46:22 -0400"
111
+ },
112
+ "content_host_id":2
113
+ }
114
+ ]
115
+ }
@@ -0,0 +1,27 @@
1
+ require File.join(File.dirname(__FILE__), '../../test_helper')
2
+
3
+ describe 'host info' do
4
+ before do
5
+ @cmd = %w(host info)
6
+ end
7
+
8
+ it "includes katello attributes" do
9
+ params = ['--id', '1']
10
+ ex = api_expects(:hosts, :show, 'Host show') do |par|
11
+ par['id'] == '1'
12
+ end
13
+
14
+ json_file = File.join(File.dirname(__FILE__), 'data', 'host.json')
15
+ ex.returns(JSON.parse(File.read(json_file)))
16
+
17
+ result = run_cmd(@cmd + params)
18
+
19
+ expected_fields = [['Lifecycle Environment', 'Library'],
20
+ ['Content View', 'Default Organization View'],
21
+ ['Release Version', '7Server'],
22
+ ['Bug Fix', '0'],
23
+ ['Name', 'my host collection']]
24
+ expected_results = expected_fields.map { |field| success_result(FieldMatcher.new(*field)) }
25
+ expected_results.each { |expected| assert_cmd(expected, result) }
26
+ end
27
+ end
@@ -0,0 +1,21 @@
1
+ require File.join(File.dirname(__FILE__), '../../test_helper')
2
+
3
+ describe 'host list' do
4
+ before do
5
+ @cmd = %w(host list)
6
+ end
7
+
8
+ it "list hosts" do
9
+ ex = api_expects(:hosts, :index, 'Host index')
10
+
11
+ json_file = File.join(File.dirname(__FILE__), 'data', 'host_list.json')
12
+ ex.returns(JSON.parse(File.read(json_file)))
13
+
14
+ result = run_cmd(@cmd)
15
+
16
+ fields = ['CONTENT VIEW', 'LIFECYCLE ENVIRONMENT']
17
+ values = ['Default Organization View', 'Library']
18
+ expected_result = success_result(IndexMatcher.new([fields, values]))
19
+ assert_cmd(expected_result, result)
20
+ end
21
+ end
@@ -1,10 +1,8 @@
1
1
  module HostHelpers
2
-
3
2
  def expect_host_search(name, id)
4
3
  ex = api_expects(:hosts, :index, 'Find the host') do |par|
5
4
  par[:search] == "name = \"#{name}\""
6
5
  end
7
6
  ex.returns(index_response([{'id' => id}]))
8
7
  end
9
-
10
8
  end