Skip to content

Commit

Permalink
Merge pull request #33 from yast/no-virtualsize
Browse files Browse the repository at this point in the history
Fix Internal Error with docker 25.0.0
  • Loading branch information
mvidner authored Apr 17, 2024
2 parents ec61f1f + 56a1443 commit 959932b
Show file tree
Hide file tree
Showing 10 changed files with 47 additions and 35 deletions.
5 changes: 4 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# use the shared Yast defaults
inherit_from:
- /usr/share/YaST2/data/devtools/data/rubocop_yast_style.yml
- /usr/share/YaST2/data/devtools/data/rubocop-1.24.1_yast_style.yml
- .rubocop_todo.yml

Style/FrozenStringLiteralComment:
Enabled: false
3 changes: 3 additions & 0 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ Metrics/ClassLength:
Metrics/CyclomaticComplexity:
Max: 14

Metrics/BlockLength:
Max: 35

# Offense count: 1
# Configuration parameters: CountComments.
Metrics/MethodLength:
Expand Down
7 changes: 7 additions & 0 deletions package/yast2-docker.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Thu Apr 11 09:10:02 UTC 2024 - Martin Vidner <[email protected]>

- Fix Internal Error with docker 25.0.0 due to VirtualSize removal
from images API (bsc#1222668, gh#yast/yast-docker#32)
- 5.0.1

-------------------------------------------------------------------
Wed Aug 30 20:16:10 UTC 2023 - Josef Reidinger <[email protected]>

Expand Down
2 changes: 1 addition & 1 deletion package/yast2-docker.spec
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
######################################################################

Name: yast2-docker
Version: 5.0.0
Version: 5.0.1
Release: 0
Summary: YaST2 - GUI for docker management
Group: System/YaST
Expand Down
17 changes: 8 additions & 9 deletions src/lib/ydocker/changes_dialog.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def run
return unless create_dialog

begin
return controller_loop
controller_loop
ensure
close_dialog
end
Expand All @@ -48,14 +48,13 @@ def close_dialog
end

def controller_loop
loop do
input = Yast::UI.UserInput
case input
when :ok, :cancel
return :ok
else
raise "Unknown action #{input}"
end
# no need to loop, one shot is enough
input = Yast::UI.UserInput
case input
when :ok, :cancel
:ok
else
raise "Unknown action #{input}"
end
end

Expand Down
2 changes: 1 addition & 1 deletion src/lib/ydocker/commit_dialog.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def run
return unless create_dialog

begin
return controller_loop
controller_loop
ensure
close_dialog
end
Expand Down
26 changes: 12 additions & 14 deletions src/lib/ydocker/inject_shell_dialog.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def run
return unless create_dialog

begin
return controller_loop
controller_loop
ensure
close_dialog
end
Expand All @@ -50,17 +50,15 @@ def close_dialog
end

def controller_loop
loop do
input = Yast::UI.UserInput
case input
when :ok
attach
return
when :cancel
return
else
raise "Unknown action #{input}"
end
# no need to loop, one shot is enough
input = Yast::UI.UserInput
case input
when :ok
attach
when :cancel
nil
else
raise "Unknown action #{input}"
end
end

Expand Down Expand Up @@ -116,9 +114,9 @@ def attach
" || (echo \"Failed to attach. Will close window in 5 seconds\";sleep 5)"

Yast::Execute.locally!("xterm", "-e", command)
rescue Cheetah::ExecutionFailed => error
rescue Cheetah::ExecutionFailed => e
Yast::Popup.Error(
format(_("Failed to run terminal. Error: %{error}"), error: error.message)
format(_("Failed to run terminal. Error: %{error}"), error: e.message)
)
end
end
Expand Down
12 changes: 8 additions & 4 deletions src/lib/ydocker/main_dialog.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def run
return unless create_dialog

begin
return controller_loop
controller_loop
ensure
close_dialog
end
Expand All @@ -75,11 +75,11 @@ def ensure_docker_run
_("Docker service does not run. Should YaST start docker? Otherwise YaST quits.")
)

return Yast::Service.start("docker")
Yast::Service.start("docker")
else
Yast::Popup.Error(_("Docker service does not run. \
Run this module as root or start docker service manually."))
return false
false
end
end

Expand Down Expand Up @@ -155,17 +155,21 @@ def selected_container

def stop_container
return unless Yast::Popup.YesNo(_("Do you really want to stop the running container?"))

selected_container.stop!
return unless Yast::Popup.YesNo(_("Do you want to remove the container?"))

selected_container.delete

redraw_containers
end

def kill_container
return unless Yast::Popup.YesNo(_("Do you really want to kill the running container?"))

selected_container.kill!
return unless Yast::Popup.YesNo(_("Do you want to remove the container?"))

selected_container.delete

redraw_containers
Expand Down Expand Up @@ -275,7 +279,7 @@ def images_items
tag,
image.id.slice(0, 12),
DateTime.strptime(image.info["Created"].to_s, "%s").to_s,
Y2Storage::DiskSize.new(image.info["VirtualSize"]).to_human_string
Y2Storage::DiskSize.new(image.info["Size"]).to_human_string
)
end
end
Expand Down
2 changes: 1 addition & 1 deletion src/lib/ydocker/run_image_dialog.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def run
return unless create_dialog

begin
return controller_loop
controller_loop
ensure
close_dialog
end
Expand Down
6 changes: 2 additions & 4 deletions test/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# encoding: utf-8

# ------------------------------------------------------------------------------
# Copyright (c) 2017 SUSE LLC
#
Expand All @@ -19,7 +17,7 @@
# current contact information at www.suse.com.
# ------------------------------------------------------------------------------

$LOAD_PATH.unshift(File.expand_path("../../src/lib", __FILE__))
$LOAD_PATH.unshift(File.expand_path("../src/lib", __dir__))

RSpec.configure do |config|
config.mock_with :rspec do |c|
Expand All @@ -36,7 +34,7 @@
end

# track all ruby files under src
src_location = File.expand_path("../../src", __FILE__)
src_location = File.expand_path("../src", __dir__)
SimpleCov.track_files("#{src_location}/**/*.rb")

# additionally use the LCOV format for on-line code coverage reporting at CI
Expand Down

0 comments on commit 959932b

Please sign in to comment.