From cef8ee797ff0ee7621f189975a63da8f9857d584 Mon Sep 17 00:00:00 2001 From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> Date: Fri, 20 Sep 2024 12:52:36 +0000 Subject: [PATCH] Fix sanity errors happening with the ansible devel branch (#2146) (#2149) This is a backport of PR #2146 as merged into main (008b515). SUMMARY Fix sanity errors happening with the ansible devel branch ERROR: Found 5 pylint issue(s) which need to be resolved: ERROR: plugins/modules/ec2_vpc_vgw.py:504:13: used-before-assignment: Using variable 'deleted_vgw' before assignment ERROR: plugins/modules/ecs_cluster.py:342:12: unreachable: Unreachable code ERROR: plugins/modules/ecs_cluster.py:364:12: unreachable: Unreachable code ERROR: plugins/modules/ecs_service.py:1251:12: unreachable: Unreachable code ERROR: plugins/modules/ecs_service.py:1266:12: unreachable: Unreachable code ISSUE TYPE Bugfix Pull Request Docs Pull Request Feature Pull Request New Module Pull Request COMPONENT NAME ADDITIONAL INFORMATION Reviewed-by: Bikouo Aubin --- changelogs/fragments/20240919-fix_sanity.yml | 2 ++ plugins/modules/ec2_vpc_vgw.py | 1 + plugins/modules/ecs_cluster.py | 3 +-- plugins/modules/ecs_service.py | 3 +-- 4 files changed, 5 insertions(+), 4 deletions(-) create mode 100644 changelogs/fragments/20240919-fix_sanity.yml diff --git a/changelogs/fragments/20240919-fix_sanity.yml b/changelogs/fragments/20240919-fix_sanity.yml new file mode 100644 index 00000000000..ae45638f926 --- /dev/null +++ b/changelogs/fragments/20240919-fix_sanity.yml @@ -0,0 +1,2 @@ +trivial: + - "Fix sanity errors happening with the ansible devel branch (e.g., unreachable code, using variable before assignment)." diff --git a/plugins/modules/ec2_vpc_vgw.py b/plugins/modules/ec2_vpc_vgw.py index 1b2af15a5ab..b6f91e5dfc1 100644 --- a/plugins/modules/ec2_vpc_vgw.py +++ b/plugins/modules/ec2_vpc_vgw.py @@ -420,6 +420,7 @@ def ensure_vgw_absent(client, module): changed = False params = dict() result = dict() + deleted_vgw = None params["Name"] = module.params.get("name") params["VpcId"] = module.params.get("vpc_id") params["Type"] = module.params.get("type") diff --git a/plugins/modules/ecs_cluster.py b/plugins/modules/ecs_cluster.py index 5a0470eea8e..0500a27ffdb 100644 --- a/plugins/modules/ecs_cluster.py +++ b/plugins/modules/ecs_cluster.py @@ -339,7 +339,7 @@ def main(): elif module.params["state"] == "has_instances": if not existing: module.fail_json(msg="Cluster '" + module.params["name"] + " not found.") - return + # it exists, so we should delete it and mark changed. # return info about the cluster deleted delay = module.params["delay"] @@ -361,7 +361,6 @@ def main(): + str(delay) + " seconds each." ) - return module.exit_json(**results) diff --git a/plugins/modules/ecs_service.py b/plugins/modules/ecs_service.py index e6ecf736b5c..be2735cf6da 100644 --- a/plugins/modules/ecs_service.py +++ b/plugins/modules/ecs_service.py @@ -1248,7 +1248,7 @@ def main(): elif module.params["state"] == "deleting": if not existing: module.fail_json(msg="Service '" + module.params["name"] + " not found.") - return + # it exists, so we should delete it and mark changed. # return info about the cluster deleted delay = module.params["delay"] @@ -1263,7 +1263,6 @@ def main(): time.sleep(delay) if i is repeat - 1: module.fail_json(msg=f"Service still not deleted after {repeat} tries of {delay} seconds each.") - return module.exit_json(**results)