hammer_cli_katello 1.5.0 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/hammer_cli_katello/acs.rb +82 -0
- data/lib/hammer_cli_katello/activation_key.rb +8 -2
- data/lib/hammer_cli_katello/content_export.rb +39 -0
- data/lib/hammer_cli_katello/content_export_helper.rb +64 -6
- data/lib/hammer_cli_katello/host_subscription.rb +32 -0
- data/lib/hammer_cli_katello/organization.rb +4 -0
- data/lib/hammer_cli_katello/repository.rb +1 -1
- data/lib/hammer_cli_katello/simple_content_access.rb +10 -0
- data/lib/hammer_cli_katello/version.rb +1 -1
- data/lib/hammer_cli_katello.rb +5 -0
- data/test/data/2.5/foreman_api.json +1 -0
- data/test/data/3.0/foreman_api.json +1 -0
- data/test/data/3.10/foreman_api.json +1 -0
- data/test/data/3.11/foreman_api.json +1 -0
- data/test/data/3.12/foreman_api.json +1 -0
- data/test/data/3.13/foreman_api.json +1 -0
- data/test/data/3.14/foreman_api.json +1 -0
- data/test/data/3.15/foreman_api.json +1 -0
- data/test/data/3.16/foreman_api.json +1 -0
- data/test/data/3.17/foreman_api.json +1 -0
- data/test/data/3.18/foreman_api.json +1 -0
- data/test/data/3.19/foreman_api.json +1 -0
- data/test/data/3.2/foreman_api.json +1 -0
- data/test/data/3.4/foreman_api.json +1 -0
- data/test/data/3.5/foreman_api.json +1 -0
- data/test/data/3.6/foreman_api.json +1 -0
- data/test/data/3.7/foreman_api.json +1 -0
- data/test/data/3.8/foreman_api.json +1 -0
- data/test/data/3.9/foreman_api.json +1 -0
- data/test/data/4.0/foreman_api.json +1 -0
- data/test/data/4.1/foreman_api.json +1 -0
- data/test/data/4.3/foreman_api.json +1 -0
- data/test/data/4.4/foreman_api.json +1 -0
- data/test/data/4.5/foreman_api.json +1 -0
- data/test/data/4.6/foreman_api.json +1 -0
- data/test/data/Readme.md +5 -0
- data/test/functional/acs/create_test.rb +27 -0
- data/test/functional/acs/delete_test.rb +13 -0
- data/test/functional/acs/info_test.rb +94 -0
- data/test/functional/acs/list_test.rb +62 -0
- data/test/functional/acs/update_test.rb +23 -0
- data/test/functional/activation_key/add_host_collection_test.rb +62 -0
- data/test/functional/activation_key/content_override_test.rb +92 -0
- data/test/functional/activation_key/create_test.rb +33 -0
- data/test/functional/activation_key/data/activation_key.json +17 -0
- data/test/functional/activation_key/info_test.rb +29 -0
- data/test/functional/activation_key/list_test.rb +68 -0
- data/test/functional/activation_key/product_content_test.rb +23 -0
- data/test/functional/activation_key/remove_host_collection_test.rb +62 -0
- data/test/functional/activation_key/subscriptions_test.rb +74 -0
- data/test/functional/activation_key/update_test.rb +26 -0
- data/test/functional/apipie_helper_test.rb +31 -0
- data/test/functional/capsule/capsule_helpers.rb +13 -0
- data/test/functional/capsule/content/add_lifecycle_environment_test.rb +40 -0
- data/test/functional/capsule/content/cancel_synchronization_test.rb +42 -0
- data/test/functional/capsule/content/capsule_content_helpers.rb +24 -0
- data/test/functional/capsule/content/data/library_env.json +47 -0
- data/test/functional/capsule/content/data/sync_status.json +6 -0
- data/test/functional/capsule/content/data/sync_tasks.json +62 -0
- data/test/functional/capsule/content/info_test.rb +61 -0
- data/test/functional/capsule/content/lifecycle_environments_test.rb +19 -0
- data/test/functional/capsule/content/remove_lifecycle_environment_test.rb +40 -0
- data/test/functional/capsule/content/synchronization_status_test.rb +107 -0
- data/test/functional/capsule/info_test.rb +25 -0
- data/test/functional/capsule/list_test.rb +24 -0
- data/test/functional/content_credentials/create_test.rb +32 -0
- data/test/functional/content_credentials/data/test_cert.json +43 -0
- data/test/functional/content_credentials/info_test.rb +50 -0
- data/test/functional/content_credentials/list_test.rb +66 -0
- data/test/functional/content_export/complete/library_test.rb +155 -0
- data/test/functional/content_export/complete/repository_test.rb +226 -0
- data/test/functional/content_export/complete/version_test.rb +297 -0
- data/test/functional/content_export/content_export_helpers.rb +33 -0
- data/test/functional/content_export/generate_listing_test.rb +62 -0
- data/test/functional/content_export/generate_metadata_test.rb +64 -0
- data/test/functional/content_export/incremental/library_test.rb +172 -0
- data/test/functional/content_export/incremental/repository_test.rb +212 -0
- data/test/functional/content_export/incremental/version_test.rb +268 -0
- data/test/functional/content_export/list_test.rb +64 -0
- data/test/functional/content_import/library_test.rb +85 -0
- data/test/functional/content_import/list_test.rb +65 -0
- data/test/functional/content_import/metadata.json +1 -0
- data/test/functional/content_import/version_test.rb +85 -0
- data/test/functional/content_units/info_test.rb +29 -0
- data/test/functional/content_units/list_test.rb +106 -0
- data/test/functional/content_view/add_content_view_version_test.rb +88 -0
- data/test/functional/content_view/add_repository_test.rb +21 -0
- data/test/functional/content_view/component/add_test.rb +177 -0
- data/test/functional/content_view/component/list_test.rb +55 -0
- data/test/functional/content_view/component/remove_test.rb +107 -0
- data/test/functional/content_view/component/update_test.rb +134 -0
- data/test/functional/content_view/content_view_helpers.rb +20 -0
- data/test/functional/content_view/copy_test.rb +53 -0
- data/test/functional/content_view/create_test.rb +34 -0
- data/test/functional/content_view/delete_test.rb +62 -0
- data/test/functional/content_view/filter/create_test.rb +57 -0
- data/test/functional/content_view/filter/delete_test.rb +90 -0
- data/test/functional/content_view/filter/info_test.rb +89 -0
- data/test/functional/content_view/filter/list_test.rb +98 -0
- data/test/functional/content_view/filter/update_test.rb +91 -0
- data/test/functional/content_view/list_test.rb +68 -0
- data/test/functional/content_view/publish_test.rb +24 -0
- data/test/functional/content_view/purge_test.rb +97 -0
- data/test/functional/content_view/remove_content_view_version_test.rb +88 -0
- data/test/functional/content_view/remove_test.rb +79 -0
- data/test/functional/content_view/update_test.rb +53 -0
- data/test/functional/content_view/version/incremental_update_test.rb +108 -0
- data/test/functional/content_view/version/list_test.rb +44 -0
- data/test/functional/content_view/version/promote_test.rb +75 -0
- data/test/functional/content_view/version/republish_repositories_test.rb +34 -0
- data/test/functional/content_view/version/update_test.rb +48 -0
- data/test/functional/erratum/erratum_helpers.rb +91 -0
- data/test/functional/erratum/info_test.rb +29 -0
- data/test/functional/erratum/list_test.rb +108 -0
- 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/create_test.rb +99 -0
- data/test/functional/filter_rule/delete_test.rb +104 -0
- data/test/functional/filter_rule/filter_rule_helpers.rb +12 -0
- data/test/functional/filter_rule/info_test.rb +104 -0
- data/test/functional/filter_rule/list_test.rb +91 -0
- data/test/functional/filter_rule/update_test.rb +104 -0
- data/test/functional/host/errata/apply_test.rb +45 -0
- data/test/functional/host/errata/info_test.rb +27 -0
- data/test/functional/host/errata/list_test.rb +49 -0
- data/test/functional/host/errata/recalculate_test.rb +26 -0
- data/test/functional/host/extensions/create_test.rb +95 -0
- data/test/functional/host/extensions/data/host.json +320 -0
- data/test/functional/host/extensions/data/host_list.json +117 -0
- data/test/functional/host/extensions/info_test.rb +35 -0
- data/test/functional/host/extensions/list_test.rb +21 -0
- data/test/functional/host/extensions/update_test.rb +70 -0
- data/test/functional/host/host_helpers.rb +8 -0
- data/test/functional/host/subscription/attach_test.rb +54 -0
- data/test/functional/host/subscription/auto_attach_test.rb +35 -0
- data/test/functional/host/subscription/content_override_test.rb +96 -0
- data/test/functional/host/subscription/enabled_repositories_test.rb +39 -0
- data/test/functional/host/subscription/product_content_test.rb +27 -0
- data/test/functional/host/subscription/register_test.rb +53 -0
- data/test/functional/host/subscription/remove_test.rb +52 -0
- data/test/functional/host/subscription/unregister_test.rb +37 -0
- data/test/functional/host/traces/list_test.rb +37 -0
- data/test/functional/host/traces/resolve_test.rb +31 -0
- data/test/functional/host_collection/add_host_test.rb +90 -0
- data/test/functional/host_collection/content_api_expectations.rb +35 -0
- data/test/functional/host_collection/content_install_test.rb +62 -0
- data/test/functional/host_collection/content_remove_test.rb +37 -0
- data/test/functional/host_collection/content_update_test.rb +37 -0
- data/test/functional/host_collection/copy_test.rb +64 -0
- data/test/functional/host_collection/create_test.rb +54 -0
- data/test/functional/host_collection/delete_test.rb +57 -0
- data/test/functional/host_collection/hosts_test.rb +39 -0
- data/test/functional/host_collection/info_test.rb +57 -0
- data/test/functional/host_collection/list_test.rb +63 -0
- data/test/functional/host_collection/remove_host_test.rb +90 -0
- data/test/functional/host_collection/update_test.rb +57 -0
- data/test/functional/hostgroup/create_test.rb +112 -0
- data/test/functional/hostgroup/data/hostgroup.json +50 -0
- data/test/functional/hostgroup/info_test.rb +33 -0
- data/test/functional/hostgroup/update_test.rb +120 -0
- data/test/functional/lifecycle_environment/create_test.rb +14 -0
- data/test/functional/lifecycle_environment/lifecycle_environment_helpers.rb +18 -0
- data/test/functional/lifecycle_environment/list_test.rb +38 -0
- data/test/functional/lifecycle_environment/update_test.rb +14 -0
- data/test/functional/local_helper_test.rb +30 -0
- data/test/functional/module_stream/info_test.rb +58 -0
- data/test/functional/module_stream/list_test.rb +53 -0
- data/test/functional/organization/cdn_configuration_test.rb +45 -0
- data/test/functional/organization/delete_test.rb +26 -0
- data/test/functional/organization/info_test.rb +45 -0
- data/test/functional/organization/organization_helpers.rb +10 -0
- data/test/functional/package/list_test.rb +160 -0
- data/test/functional/package_group/list_test.rb +38 -0
- data/test/functional/ping_test.rb +61 -0
- data/test/functional/product/create_test.rb +54 -0
- data/test/functional/product/delete_test.rb +41 -0
- data/test/functional/product/info_test.rb +33 -0
- data/test/functional/product/list_test.rb +58 -0
- data/test/functional/product/product_helpers.rb +24 -0
- data/test/functional/product/remove_sync_plan_test.rb +35 -0
- data/test/functional/product/set_sync_plan_test.rb +49 -0
- data/test/functional/product/update_proxy.rb +48 -0
- data/test/functional/product/update_test.rb +46 -0
- data/test/functional/repository/create_test.rb +21 -0
- data/test/functional/repository/delete_test.rb +95 -0
- data/test/functional/repository/info_test.rb +156 -0
- data/test/functional/repository/list_test.rb +68 -0
- data/test/functional/repository/reclaim_space_test.rb +105 -0
- data/test/functional/repository/remove_content_test.rb +108 -0
- data/test/functional/repository/repository_helpers.rb +18 -0
- data/test/functional/repository/republish_test.rb +37 -0
- data/test/functional/repository/synchronize_test.rb +57 -0
- data/test/functional/repository/update_test.rb +150 -0
- data/test/functional/repository/upload_test.rb +368 -0
- data/test/functional/repository_set/available_repositories_test.rb +18 -0
- data/test/functional/repository_set/disable_test.rb +48 -0
- data/test/functional/repository_set/enable_test.rb +42 -0
- data/test/functional/repository_set/info_test.rb +17 -0
- data/test/functional/repository_set/list_test.rb +18 -0
- data/test/functional/repository_set/repository_set_helpers.rb +20 -0
- data/test/functional/search_helpers.rb +17 -0
- data/test/functional/simple_content_access/disable_test.rb +48 -0
- data/test/functional/simple_content_access/enable_test.rb +46 -0
- data/test/functional/simple_content_access/status_test.rb +29 -0
- data/test/functional/srpm/list_test.rb +92 -0
- data/test/functional/subscription/list_test.rb +86 -0
- data/test/functional/sync_plan/create_test.rb +60 -0
- data/test/functional/sync_plan/delete_test.rb +46 -0
- data/test/functional/sync_plan/info_test.rb +37 -0
- data/test/functional/sync_plan/list_test.rb +31 -0
- data/test/functional/sync_plan/sync_plan_helpers.rb +8 -0
- data/test/functional/sync_plan/update_test.rb +44 -0
- data/test/functional/test_helper.rb +24 -0
- data/test/task_helper.rb +7 -0
- data/test/test_helper.rb +38 -0
- data/test/unit/id_name_options_validator_test.rb +96 -0
- data/test/unit/id_resolver_test.rb +58 -0
- data/test/unit/messages_test.rb +7 -0
- data/test/unit/search_options_creators_test.rb +145 -0
- metadata +425 -4
@@ -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
|
@@ -0,0 +1,320 @@
|
|
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_source_id":2,
|
78
|
+
"content_source_name":"capsule",
|
79
|
+
"kickstart_repository_id":10000,
|
80
|
+
"kickstart_repository_name":"Rhel 7",
|
81
|
+
"content_view":{
|
82
|
+
"id":1,
|
83
|
+
"name":"Default Organization View"
|
84
|
+
},
|
85
|
+
"lifecycle_environment":{
|
86
|
+
"id":1,
|
87
|
+
"name":"Library"
|
88
|
+
},
|
89
|
+
"errata_counts":{
|
90
|
+
"security":0,
|
91
|
+
"bugfix":0,
|
92
|
+
"enhancement":0,
|
93
|
+
"total":0
|
94
|
+
},
|
95
|
+
"content_view_version":"1.0",
|
96
|
+
"content_view_version_id":1,
|
97
|
+
"content_view_default?":true,
|
98
|
+
"lifecycle_environment_library?":true,
|
99
|
+
"katello_agent_installed":true,
|
100
|
+
"applicable_package_count": 5,
|
101
|
+
"upgradable_package_count": 4
|
102
|
+
},
|
103
|
+
"traces_status_label":"Updated",
|
104
|
+
"subscription_facet_attributes":{
|
105
|
+
"id":2,
|
106
|
+
"uuid":"179834bf-779a-457f-a1fa-b06ae0acb21a",
|
107
|
+
"last_checkin":"2016-05-26 10:46:18 -0400",
|
108
|
+
"service_level":"high",
|
109
|
+
"release_version":"7Server",
|
110
|
+
"purpose_usage":"Production",
|
111
|
+
"purpose_role":"Role",
|
112
|
+
"purpose_addons":"Test Addon1, Test Addon2",
|
113
|
+
"autoheal":true,
|
114
|
+
"registered_at":"2016-05-26 10:46:22 -0400",
|
115
|
+
"activation_keys":[
|
116
|
+
|
117
|
+
],
|
118
|
+
"compliance_reasons":[
|
119
|
+
|
120
|
+
],
|
121
|
+
"virtual_host":null,
|
122
|
+
"virtual_guests":[
|
123
|
+
|
124
|
+
],
|
125
|
+
"installed_products":[
|
126
|
+
|
127
|
+
]
|
128
|
+
},
|
129
|
+
"content_host_id":2,
|
130
|
+
"parameters":[
|
131
|
+
|
132
|
+
],
|
133
|
+
"interfaces":[
|
134
|
+
{
|
135
|
+
"id":2,
|
136
|
+
"name":null,
|
137
|
+
"ip":"172.17.42.1",
|
138
|
+
"mac":"02:42:d1:70:84:d0",
|
139
|
+
"identifier":"docker0",
|
140
|
+
"primary":false,
|
141
|
+
"provision":false,
|
142
|
+
"type":"interface"
|
143
|
+
},
|
144
|
+
{
|
145
|
+
"id":1,
|
146
|
+
"name":"robot.example.com",
|
147
|
+
"ip":"192.168.121.86",
|
148
|
+
"mac":"52:54:00:bc:d3:71",
|
149
|
+
"identifier":"eth0",
|
150
|
+
"primary":true,
|
151
|
+
"provision":true,
|
152
|
+
"type":"interface"
|
153
|
+
}
|
154
|
+
],
|
155
|
+
"puppetclasses":[
|
156
|
+
|
157
|
+
],
|
158
|
+
"config_groups":[
|
159
|
+
|
160
|
+
],
|
161
|
+
"all_parameters":[
|
162
|
+
|
163
|
+
],
|
164
|
+
"all_puppetclasses":[
|
165
|
+
|
166
|
+
],
|
167
|
+
"facts":{
|
168
|
+
"dmi::system::uuid":"63C9E5F3-0CC7-47B2-BD76-FE3B2E947F7A",
|
169
|
+
"lscpu::l1d_cache":"32K",
|
170
|
+
"distribution::name":"CentOS Linux",
|
171
|
+
"dmi::memory::manufacturer":"QEMU",
|
172
|
+
"net::interface::eth0::mac_address":"52:54:00:BC:D3:71",
|
173
|
+
"dmi::bios::address":"0xe8000",
|
174
|
+
"distribution::id":"Core",
|
175
|
+
"dmi::processor::family":"Other",
|
176
|
+
"dmi::memory::assettag":"Not Specified",
|
177
|
+
"dmi::chassis::manufacturer":"QEMU",
|
178
|
+
"dmi::memory::bank_locator":"Not Specified",
|
179
|
+
"lscpu::numa_node(s)":"1",
|
180
|
+
"virt::host_type":"kvm",
|
181
|
+
"lscpu::l1i_cache":"32K",
|
182
|
+
"lscpu::vendor_id":"GenuineIntel",
|
183
|
+
"virt::is_guest":"true",
|
184
|
+
"dmi::chassis::security_status":"Unknown",
|
185
|
+
"uname::sysname":"Linux",
|
186
|
+
"dmi::processor::type":"Central Processor",
|
187
|
+
"lscpu::hypervisor_vendor":"KVM",
|
188
|
+
"lscpu::cpu_op-mode(s)":"32-bit, 64-bit",
|
189
|
+
"net::interface::eth0::ipv4_netmask":"24",
|
190
|
+
"net::interface::eth0::ipv4_address":"192.168.121.86",
|
191
|
+
"dmi::system::family":"Not Specified",
|
192
|
+
"cpu::core(s)_per_socket":"1",
|
193
|
+
"distribution::version":"7",
|
194
|
+
"network::ipv4_address":"127.0.0.1",
|
195
|
+
"dmi::bios::vendor":"SeaBIOS",
|
196
|
+
"net::interface::eth0::ipv6_address::link":"fe80::5054:ff:febc:d371",
|
197
|
+
"dmi::bios::bios_revision":"0.0",
|
198
|
+
"dmi::system::version":"pc-i440fx-2.4",
|
199
|
+
"net::interface::eth0::ipv6_netmask::link":"64",
|
200
|
+
"lscpu::stepping":"3",
|
201
|
+
"dmi::chassis::type":"Other",
|
202
|
+
"dmi::chassis::serial_number":"Not Specified",
|
203
|
+
"dmi::chassis::power_supply_state":"Safe",
|
204
|
+
"net::interface::lo::ipv6_netmask::host":"128",
|
205
|
+
"lscpu::bogomips":"5387.52",
|
206
|
+
"dmi::chassis::lock":"Not Present",
|
207
|
+
"network::ipv6_address":"fe80::5054:ff:febc:d371",
|
208
|
+
"net::interface::lo::ipv4_address":"127.0.0.1",
|
209
|
+
"lscpu::thread(s)_per_core":"1",
|
210
|
+
"dmi::system::serial_number":"Not Specified",
|
211
|
+
"dmi::chassis::boot-up_state":"Safe",
|
212
|
+
"dmi::processor::status":"Populated:Enabled",
|
213
|
+
"net::interface::lo::ipv4_broadcast":"Unknown",
|
214
|
+
"lscpu::on-line_cpu(s)_list":"0-2",
|
215
|
+
"dmi::memory::locator":"DIMM 0",
|
216
|
+
"dmi::chassis::asset_tag":"Not Specified",
|
217
|
+
"dmi::system::status":"No errors detected",
|
218
|
+
"dmi::chassis::version":"pc-i440fx-2.4",
|
219
|
+
"dmi::processor::part_number":"Not Specified",
|
220
|
+
"dmi::memory::location":"Other",
|
221
|
+
"net::interface::lo::ipv4_netmask":"8",
|
222
|
+
"cpu::cpu(s)":"3",
|
223
|
+
"network::hostname":"robot.example.com",
|
224
|
+
"dmi::system::manufacturer":"QEMU",
|
225
|
+
"net::interface::lo::ipv6_address::host":"::1",
|
226
|
+
"uname::version":"#1 SMP Tue Feb 16 17:03:50 UTC 2016",
|
227
|
+
"dmi::memory::use":"System Memory",
|
228
|
+
"lscpu::cpu(s)":"3",
|
229
|
+
"dmi::processor::upgrade":"Other",
|
230
|
+
"lscpu::byte_order":"Little Endian",
|
231
|
+
"memory::memtotal":"5356760",
|
232
|
+
"dmi::bios::version":"1.8.2-20150714_191134-",
|
233
|
+
"lscpu::model_name":"QEMU Virtual CPU version 2.4.1",
|
234
|
+
"dmi::bios::runtime_size":"96 KB",
|
235
|
+
"lscpu::cpu_family":"6",
|
236
|
+
"lscpu::virtualization_type":"full",
|
237
|
+
"system::certificate_version":"3.2",
|
238
|
+
"dmi::memory::part_number":"Not Specified",
|
239
|
+
"dmi::chassis::thermal_state":"Safe",
|
240
|
+
"lscpu::numa_node0_cpu(s)":"0-2",
|
241
|
+
"lscpu::architecture":"x86_64",
|
242
|
+
"lscpu::model":"6",
|
243
|
+
"dmi::memory::maximum_capacity":"5560 MB",
|
244
|
+
"dmi::memory::error_correction_type":"Multi-bit ECC",
|
245
|
+
"lscpu::core(s)_per_socket":"1",
|
246
|
+
"net::interface::docker0::ipv4_netmask":"16",
|
247
|
+
"virt::uuid":"63C9E5F3-0CC7-47B2-BD76-FE3B2E947F7A",
|
248
|
+
"lscpu::cpu_mhz":"2693.762",
|
249
|
+
"dmi::system::product_name":"Standard PC (i440FX + PIIX, 1996)",
|
250
|
+
"dmi::processor::version":"pc-i440fx-2.4",
|
251
|
+
"dmi::memory::form_factor":"DIMM",
|
252
|
+
"memory::swaptotal":"1048572",
|
253
|
+
"net::interface::eth0::ipv4_broadcast":"192.168.121.255",
|
254
|
+
"net::interface::docker0::ipv4_address":"172.17.42.1",
|
255
|
+
"uname::release":"3.10.0-327.10.1.el7.x86_64",
|
256
|
+
"cpu::topology_source":"kernel /sys cpu sibling lists",
|
257
|
+
"dmi::bios::rom_size":"64 KB",
|
258
|
+
"dmi::memory::type":"RAM",
|
259
|
+
"net::interface::docker0::ipv4_broadcast":"Unknown",
|
260
|
+
"dmi::processor::socket_designation":"CPU 1",
|
261
|
+
"dmi::processor::serial_number":"Not Specified",
|
262
|
+
"dmi::memory::size":"5560 MB",
|
263
|
+
"cpu::thread(s)_per_core":"1",
|
264
|
+
"dmi::bios::relase_date":"04/01/2014",
|
265
|
+
"dmi::memory::serial_number":"Not Specified",
|
266
|
+
"uname::machine":"x86_64",
|
267
|
+
"dmi::memory::error_information_handle":"Not Provided",
|
268
|
+
"uname::nodename":"robot.example.com",
|
269
|
+
"dmi::memory::array_handle":"0x1000",
|
270
|
+
"dmi::system::sku_number":"Not Specified",
|
271
|
+
"dmi::processor::asset_tag":"Not Specified",
|
272
|
+
"lscpu::socket(s)":"3",
|
273
|
+
"lscpu::l2_cache":"4096K",
|
274
|
+
"dmi::system::wake-up_type":"Power Switch",
|
275
|
+
"cpu::cpu_socket(s)":"3",
|
276
|
+
"dmi::memory::speed":" (ns)",
|
277
|
+
"dmi":null,
|
278
|
+
"dmi::system":null,
|
279
|
+
"lscpu":null,
|
280
|
+
"distribution":null,
|
281
|
+
"dmi::memory":null,
|
282
|
+
"net":null,
|
283
|
+
"net::interface":null,
|
284
|
+
"net::interface::eth0":null,
|
285
|
+
"dmi::bios":null,
|
286
|
+
"dmi::processor":null,
|
287
|
+
"dmi::chassis":null,
|
288
|
+
"virt":null,
|
289
|
+
"uname":null,
|
290
|
+
"cpu":null,
|
291
|
+
"network":null,
|
292
|
+
"net::interface::eth0::ipv6_address":null,
|
293
|
+
"net::interface::eth0::ipv6_netmask":null,
|
294
|
+
"net::interface::docker0":null,
|
295
|
+
"net::interface::lo":null,
|
296
|
+
"net::interface::lo::ipv6_netmask":null,
|
297
|
+
"net::interface::lo::ipv6_address":null,
|
298
|
+
"memory":null,
|
299
|
+
"system":null,
|
300
|
+
"net::interface::docker0::mac_address":"02:42:BB:4D:22:C5",
|
301
|
+
"_timestamp":"2016-05-26T10:46:19-04:00"
|
302
|
+
},
|
303
|
+
"host_collections":[
|
304
|
+
{
|
305
|
+
"id":1,
|
306
|
+
"name":"my host collection"
|
307
|
+
}
|
308
|
+
],
|
309
|
+
"permissions":{
|
310
|
+
"view_hosts":true,
|
311
|
+
"create_hosts":true,
|
312
|
+
"edit_hosts":true,
|
313
|
+
"destroy_hosts":true,
|
314
|
+
"build_hosts":true,
|
315
|
+
"power_hosts":true,
|
316
|
+
"console_hosts":true,
|
317
|
+
"ipmi_boot":true,
|
318
|
+
"puppetrun_hosts":true
|
319
|
+
}
|
320
|
+
}
|
@@ -0,0 +1,117 @@
|
|
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
|
+
"traces_status":0,
|
78
|
+
"traces_status_label":"updated",
|
79
|
+
"name":"robot.example.com",
|
80
|
+
"id":1,
|
81
|
+
"hostgroup_name":null,
|
82
|
+
"hostgroup_title":null,
|
83
|
+
"content_facet_attributes":{
|
84
|
+
"id":1,
|
85
|
+
"uuid":"179834bf-779a-457f-a1fa-b06ae0acb21a",
|
86
|
+
"content_view_id":1,
|
87
|
+
"content_view_name":"Default Organization View",
|
88
|
+
"lifecycle_environment_id":1,
|
89
|
+
"lifecycle_environment_name":"Library",
|
90
|
+
"content_view":{
|
91
|
+
"id":1,
|
92
|
+
"name":"Default Organization View"
|
93
|
+
},
|
94
|
+
"lifecycle_environment":{
|
95
|
+
"id":1,
|
96
|
+
"name":"Library"
|
97
|
+
},
|
98
|
+
"errata_counts":{
|
99
|
+
"security":0,
|
100
|
+
"bugfix":0,
|
101
|
+
"enhancement":0,
|
102
|
+
"total":0
|
103
|
+
}
|
104
|
+
},
|
105
|
+
"subscription_facet_attributes":{
|
106
|
+
"id":2,
|
107
|
+
"uuid":"179834bf-779a-457f-a1fa-b06ae0acb21a",
|
108
|
+
"last_checkin":"2016-05-26 10:46:18 -0400",
|
109
|
+
"service_level":null,
|
110
|
+
"release_version":"{\"releaseVer\"=>nil}",
|
111
|
+
"autoheal":true,
|
112
|
+
"registered_at":"2016-05-26 10:46:22 -0400"
|
113
|
+
},
|
114
|
+
"content_host_id":2
|
115
|
+
}
|
116
|
+
]
|
117
|
+
}
|
@@ -0,0 +1,35 @@
|
|
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
|
+
# rubocop:disable Style/WordArray
|
19
|
+
expected_fields = [['Name', 'Library'],
|
20
|
+
['Name', 'Default Organization View'],
|
21
|
+
['Release Version', '7Server'],
|
22
|
+
['Name', 'Rhel 7'],
|
23
|
+
['Name', 'capsule'],
|
24
|
+
['Bug Fix', '0'],
|
25
|
+
['Name', 'my host collection'],
|
26
|
+
['Applicable Packages', '5'],
|
27
|
+
['Upgradable Packages', '4'],
|
28
|
+
['Purpose Usage', 'Production'],
|
29
|
+
['Purpose Role', 'Role'],
|
30
|
+
['Purpose Addons', 'Test Addon1, Test Addon2'],
|
31
|
+
['Trace Status', 'Updated']]
|
32
|
+
expected_results = expected_fields.map { |field| success_result(FieldMatcher.new(*field)) }
|
33
|
+
expected_results.each { |expected| assert_cmd(expected, result) }
|
34
|
+
end
|
35
|
+
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', 'TRACE STATUS']
|
17
|
+
values = ['Default Organization View', 'Library', 'updated']
|
18
|
+
expected_result = success_result(IndexMatcher.new([fields, values]))
|
19
|
+
assert_cmd(expected_result, result)
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,70 @@
|
|
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 hostgroup command
|
7
|
+
# See hammer-cli-foreman for the core hostgroup tests
|
8
|
+
describe UpdateCommand do
|
9
|
+
it 'allows kickstart repository name' do
|
10
|
+
env_name = "world"
|
11
|
+
env_id = 100
|
12
|
+
cv_id = 200
|
13
|
+
repo_name = "life_of_kickstart"
|
14
|
+
repo_id = 111
|
15
|
+
host_id = 777
|
16
|
+
organization_id = 329
|
17
|
+
api_expects(:lifecycle_environments, :index).
|
18
|
+
with_params('name' => env_name,
|
19
|
+
'organization_id' => organization_id).
|
20
|
+
returns(index_response([{'id' => env_id}]))
|
21
|
+
|
22
|
+
api_expects(:repositories, :index).
|
23
|
+
with_params('name' => repo_name,
|
24
|
+
'environment_id' => env_id,
|
25
|
+
'content_view_id' => cv_id).
|
26
|
+
returns(index_response([{'id' => repo_id}]))
|
27
|
+
|
28
|
+
api_expects(:hosts, :update).
|
29
|
+
with_params('id' => host_id.to_s,
|
30
|
+
'organization_id' => organization_id,
|
31
|
+
'host' => {
|
32
|
+
'content_facet_attributes' => {
|
33
|
+
'content_view_id' => cv_id,
|
34
|
+
'lifecycle_environment_id' => env_id,
|
35
|
+
'kickstart_repository_id' => repo_id
|
36
|
+
},
|
37
|
+
'subscription_facet_attributes' => {}
|
38
|
+
})
|
39
|
+
|
40
|
+
cmd = "host update --id=#{host_id}"\
|
41
|
+
" --content-view-id=#{cv_id}"\
|
42
|
+
" --lifecycle-environment=#{env_name}"\
|
43
|
+
" --kickstart-repository=#{repo_name}"\
|
44
|
+
" --organization-id=#{organization_id}"
|
45
|
+
run_cmd(cmd.split)
|
46
|
+
end
|
47
|
+
|
48
|
+
it 'allows content source name' do
|
49
|
+
content_source_name = "life_of_cs"
|
50
|
+
content_source_id = 111
|
51
|
+
host_id = 441
|
52
|
+
|
53
|
+
api_expects(:smart_proxies, :index).
|
54
|
+
with_params(:search => "name = \"#{content_source_name}\"").
|
55
|
+
returns(index_response([{'id' => content_source_id}]))
|
56
|
+
|
57
|
+
api_expects(:hosts, :update).
|
58
|
+
with_params('id' => host_id.to_s,
|
59
|
+
'host' => {
|
60
|
+
'content_facet_attributes' => {
|
61
|
+
'content_source_id' => content_source_id
|
62
|
+
}
|
63
|
+
})
|
64
|
+
|
65
|
+
cmd = "host update --id #{host_id} --content-source #{content_source_name}"
|
66
|
+
run_cmd(cmd.split)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|