Kathara icon indicating copy to clipboard operation
Kathara copied to clipboard

API Improvements

Open tcaiazzi opened this issue 1 year ago • 0 comments

The following list outlines several enhancements and fixes required to improve methods and parameters clarity, maintainability, and usability of Python APIs.

  • [x] **kwargs should not have type, for example Lab.new_machine(self, name: str, **kwargs: Dict[str, Any]) gives a warning in PyCharm Image
  • [x] Manager method copy_files(self, machine: Machine, guest_to_host: Dict[str, io.IOBase]), guest_to_host should be Dict[str, Union[str, io.IOBase]] since utils.pack_file_for_tar accepts file_obj with that type.
  • [x] lab.check_integrity should be moved inside deploy_lab of Managers
  • [x] Add device integrity check in deploy_machine
  • [ ] Add privileged checks (both for privileged and lab.ext) inside the Managers instead of command (otherwise it is not raised by API). For lab.ext it should also be done in _attach_external_interfaces in DockerLink. For privileged it should also be done in DockerManager.
  • [x] Add connect_tty_obj that takes Machine object instead of name and no lab params, that internally calls the connect_tty with the right params
  • [x] Add exec_obj that takes Machine object instead of name and no lab params, that internally calls the exec with the right params
  • [x] Add get_machine_stats_obj that takes Machine object instead of name and no lab params, that internally calls the get_machine_stats with the right params
  • [x] Add get_link_stats_obj that takes Link object instead of name and no lab params, that internally calls the get_link_stats with the right params
  • [x] Add stream=True/False parameter in exec that, if False, unrolls the stream and returns the bytes results.
  • [ ] Separate lab options from global machine metadata.
  • [ ] PrivilegeError of machine_stats if all_users=True is now in ListCommand
  • [x] add_line_before/after of FilesystemMixin should also take a Regex instead of a string

tcaiazzi avatar Feb 01 '24 16:02 tcaiazzi