mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-02-03 23:41:51 +00:00
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 Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/connection/incus.py * Update plugins/connection/incus.py Co-authored-by: Felix Fontein <felix@fontein.de> --------- Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
parent
e8f2b135ba
commit
61d794f171
2 changed files with 8 additions and 4 deletions
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(),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue