From ab11857bc0f1b5fd43071ca641c079fc590f35c0 Mon Sep 17 00:00:00 2001 From: Peter Siegel Date: Sun, 2 Feb 2025 13:34:35 +0100 Subject: [PATCH] fix: format --- plugins/connection/lxd.py | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/plugins/connection/lxd.py b/plugins/connection/lxd.py index 97db7160ef..7eb280c84f 100644 --- a/plugins/connection/lxd.py +++ b/plugins/connection/lxd.py @@ -161,23 +161,25 @@ class Connection(ConnectionBase): return process.returncode, stdout, stderr - def _get_remote_uid_gid(self) -> tuple[int, int]: """Get the user and group id of 'remote_user' from the instance.""" rc, uid_out, err = self.exec_command("/bin/id -u") if rc != 0: - raise AnsibleError(f"Failed to get remote uid for user {self.get_option('remote_user')}: {err}") + raise AnsibleError( + f"Failed to get remote uid for user {self.get_option('remote_user')}: {err}" + ) uid = uid_out.strip() rc, gid_out, err = self.exec_command("/bin/id -g") if rc != 0: - raise AnsibleError(f"Failed to get remote gid for user {self.get_option('remote_user')}: {err}") + raise AnsibleError( + f"Failed to get remote gid for user {self.get_option('remote_user')}: {err}" + ) gid = gid_out.strip() return int(uid), int(gid) - def put_file(self, in_path, out_path): """ put a file from local to lxd """ super(Connection, self).put_file(in_path, out_path) @@ -193,13 +195,20 @@ class Connection(ConnectionBase): uid, gid = (-1, -1) if self.get_option("remote_user") != "root": - uid, gid = self._get_remote_uid_gid() + uid, gid = self._get_remote_uid_gid() - local_cmd.extend([ - "file", "push", "--uid", str(uid), "--gid", str(gid), - in_path, - f"{self.get_option('remote')}:{self._host()}/{out_path}" - ]) + local_cmd.extend( + [ + "file", + "push", + "--uid", + str(uid), + "--gid", + str(gid), + in_path, + f"{self.get_option('remote')}:{self._host()}/{out_path}", + ] + ) self._display.vvvvv(f"PUT COMMAND {local_cmd}", host=self._host())