mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 14:22:46 +00:00
[PR #11346/61d794f1 backport][stable-12] incus conn plugin: improve readability (was ruff: set target-python 3.7) (#11353)
incus conn plugin: improve readability (was ruff: set target-python 3.7) (#11346)
* incus connection plugin: improve readability
* add changelog frag
* Update plugins/connection/incus.py
* Update plugins/connection/incus.py
* Update plugins/connection/incus.py
---------
(cherry picked from commit 61d794f171)
Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
2
changelogs/fragments/11346-incus-readability.yml
Normal file
2
changelogs/fragments/11346-incus-readability.yml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
minor_changes:
|
||||||
|
- incus connection plugin - improve code readability (https://github.com/ansible-collections/community.general/pull/11346).
|
||||||
@@ -142,10 +142,12 @@ class Connection(ConnectionBase):
|
|||||||
]
|
]
|
||||||
|
|
||||||
if getattr(self._shell, "_IS_WINDOWS", False):
|
if getattr(self._shell, "_IS_WINDOWS", False):
|
||||||
if (
|
if regex_match := self.powershell_regex_pattern.match(cmd):
|
||||||
(regex_match := self.powershell_regex_pattern.match(cmd))
|
regex_pattern = self.powershell_regex_pattern
|
||||||
and (regex_pattern := self.powershell_regex_pattern)
|
elif regex_match := self.cmd_regex_pattern.match(cmd):
|
||||||
) or ((regex_match := self.cmd_regex_pattern.match(cmd)) and (regex_pattern := self.cmd_regex_pattern)):
|
regex_pattern = self.cmd_regex_pattern
|
||||||
|
|
||||||
|
if regex_match:
|
||||||
self._display.vvvvvv(
|
self._display.vvvvvv(
|
||||||
f'Found keyword: "{regex_match.group("command")}" based on regex: {regex_pattern.pattern}',
|
f'Found keyword: "{regex_match.group("command")}" based on regex: {regex_pattern.pattern}',
|
||||||
host=self._instance(),
|
host=self._instance(),
|
||||||
|
|||||||
Reference in New Issue
Block a user