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
[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
[x] 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.
[x] Separate lab options from global machine metadata.
[x] 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
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 exampleLab.new_machine(self, name: str, **kwargs: Dict[str, Any])
gives a warning in PyCharmManager
methodcopy_files(self, machine: Machine, guest_to_host: Dict[str, io.IOBase])
,guest_to_host
should beDict[str, Union[str, io.IOBase]]
sinceutils.pack_file_for_tar
acceptsfile_obj
with that type.lab.check_integrity
should be moved insidedeploy_lab
of Managersdeploy_machine
privileged
andlab.ext
) inside the Managers instead of command (otherwise it is not raised by API). Forlab.ext
it should also be done in_attach_external_interfaces
inDockerLink
. Forprivileged
it should also be done inDockerManager
.connect_tty_obj
that takesMachine
object instead of name and no lab params, that internally calls theconnect_tty
with the right paramsexec_obj
that takesMachine
object instead of name and no lab params, that internally calls theexec
with the right paramsget_machine_stats_obj
that takesMachine
object instead of name and no lab params, that internally calls theget_machine_stats
with the right paramsget_link_stats_obj
that takesLink
object instead of name and no lab params, that internally calls theget_link_stats
with the right paramsstream=True/False
parameter inexec
that, ifFalse
, unrolls the stream and returns thebytes
results.PrivilegeError
ofmachine_stats
ifall_users=True
is now inListCommand
FilesystemMixin
should also take a Regex instead of a string