-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[REF] Adapted 'docky open' command for Docker Compose V2.
- Loading branch information
Showing
1 changed file
with
19 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
# @author Sébastien BEAU <[email protected]> | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
import subprocess | ||
from plumbum import cli | ||
from .base import Docky, DockySub | ||
from ..common.api import raise_error | ||
|
@@ -78,7 +79,24 @@ class DockyOpen(DockyExec): | |
|
||
def _main(self, *optionnal_command_line): | ||
super()._main(*optionnal_command_line) | ||
self._exec("dcpatched", ["exec", "-e", "NOGOSU=True", self.service] + self.cmd) | ||
# self._exec("dcpatched", ["exec", "-e", "NOGOSU=True", self.service] + self.cmd) | ||
|
||
# Get Project Name | ||
# Example: docky-odoo-brasil-14 odoo | ||
project_name = self.project.name + "-" + self.project.service | ||
|
||
# Get User | ||
user = self._use_specific_user(self.service) | ||
|
||
# Get Container ID | ||
command = "docker ps -aqf name=" + project_name | ||
# Example of return value | ||
# b'b5db9db21381\n' | ||
# Option text=true return as string instead of bytes and strip remove break line | ||
# TODO: Is there a better way to do it, for example with Plumbum? | ||
container_id = subprocess.check_output(command, shell=True,text=True).strip() | ||
|
||
self._exec("docker", ["exec", "-u", user, "-it", container_id, "/bin/bash"]) | ||
|
||
@Docky.subcommand("system") | ||
class DockySystem(DockyExec): | ||
|