Пример #1
0
 def list_container_images(self, request, context):
     print("Handling list_container_images call")
     config = Kconfig()
     # cont = Kcontainerconfig(config, client=args.containerclient).cont
     cont = Kcontainerconfig(config).cont
     response = kcli_pb2.imageslist(images=cont.list_images())
     return response
Пример #2
0
 def stop_container(self, request, context):
     print("Handling stop_container call for:\n%s" % request)
     config = Kconfig()
     cont = Kcontainerconfig(config).cont
     result = cont.stop_container(request.container)
     response = kcli_pb2.result(**result)
     return response
Пример #3
0
 def list_containers(self, request, context):
     print("Handling list_containers call")
     config = Kconfig()
     # cont = Kcontainerconfig(config, client=args.containerclient).cont
     cont = Kcontainerconfig(config).cont
     containers = []
     for container in cont.list_containers():
         newcontainer = {}
         newcontainer['container'] = container[0]
         newcontainer['status'] = container[1]
         newcontainer['image'] = container[2]
         newcontainer['plan'] = container[3]
         newcontainer['command'] = container[4]
         newcontainer['ports'] = container[5]
         newcontainer['deploy'] = container[6]
         containers.append(kcli_pb2.container(**newcontainer))
     response = kcli_pb2.containerslist(containers=containers)
     return response