Skip to content

Commit

Permalink
fix(ext): Fix restart and start ext commands (#79)
Browse files Browse the repository at this point in the history
  • Loading branch information
xmnlab authored Jun 5, 2023
1 parent ee9fcab commit e9622c3
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions containers_sugar/sugar.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ def run(self):
return getattr(self, f'_{action.replace("-", "_")}')()


class SugarMain(SugarBase):
class SugarDockerCompose(SugarBase):
"""
This is the docker-compose commands that is implemented:
Expand Down Expand Up @@ -384,30 +384,41 @@ def _version(self):
self._call_compose_app('version', services=self.service_names)


class SugarExt(SugarMain):
class SugarExt(SugarDockerCompose):
def __init__(self, *args, **kwargs):
self.actions += [
'start',
'get-ip',
'restart',
'start',
'wait',
]

super().__init__(*args, **kwargs)

def _start(self):
self._up()

def _get_ip(self):
self._print_error('[EE] `get-ip` mot implemented yet.')
os._exit(1)

def _restart(self):
options = self.options_args
self.options_args = []
self._stop()
self.options_args = options
self._start()

def _start(self):
self._up()

def _wait(self):
self._print_error('[EE] `wait` not implemented yet.')
os._exit(1)


class Sugar(SugarBase, PrintPlugin):
plugins_definition: Dict[str, type] = {'main': SugarMain, 'ext': SugarExt}
plugins_definition: Dict[str, type] = {
'main': SugarDockerCompose,
'ext': SugarExt,
}
plugin: Optional[SugarBase] = None

def __init__(
Expand Down

0 comments on commit e9622c3

Please sign in to comment.