|
2 | 2 | # @author Sébastien BEAU <[email protected]>
|
3 | 3 | # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
4 | 4 |
|
| 5 | +import subprocess |
5 | 6 | from plumbum import cli
|
6 | 7 | from .base import Docky, DockySub
|
7 | 8 | from ..common.api import raise_error
|
@@ -78,7 +79,24 @@ class DockyOpen(DockyExec):
|
78 | 79 |
|
79 | 80 | def _main(self, *optionnal_command_line):
|
80 | 81 | super()._main(*optionnal_command_line)
|
81 |
| - self._exec("dcpatched", ["exec", "-e", "NOGOSU=True", self.service] + self.cmd) |
| 82 | + # self._exec("dcpatched", ["exec", "-e", "NOGOSU=True", self.service] + self.cmd) |
| 83 | + |
| 84 | + # Get Project Name |
| 85 | + # Example: docky-odoo-brasil-14 odoo |
| 86 | + project_name = self.project.name + "-" + self.project.service |
| 87 | + |
| 88 | + # Get User |
| 89 | + user = self._use_specific_user(self.service) |
| 90 | + |
| 91 | + # Get Container ID |
| 92 | + command = "docker ps -aqf name=" + project_name |
| 93 | + # Example of return value |
| 94 | + # b'b5db9db21381\n' |
| 95 | + # Option text=true return as string instead of bytes and strip remove break line |
| 96 | + # TODO: Is there a better way to do it, for example with Plumbum? |
| 97 | + container_id = subprocess.check_output(command, shell=True,text=True).strip() |
| 98 | + |
| 99 | + self._exec("docker", ["exec", "-u", user, "-it", container_id, "/bin/bash"]) |
82 | 100 |
|
83 | 101 | @Docky.subcommand("system")
|
84 | 102 | class DockySystem(DockyExec):
|
|
0 commit comments