Skip to content

Commit

Permalink
fix lints for pylint 3.2
Browse files Browse the repository at this point in the history
  • Loading branch information
maxhoesel authored and renovate[bot] committed May 17, 2024
1 parent fbc148b commit 6548e40
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion plugins/modules/step_ca_provisioner.py
Original file line number Diff line number Diff line change
Expand Up @@ -640,22 +640,25 @@ def run_module():
provisioners = json.loads(ca_online_res.stdout)
except (json.JSONDecodeError, OSError) as e:
module.fail_json(f"Error reading provisioner config: {e}")
return # makes pylint happy
elif admin_params.is_defined():
# Admin credentials means that the provisioners are managed remotely and are stored in the DB.
# Combined with a connection failure, this means that we are unable to continue
module.fail_json(
"Could not contact CA to retrieve provisioners and cannot fallback to direct manipulation "
"as remote admin parameters are set. Aborting"
)
return # makes pylint happy
else:
# Without admin, provisioners are always managed locally, so we can just read them as a fallback
with open(module_params["ca_config"], "rb") as f:
try:
provisioners = json.load(f).get("authority", {}).get("provisioners", [])
except (json.JSONDecodeError, OSError) as e:
module.fail_json(f"Error reading provisioner config: {e}")
return # makes pylint and pylance happy

for p in provisioners: # type: ignore
for p in provisioners:
if p["name"] == module_params["name"]:
if state == "present" and p["type"] == p_type:
result["msg"] = "Provisioner found in CA config - not modified"
Expand Down

0 comments on commit 6548e40

Please sign in to comment.