mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-04-24 20:59:16 +00:00
[PR #11341/5b5f7e9e backport][stable-12] batch 1 - update Python idiom to 3.7 using pyupgrade (#11349)
batch 1 - update Python idiom to 3.7 using pyupgrade (#11341)
* batch 1 - update Python idiom to 3.7 using pyupgrade
* add changelog frag
* add changelog frag
(cherry picked from commit 5b5f7e9e64)
Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
This commit is contained in:
parent
41f815be57
commit
2d07481e64
19 changed files with 48 additions and 29 deletions
|
|
@ -200,7 +200,7 @@ class Connection(ConnectionBase):
|
|||
raise AnsibleError(f"failed to transfer file {in_path} to {out_path}") from e
|
||||
if p.returncode != 0:
|
||||
raise AnsibleError(f"failed to transfer file {in_path} to {out_path}:\n{stdout}\n{stderr}")
|
||||
except IOError as e:
|
||||
except OSError as e:
|
||||
raise AnsibleError(f"file or module does not exist at: {in_path}") from e
|
||||
|
||||
def fetch_file(self, in_path, out_path):
|
||||
|
|
|
|||
|
|
@ -172,7 +172,7 @@ class Connection(ConnectionBase):
|
|||
raise AnsibleError(
|
||||
f"failed to transfer file {in_path} to {out_path}:\n{to_native(stdout)}\n{to_native(stderr)}"
|
||||
)
|
||||
except IOError as e:
|
||||
except OSError as e:
|
||||
raise AnsibleError(f"file or module does not exist at: {in_path}") from e
|
||||
|
||||
def fetch_file(self, in_path, out_path):
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ class Connection(ConnectionBase):
|
|||
while len(read_fds) > 0 or len(write_fds) > 0:
|
||||
try:
|
||||
ready_reads, ready_writes, dummy = select.select(read_fds, write_fds, [])
|
||||
except select.error as e:
|
||||
except OSError as e:
|
||||
if e.args[0] == errno.EINTR:
|
||||
continue
|
||||
raise
|
||||
|
|
@ -173,7 +173,7 @@ class Connection(ConnectionBase):
|
|||
raise errors.AnsibleFileNotFound(msg)
|
||||
try:
|
||||
src_file = open(in_path, "rb")
|
||||
except IOError as e:
|
||||
except OSError as e:
|
||||
traceback.print_exc()
|
||||
raise errors.AnsibleError(f"failed to open input file to {in_path}") from e
|
||||
try:
|
||||
|
|
@ -184,7 +184,7 @@ class Connection(ConnectionBase):
|
|||
|
||||
try:
|
||||
self.container.attach_wait(write_file, None)
|
||||
except IOError as e:
|
||||
except OSError as e:
|
||||
traceback.print_exc()
|
||||
msg = f"failed to transfer file to {out_path}"
|
||||
raise errors.AnsibleError(msg) from e
|
||||
|
|
@ -200,7 +200,7 @@ class Connection(ConnectionBase):
|
|||
|
||||
try:
|
||||
dst_file = open(out_path, "wb")
|
||||
except IOError as e:
|
||||
except OSError as e:
|
||||
traceback.print_exc()
|
||||
msg = f"failed to open output file {out_path}"
|
||||
raise errors.AnsibleError(msg) from e
|
||||
|
|
@ -217,7 +217,7 @@ class Connection(ConnectionBase):
|
|||
|
||||
try:
|
||||
self.container.attach_wait(write_file, None)
|
||||
except IOError as e:
|
||||
except OSError as e:
|
||||
traceback.print_exc()
|
||||
msg = f"failed to transfer file from {in_path} to {out_path}"
|
||||
raise errors.AnsibleError(msg) from e
|
||||
|
|
|
|||
|
|
@ -475,7 +475,7 @@ class Connection(ConnectionBase):
|
|||
try:
|
||||
ssh.load_system_host_keys(ssh_known_hosts)
|
||||
break
|
||||
except IOError:
|
||||
except OSError:
|
||||
pass # file was not found, but not required to function
|
||||
except paramiko.hostkeys.InvalidHostKey as e:
|
||||
raise AnsibleConnectionFailure(f"Invalid host key: {to_text(e.line)}") from e
|
||||
|
|
|
|||
|
|
@ -169,7 +169,7 @@ class Connection(ConnectionBase):
|
|||
raise AnsibleError(f"failed to transfer file {in_path} to {out_path}") from e
|
||||
if p.returncode != 0:
|
||||
raise AnsibleError(f"failed to transfer file {in_path} to {out_path}:\n{stdout}\n{stderr}")
|
||||
except IOError as e:
|
||||
except OSError as e:
|
||||
raise AnsibleError(f"file or module does not exist at: {in_path}") from e
|
||||
|
||||
def fetch_file(self, in_path, out_path):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue