Example #1
0
 def delete_image(self, image, force=False):
     """
     Delete image
     :param image:
     :param force:
     :return:
     """
     assert(image is not None)
     cmd = ["rmi"]
     if force:
         cmd.append("-f")
     cmd.append(image)
     util.kpod(cmd)
Example #2
0
 def delete_image(self, image, force=False):
     """
     Delete image
     :param image:
     :param force:
     :return:
     """
     assert (image is not None)
     cmd = ["rmi"]
     if force:
         cmd.append("-f")
     cmd.append(image)
     util.kpod(cmd)
Example #3
0
 def get_containers(self):
     """
     Get containers for the backend
     :return: list of container objects
     """
     containers = json.loads(util.kpod(["ps", "-a", "--format", "json"]))
     container_objects = []
     for container in containers:
         container_objects.append(self._make_container(container['id'], container))
     return container_objects
Example #4
0
 def get_images(self, get_all=False):
     """
     Get images for the backend
     :param get_all: bool
     :return:  list of image objects
     """
     images = json.loads(util.kpod(["images", "--format", "json"]))
     image_objects = []
     for image in images:
         image_objects.append(self._make_image(image['id'], image))
     return image_objects
Example #5
0
 def get_containers(self):
     """
     Get containers for the backend
     :return: list of container objects
     """
     containers = json.loads(util.kpod(["ps", "-a", "--format", "json"]))
     container_objects = []
     for container in containers:
         container_objects.append(
             self._make_container(container['id'], container))
     return container_objects
Example #6
0
 def get_images(self, get_all=False):
     """
     Get images for the backend
     :param get_all: bool
     :return:  list of image objects
     """
     images = json.loads(util.kpod(["images", "--format", "json"]))
     image_objects = []
     for image in images:
         image_objects.append(self._make_image(image['id'], image))
     return image_objects
Example #7
0
 def _inspect_container(self, container):
     return json.loads(util.kpod(['inspect', container]))
Example #8
0
 def _inspect_image(self, image):
     return json.loads(util.kpod(['inspect', image]))
Example #9
0
 def tag_image(self, _src, _dest):
     cmd = ['tag', _src, _dest]
     return util.kpod(cmd)
Example #10
0
 def stop_container(self, con_obj, **kwargs):
     # If we plant to honor stop labels here, we will
     # need to implement that when kpod exec is available.
     return util.kpod(["stop", con_obj.id])
Example #11
0
 def get_dangling_images(self):
     images = json.loads(
         util.kpod(
             ["images", "--filter", "dangling=true", "--format", "json"]))
     return [x['id'] for x in images]
Example #12
0
 def _inspect_container(self, container):
     return json.loads(util.kpod(['inspect', container]))
Example #13
0
 def _inspect_image(self, image):
     return json.loads(util.kpod(['inspect', image]))
Example #14
0
 def tag_image(self, _src, _dest):
     cmd = ['tag', _src, _dest]
     return util.kpod(cmd)
Example #15
0
 def get_dangling_images(self):
     images = json.loads(util.kpod(["images", "--filter", "dangling=true", "--format", "json"]))
     return [x['id'] for x in images]