Source code for reemote.facts.inventory.get_password
# Copyright (c) 2025 Kim Jarvis TPF Software Services S.A. kim.jarvis@tpfsystems.com # This software is licensed under the MIT License. See the LICENSE file for details.#fromreemote.commandimportCommand
[docs]classGet_password:"""A reemote command to retrieve a host's password from the execution context. This class is designed to be used within a reemote execution plan. It encapsulates the logic for securely accessing the password associated with a host, which is stored in the `host_info` dictionary provided by the reemote runner. When `execute` is called, it yields a local `Command` that uses an internal callback to perform the password retrieval. """def__repr__(self):returnf"Get_password()"@staticmethodasyncdef_get_password_callback(host_info,global_info,command,cp,caller):returnhost_info["password"]defexecute(self):r=yieldCommand(f"{self}",local=True,callback=self._get_password_callback,caller=self)