fix: rethrow JSONDecodeError after printing the undecodable value as a warning
This commit is contained in:
parent
35a27b7685
commit
4781e088a3
1 changed files with 5 additions and 1 deletions
|
@ -23,7 +23,11 @@ class CloudflareHandler(Handler):
|
||||||
env = os.environ.copy()
|
env = os.environ.copy()
|
||||||
env['CF_API_TOKEN'] = self.secret
|
env['CF_API_TOKEN'] = self.secret
|
||||||
res = subprocess.run(['flarectl', '--json'] + args, check=True, stdout=subprocess.PIPE, env=env)
|
res = subprocess.run(['flarectl', '--json'] + args, check=True, stdout=subprocess.PIPE, env=env)
|
||||||
|
try:
|
||||||
return json.loads(res.stdout)
|
return json.loads(res.stdout)
|
||||||
|
except json.decoder.JSONDecodeError as ex:
|
||||||
|
self.log.warning('could not decode as JSON: %s', res.stdout)
|
||||||
|
raise ex
|
||||||
|
|
||||||
def create(self, record_name: str, record_value: str) -> None:
|
def create(self, record_name: str, record_value: str) -> None:
|
||||||
full_record_name = record_name + '.' + self.zone
|
full_record_name = record_name + '.' + self.zone
|
||||||
|
|
Loading…
Reference in a new issue