summaryrefslogtreecommitdiff
path: root/cloudinit/config/cc_power_state_change.py
diff options
context:
space:
mode:
authorParide Legovini <paride.legovini@canonical.com>2020-08-25 17:21:18 +0200
committerGitHub <noreply@github.com>2020-08-25 09:21:18 -0600
commit07104504ab5b30efd2d1f7a8c36effe18b8e5fe0 (patch)
treec441dddd012f81dad39cfe97821d83bc7ee1a82b /cloudinit/config/cc_power_state_change.py
parent4068137e3ef048d3e2da56a8190f682eb19d501e (diff)
downloadvyos-cloud-init-07104504ab5b30efd2d1f7a8c36effe18b8e5fe0.tar.gz
vyos-cloud-init-07104504ab5b30efd2d1f7a8c36effe18b8e5fe0.zip
tox: bump the pylint version to 2.6.0 in the default run (#544)
Changes: tox: bump the pylint version to 2.6.0 in the default run Fix pylint 2.6.0 W0707 warnings (raise-missing-from)
Diffstat (limited to 'cloudinit/config/cc_power_state_change.py')
-rw-r--r--cloudinit/config/cc_power_state_change.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/cloudinit/config/cc_power_state_change.py b/cloudinit/config/cc_power_state_change.py
index ab953a0d..6fcb8a7d 100644
--- a/cloudinit/config/cc_power_state_change.py
+++ b/cloudinit/config/cc_power_state_change.py
@@ -196,10 +196,11 @@ def load_power_state(cfg, distro_name):
try:
delay = convert_delay(delay, fmt=fmt, scale=scale)
- except ValueError:
+ except ValueError as e:
raise TypeError(
"power_state[delay] must be 'now' or '+m' (minutes)."
- " found '%s'." % delay)
+ " found '%s'." % delay
+ ) from e
args = command + [delay]
if message:
@@ -207,9 +208,10 @@ def load_power_state(cfg, distro_name):
try:
timeout = float(pstate.get('timeout', 30.0))
- except ValueError:
- raise ValueError("failed to convert timeout '%s' to float." %
- pstate['timeout'])
+ except ValueError as e:
+ raise ValueError(
+ "failed to convert timeout '%s' to float." % pstate['timeout']
+ ) from e
condition = pstate.get("condition", True)
if not isinstance(condition, (str, list, bool)):