Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hw15/enavarro #14

Closed
wants to merge 22 commits into from
Closed

Hw15/enavarro #14

wants to merge 22 commits into from

Conversation

eduardoj
Copy link
Contributor

Improve yast-docker module for basic docker operations. With this changes you can:

  • Pull images
  • Run containers with options (name, hostname, link, volumes,...)
  • Start/stop/see changes/inject terminal on containers

This was made during hackweek 15 to perform graphic installation of openQA.

Pair programming with @SergioAtSUSE

return unless (Yast::Popup.YesNo(_("Do you want to remove the container?")))
selected_container.delete
def start_container
return unless (Yast::Popup.YesNo(_("Do you really want to start the container?")))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this question needed? I think start is non-problematic operation, as you can easily undo it by kiling it ( which is opposite to stop/kill which is harder to undo and can cause operation corruption

selected_container.stop!
redraw_containers
end
if Yast::Popup.YesNo(_("Do you want to remove the container?"))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does it make sense if answers are "no" and "yes"? it means that you do not stop container but remove it

selected_container.kill!
redraw_containers
end
if Yast::Popup.YesNo(_("Do you want to remove the container?"))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same question here.

Yast::UI.ChangeWidget(:container_start, :Enabled, status != 'running')
Yast::UI.ChangeWidget(:container_changes, :Enabled, status == 'running')
Yast::UI.ChangeWidget(:container_inject, :Enabled, status == 'running')
Yast::UI.ChangeWidget(:container_stop, :Enabled, status == 'running')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a bit duplicite, maybe use instead running = selected_container.info['State']['Status'] == "Running" and then use running or !running as all of them check same status.

require "yast"

module YDocker
class PullImageDialog
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JFYI after writting docker we found useful base class for this kind of dialogs, that make code a bit smaller and nicer, so you can use it next time 😉
http://www.rubydoc.info/github/yast/yast-yast2/UI/Dialog

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. Thanks!

class PullImageDialog
include Yast::UIShortcuts
include Yast::I18n
extend Yast::I18n
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why extend is needed? it should not be necessary as all translations are done in instance methods.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why extend is needed? it should not be necessary as all translations are done in instance methods.

Deleted.

include Yast::I18n
extend Yast::I18n

def initialize()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

parens not needed. Maybe time to add rubocop even to yast2-docker? we already use it in some modules and also have shared config with yast unification - see e.g. https://github.com/yast/yast-bootloader/blob/master/.rubocop.yml#L3

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

parens not needed. Maybe time to add rubocop even to yast2-docker? we already use it in some modules and also have shared config with yast unification - see e.g. https://github.com/yast/yast-bootloader/blob/master/.rubocop.yml#L3

Deleted. I will try to do a pull request to include rubocop.

Opt(:notify),
_("Source")
)
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what exactly is this source? if it is path on system, it is possible to have search button there, but if it is some network location. it can be a more tricky.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi :)

It isn't a path on the system. The source is the name of the docker image in docker hub. Also, source is the parameter NAME:TAG in 'docker pull NAME:TAG'.

@jreidinger
Copy link
Member

in general it looks good, just few notes.

@teclator teclator changed the title Hw15/enavarro [WIP] Hw15/enavarro Apr 5, 2017
@teclator
Copy link
Contributor

teclator commented Apr 5, 2017

@eduardoj will try to finish it

@eduardoj eduardoj changed the title [WIP] Hw15/enavarro Hw15/enavarro Nov 10, 2017
@SergioAtSUSE
Copy link

@eduardoj, don't forget to fix the default command of the worker when running a container with multi-parameter in exec-form.

@eduardoj
Copy link
Contributor Author

@SergioAtSUSE:

@eduardoj, don't forget to fix the default command of the worker when running a container with multi-parameter in exec-form.

Done in 7ce09f0.

@eduardoj eduardoj mentioned this pull request Nov 17, 2017
- Obtain the correct command parameter whether:
  - it is not defined
  - it is a string
  - or, it is an array
Change table headers.
Add column port to Ports table.
Run command option is now left aligned.
@teclator
Copy link
Contributor

teclator commented Apr 6, 2018

@eduardoj @SergioAtSUSE the PR seems to look good, but it still needs a changelog entry with a bug number or fate associated with it and also a version increase for being approved, could you check it?

@teclator
Copy link
Contributor

@eduardoj @SergioAtSUSE will close it by now as it has not received any attention during the last year so if you plan to add missing changelog and bump version feel free to reopen it.

@teclator teclator closed this Jul 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants