Skip to content

Commit

Permalink
Restart command
Browse files Browse the repository at this point in the history
  • Loading branch information
dvolodin7 committed Oct 1, 2024
1 parent 1c552f1 commit 0998509
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ To see unreleased changes, please see the [CHANGELOG on the master branch](https

* Do not raise exception when cannot start browser.

### Added

* `restart` command.

## 0.6.0 - 2024-08-05

### Added
Expand Down
2 changes: 1 addition & 1 deletion src/gufo/thor/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ def handle_restart(self: "Cli", ns: argparse.Namespace) -> ExitCode:
r = self.handle_prepare(ns)
if r != ExitCode.OK:
return r
if not docker.restart(ns.services):
if not docker.restart(*ns.services):
return ExitCode.ERR
return ExitCode.OK

Expand Down
13 changes: 13 additions & 0 deletions src/gufo/thor/docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,19 @@ def stop(self: "Docker") -> bool:
logger.warning("Stopping containers")
return self._commpose_command("stop")

def restart(self: "Docker", *args: str) -> bool:
"""
Perform services restart.
Returns:
True: if command executed successfully.
False: otherwise.
"""
logger.warning("Restarting containers: %s", ", ".join(args))
return self._commpose_command(
*("stop", *args)
) and self._commpose_command(*("up", "-d", *args))

def shell(self: "Docker") -> bool:
"""
Run shell in container.
Expand Down

0 comments on commit 0998509

Please sign in to comment.