File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change 299
299
import ansible .module_utils .pvesh as pvesh
300
300
import re
301
301
import json
302
- from json import JSONDecodeError , dumps as parse_json
302
+ from json import JSONDecodeError , loads as parse_json , dumps as to_json
303
303
304
304
305
305
class ProxmoxStorage (object ):
@@ -355,7 +355,9 @@ def __init__(self, module):
355
355
"'backup' content type." )
356
356
try :
357
357
if self .encryption_key not in ["autogen" , None ]:
358
- self .encryption_key = parse_json (self .encryption_key )
358
+ if isinstance (self .encryption_key , dict ):
359
+ self .encryption_key = to_json (self .encryption_key )
360
+ parse_json (self .encryption_key )
359
361
except JSONDecodeError :
360
362
self .module .fail_json (msg = ("encryption_key needs to be valid "
361
363
"JSON or set to 'autogen'." ))
You can’t perform that action at this time.
0 commit comments