def test_guess_shell_bash(self): stop_remove_container('pytest') docker_actions.get_client().containers.run( 'edyan/php:7.2', detach=True, name='pytest') shell = docker_actions.guess_shell('pytest') self.assertEqual('/bin/bash', shell) stop_remove_container('pytest')
def console(self, container: str, user: str, tty: bool): """Enter a container (stakkr allows only apache / php and mysql)""" docker_actions.check_cts_are_running(self.project_name) tty = 't' if tty is True else '' ct_name = docker_actions.get_ct_name(container) cmd = ['docker', 'exec', '-u', user, '-i' + tty] cmd += [docker_actions.get_ct_name(container), docker_actions.guess_shell(ct_name)] subprocess.call(cmd) command.verbose(self.context['VERBOSE'], 'Command : "' + ' '.join(cmd) + '"')
def console(self, container: str, user: str, tty: bool): """Enter a container. Stakkr will try to guess the right shell.""" docker.check_cts_are_running(self.project_name) tty = 't' if tty is True else '' ct_name = docker.get_ct_name(container) cmd = ['docker', 'exec', '-u', user, '-i' + tty] cmd += [docker.get_ct_name(container), docker.guess_shell(ct_name)] subprocess.call(cmd) command.verbose(self.context['VERBOSE'], 'Command : "' + ' '.join(cmd) + '"')
def console(self, container: str, user: str, tty: bool): """Enter a container. Stakkr will try to guess the right shell.""" self.init_project() docker.check_cts_are_running(self.project_name) tty = 't' if tty is True else '' ct_name = docker.get_ct_name(container) cmd = ['docker', 'exec', '-u', user, '-i' + tty] cmd += [docker.get_ct_name(container), docker.guess_shell(ct_name)] subprocess.call(cmd) command.verbose(self.context['VERBOSE'], 'Command : "' + ' '.join(cmd) + '"')
def test_guess_shell_bash(self): try: exec_cmd(['docker', 'stop', 'pytest']) except: pass cmd = ['docker', 'run', '-d', '--rm', '--name', 'pytest', 'nginx'] exec_cmd(cmd) shell = docker_actions.guess_shell('pytest') self.assertEqual('/bin/bash', shell) exec_cmd(['docker', 'stop', 'pytest'])
def console(self, container: str, user: str, tty: bool): """Enter a container (stakkr allows only apache / php and mysql)""" docker_actions.check_cts_are_running(self.project_name) tty = 't' if tty is True else '' ct_name = docker_actions.get_ct_name(container) cmd = ['docker', 'exec', '-u', user, '-i' + tty] cmd += [ docker_actions.get_ct_name(container), docker_actions.guess_shell(ct_name) ] subprocess.call(cmd) command.verbose(self.context['VERBOSE'], 'Command : "' + ' '.join(cmd) + '"')