def clean(self, config_file): self._setup_parser(config_file) if is_in_image_store(self._result()): logging.info(("Removing '{}' from image store." ).format(self._result())) delete_image(self._result()) print_success("Removed {} from image store.".format(self._result()))
def _clean(self): if is_in_image_store(self._result()): logging.info(("Removing '{}' from image store." ).format(self._result())) delete_image(self._result()) print_success("Removed {} from image store.".format(self._result())) if self.clean_depth > 0: Stop().clean_recursive(self.config.get_base_config_file(), self.clean_depth - 1)
def _run(self): if is_in_image_store(self._result()): logging.info(("{0} is already in image store. " "Delete it to regenerate it." ).format(self._result())) return self._result() container_name = Stop().run(self.config.get_base_config_file()) print("Going to publish lxc container in image store.") publish_container(container_name, self._result()) print_success("Published lxc container in image store as {}.".format(self._result())) return self._result()
def _run(self): if is_in_image_store(self._result()): logging.info( ("{0} is already in image store. " "Delete it to regenerate it.").format(self._result())) return self._result() image = LxcImageCommand().run(self.config.get_base_config_file()) print("Going to import lxc image into image store.") import_image(image, self._result()) print_success("Imported lxc image into image store as {}.".format( self._result())) return self._result()
def run(self, config_file, introspection_method=None): self._setup_parser(config_file) if introspection_method: print(introspection_method()) return self._result() if is_in_image_store(self._result()): logging.info(("{0} is already in image store. " "Delete it to regenerate it." ).format(self._result())) return self._result() image = LxcImageCommand().run(config_file) print("Going to import lxc image into image store.") import_image(image, self._result()) print_success("Imported lxc image into image store as {}.".format(self._result())) return self._result()