mirror of
https://github.com/docker/compose.git
synced 2025-07-26 23:24:05 +02:00
Use print function
This commit is contained in:
parent
3c91315426
commit
30ea4508c3
@ -112,7 +112,7 @@ class TopLevelCommand(Command):
|
|||||||
Usage: logs [SERVICE...]
|
Usage: logs [SERVICE...]
|
||||||
"""
|
"""
|
||||||
containers = self.project.containers(service_names=options['SERVICE'], stopped=False)
|
containers = self.project.containers(service_names=options['SERVICE'], stopped=False)
|
||||||
print "Attaching to", list_containers(containers)
|
print("Attaching to", list_containers(containers))
|
||||||
LogPrinter(containers, attach_params={'logs': True}).run()
|
LogPrinter(containers, attach_params={'logs': True}).run()
|
||||||
|
|
||||||
def ps(self, options):
|
def ps(self, options):
|
||||||
@ -128,7 +128,7 @@ class TopLevelCommand(Command):
|
|||||||
|
|
||||||
if options['-q']:
|
if options['-q']:
|
||||||
for container in containers:
|
for container in containers:
|
||||||
print container.id
|
print(container.id)
|
||||||
else:
|
else:
|
||||||
headers = [
|
headers = [
|
||||||
'Name',
|
'Name',
|
||||||
@ -144,7 +144,7 @@ class TopLevelCommand(Command):
|
|||||||
container.human_readable_state,
|
container.human_readable_state,
|
||||||
container.human_readable_ports,
|
container.human_readable_ports,
|
||||||
])
|
])
|
||||||
print Formatter().table(headers, rows)
|
print(Formatter().table(headers, rows))
|
||||||
|
|
||||||
def rm(self, options):
|
def rm(self, options):
|
||||||
"""
|
"""
|
||||||
@ -156,11 +156,11 @@ class TopLevelCommand(Command):
|
|||||||
stopped_containers = [c for c in all_containers if not c.is_running]
|
stopped_containers = [c for c in all_containers if not c.is_running]
|
||||||
|
|
||||||
if len(stopped_containers) > 0:
|
if len(stopped_containers) > 0:
|
||||||
print "Going to remove", list_containers(stopped_containers)
|
print("Going to remove", list_containers(stopped_containers))
|
||||||
if yesno("Are you sure? [yN] ", default=False):
|
if yesno("Are you sure? [yN] ", default=False):
|
||||||
self.project.remove_stopped(service_names=options['SERVICE'])
|
self.project.remove_stopped(service_names=options['SERVICE'])
|
||||||
else:
|
else:
|
||||||
print "No stopped containers"
|
print("No stopped containers")
|
||||||
|
|
||||||
def run(self, options):
|
def run(self, options):
|
||||||
"""
|
"""
|
||||||
@ -180,7 +180,7 @@ class TopLevelCommand(Command):
|
|||||||
container = service.create_container(one_off=True, **container_options)
|
container = service.create_container(one_off=True, **container_options)
|
||||||
if options['-d']:
|
if options['-d']:
|
||||||
service.start_container(container, ports=None)
|
service.start_container(container, ports=None)
|
||||||
print container.name
|
print(container.name)
|
||||||
else:
|
else:
|
||||||
with self._attach_to_container(
|
with self._attach_to_container(
|
||||||
container.id,
|
container.id,
|
||||||
@ -222,7 +222,7 @@ class TopLevelCommand(Command):
|
|||||||
containers = self.project.containers(service_names=options['SERVICE'], stopped=True)
|
containers = self.project.containers(service_names=options['SERVICE'], stopped=True)
|
||||||
|
|
||||||
if not detached:
|
if not detached:
|
||||||
print "Attaching to", list_containers(containers)
|
print("Attaching to", list_containers(containers))
|
||||||
log_printer = LogPrinter(containers)
|
log_printer = LogPrinter(containers)
|
||||||
|
|
||||||
self.project.start(service_names=options['SERVICE'])
|
self.project.start(service_names=options['SERVICE'])
|
||||||
@ -236,7 +236,7 @@ class TopLevelCommand(Command):
|
|||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
signal.signal(signal.SIGINT, handler)
|
signal.signal(signal.SIGINT, handler)
|
||||||
|
|
||||||
print "Gracefully stopping... (press Ctrl+C again to force)"
|
print("Gracefully stopping... (press Ctrl+C again to force)")
|
||||||
self.project.stop(service_names=options['SERVICE'])
|
self.project.stop(service_names=options['SERVICE'])
|
||||||
|
|
||||||
def _attach_to_container(self, container_id, interactive, logs=False, stream=True, raw=False):
|
def _attach_to_container(self, container_id, interactive, logs=False, stream=True, raw=False):
|
||||||
|
@ -123,7 +123,7 @@ if __name__ == '__main__':
|
|||||||
url = sys.argv[1]
|
url = sys.argv[1]
|
||||||
socket = websocket.create_connection(url)
|
socket = websocket.create_connection(url)
|
||||||
|
|
||||||
print "connected\r"
|
print("connected\r")
|
||||||
|
|
||||||
with SocketClient(socket, interactive=True) as client:
|
with SocketClient(socket, interactive=True) as client:
|
||||||
client.run()
|
client.run()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user