Skip to content

API Improvements #271

@tcaiazzi

Description

@tcaiazzi

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

  • **kwargs should not have type, for example Lab.new_machine(self, name: str, **kwargs: Dict[str, Any]) gives a warning in PyCharm
    Image
  • 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.
  • lab.check_integrity should be moved inside deploy_lab of Managers
  • 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.
  • 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
  • Add exec_obj that takes Machine object instead of name and no lab params, that internally calls the exec with the right params
  • 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
  • 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
  • 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
  • add_line_before/after of FilesystemMixin should also take a Regex instead of a string

Metadata

Metadata

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions