diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 0d01d46b..d251a617 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -139,6 +139,9 @@ Metrics/AbcSize: Metrics/BlockLength: Max: 264 +Metrics/ModuleLength: + Max: 120 + # Offense count: 5 # Configuration parameters: IgnoredMethods. Metrics/CyclomaticComplexity: diff --git a/lib/hammer_cli_katello/host_extensions.rb b/lib/hammer_cli_katello/host_extensions.rb index d0837c2e..af2b7448 100644 --- a/lib/hammer_cli_katello/host_extensions.rb +++ b/lib/hammer_cli_katello/host_extensions.rb @@ -35,6 +35,14 @@ module HostExtensions field :bugfix, _("Bugfix"), nil, :sets => ['ALL'] field :enhancement, _("Enhancement"), nil, :sets => ['ALL'] end + field :bootc_booted_image, _('Running image'), nil, :sets => ['ALL'] + field :bootc_booted_digest, _('Running image digest'), nil, :sets => ['ALL'] + field :bootc_staged_image, _('Staged image'), nil, :sets => ['ALL'] + field :bootc_staged_digest, _('Staged image digest'), nil, :sets => ['ALL'] + field :bootc_available_image, _('Available image'), nil, :sets => ['ALL'] + field :bootc_available_digest, _('Available image digest'), nil, :sets => ['ALL'] + field :bootc_rollback_image, _('Rollback image'), nil, :sets => ['ALL'] + field :bootc_rollback_digest, _('Rollback image digest'), nil, :sets => ['ALL'] end field :traces_status_label, _('Trace Status') end @@ -106,6 +114,19 @@ module HostExtensions end end + label _('bootc Image Information') do + from :content_facet_attributes do + field :bootc_booted_image, _('Running image') + field :bootc_booted_digest, _('Running image digest') + field :bootc_staged_image, _('Staged image') + field :bootc_staged_digest, _('Staged image digest') + field :bootc_available_image, _('Available image') + field :bootc_available_digest, _('Available image digest') + field :bootc_rollback_image, _('Rollback image') + field :bootc_rollback_digest, _('Rollback image digest') + end + end + field :traces_status_label, _('Trace Status') collection :host_collections, _('Host Collections') do diff --git a/test/functional/content_view/component/update_test.rb b/test/functional/content_view/component/update_test.rb index c66ab3f3..f7d995cb 100644 --- a/test/functional/content_view/component/update_test.rb +++ b/test/functional/content_view/component/update_test.rb @@ -1,6 +1,5 @@ require_relative '../../test_helper' require 'hammer_cli_katello/content_view_component' -# rubocop:disable Metrics/ModuleLength module HammerCLIKatello describe ContentViewComponent::UpdateCommand do before do diff --git a/test/functional/host/extensions/data/host.json b/test/functional/host/extensions/data/host.json index 3a39c421..61eaf52d 100644 --- a/test/functional/host/extensions/data/host.json +++ b/test/functional/host/extensions/data/host.json @@ -98,7 +98,15 @@ "lifecycle_environment_library?":true, "katello_agent_installed":true, "applicable_package_count": 5, - "upgradable_package_count": 4 + "upgradable_package_count": 4, + "bootc_booted_image":"potato", + "bootc_booted_digest":"sha256:a68293b8402890ba802f11fc2fab26e23c665be9e645836c3f32cbfe9e07f9ae", + "bootc_available_image":"potato2", + "bootc_available_digest":"sha256:a68293b8402890ba802f11fc2fab26e23c665be9e645836c3f32cbfe9e07f9a2", + "bootc_staged_image":"potato3", + "bootc_staged_digest":"sha256:a68293b8402890ba802f11fc2fab26e23c665be9e645836c3f32cbfe9e07f9a1", + "bootc_rollback_image":"potato4", + "bootc_rollback_digest":"sha256:a68293b8402890ba802f11fc2fab26e23c665be9e645836c3f32cbfe9e07f9a9" }, "traces_status_label":"Updated", "subscription_facet_attributes":{ diff --git a/test/functional/host/extensions/data/host_list.json b/test/functional/host/extensions/data/host_list.json index 29e0588f..89b04ac7 100644 --- a/test/functional/host/extensions/data/host_list.json +++ b/test/functional/host/extensions/data/host_list.json @@ -121,7 +121,15 @@ "bugfix":0, "enhancement":0, "total":0 - } + }, + "bootc_booted_image":"potato", + "bootc_booted_digest":"sha256:a68293b8402890ba802f11fc2fab26e23c665be9e645836c3f32cbfe9e07f9ae", + "bootc_available_image":"potato2", + "bootc_available_digest":"sha256:a68293b8402890ba802f11fc2fab26e23c665be9e645836c3f32cbfe9e07f9a2", + "bootc_staged_image":"potato3", + "bootc_staged_digest":"sha256:a68293b8402890ba802f11fc2fab26e23c665be9e645836c3f32cbfe9e07f9a1", + "bootc_rollback_image":"potato4", + "bootc_rollback_digest":"sha256:a68293b8402890ba802f11fc2fab26e23c665be9e645836c3f32cbfe9e07f9a9" }, "subscription_facet_attributes":{ "id":2, @@ -135,4 +143,4 @@ "content_host_id":2 } ] -} \ No newline at end of file +} diff --git a/test/functional/host/extensions/info_test.rb b/test/functional/host/extensions/info_test.rb index 2e3258fa..6de492eb 100644 --- a/test/functional/host/extensions/info_test.rb +++ b/test/functional/host/extensions/info_test.rb @@ -27,7 +27,10 @@ ['Purpose Usage', 'Production'], ['Purpose Role', 'Role'], ['Purpose Addons', 'Test Addon1, Test Addon2'], - ['Trace Status', 'Updated']] + ['Trace Status', 'Updated'], + ['Running image', 'potato'], + ['Running image digest', + 'sha256:a68293b8402890ba802f11fc2fab26e23c665be9e645836c3f32cbfe9e07f9ae']] expected_results = expected_fields.map { |field| success_result(FieldMatcher.new(*field)) } expected_results.each { |expected| assert_cmd(expected, result) } end diff --git a/test/functional/host/extensions/list_test.rb b/test/functional/host/extensions/list_test.rb index 51062b94..200b81c2 100644 --- a/test/functional/host/extensions/list_test.rb +++ b/test/functional/host/extensions/list_test.rb @@ -18,4 +18,18 @@ expected_result = success_result(IndexMatcher.new([fields, values])) assert_cmd(expected_result, result) end + + it "list hosts bootc" do + ex = api_expects(:hosts, :index, 'Host index') + + json_file = File.join(File.dirname(__FILE__), 'data', 'host_list.json') + ex.returns(JSON.parse(File.read(json_file))) + + result = run_cmd(['host', 'list', "--fields=\"Running image\",\"Running image digest\""]) + + fields = ['RUNNING IMAGE', 'RUNNING IMAGE DIGEST'] + values = ['sha256:a68293b8402890ba802f11fc2fab26e23c665be9e645836c3f32cbfe9e07f9ae'] + expected_result = success_result(IndexMatcher.new([fields, values])) + assert_cmd(expected_result, result) + end end diff --git a/test/functional/package/list_test.rb b/test/functional/package/list_test.rb index 703576db..1cb8c1b2 100644 --- a/test/functional/package/list_test.rb +++ b/test/functional/package/list_test.rb @@ -5,7 +5,6 @@ require_relative '../lifecycle_environment/lifecycle_environment_helpers' require 'hammer_cli_katello/package' -# rubocop:disable ModuleLength module HammerCLIKatello describe PackageCommand::ListCommand do include OrganizationHelpers diff --git a/test/functional/repository/update_test.rb b/test/functional/repository/update_test.rb index 1bec049d..58eb29e4 100644 --- a/test/functional/repository/update_test.rb +++ b/test/functional/repository/update_test.rb @@ -2,7 +2,7 @@ require_relative '../organization/organization_helpers' require 'hammer_cli_katello/repository' -module HammerCLIKatello # rubocop:disable Metrics/ModuleLength +module HammerCLIKatello describe Repository::UpdateCommand do include OrganizationHelpers