Skip to content

Commit

Permalink
Fix sanity workflow (#1909)
Browse files Browse the repository at this point in the history
SUMMARY

Fix sanity workflow

ISSUE TYPE

    Bugfix Pull Request

COMPONENT NAME

ADDITIONAL INFORMATION
  • Loading branch information
alinabuzachis authored Dec 7, 2023
1 parent 45d1f22 commit 34b7a30
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 75 deletions.
90 changes: 27 additions & 63 deletions .github/workflows/sanity.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,68 +5,32 @@ on: [workflow_call] # allow this workflow to be called from other workflows

jobs:
sanity:
uses: ansible-network/github_actions/.github/workflows/sanity.yml@main
# stable-6 sanity test versions locked based on tested versions as of 7.0.0 release
uses: ansible-network/github_actions/.github/workflows/sanity.yml@b2b68168f3040e55553664b1fbcdc19cf10f49bc
with:
matrix_include: "[]"
matrix_include: >-
[]
# devel and milestone are a moving target while we should fix issues in the
# main and our current major releases, they're no always appropriate to
# backport to older releases.
matrix_exclude: >-
[
{
"ansible-version": "stable-2.9"
},
{
"ansible-version": "stable-2.12",
"python-version": "3.7"
},
{
"ansible-version": "stable-2.12",
"python-version": "3.11"
},
{
"ansible-version": "stable-2.13",
"python-version": "3.7"
},
{
"ansible-version": "stable-2.13",
"python-version": "3.11"
},
{
"ansible-version": "stable-2.14",
"python-version": "3.7"
},
{
"ansible-version": "stable-2.14",
"python-version": "3.8"
},
{
"ansible-version": "stable-2.15",
"python-version": "3.7"
},
{
"ansible-version": "stable-2.15",
"python-version": "3.8"
},
{
"ansible-version": "milestone",
"python-version": "3.7"
},
{
"ansible-version": "milestone",
"python-version": "3.8"
},
{
"ansible-version": "milestone",
"python-version": "3.9"
},
{
"ansible-version": "devel",
"python-version": "3.7"
},
{
"ansible-version": "devel",
"python-version": "3.8"
},
{
"ansible-version": "devel",
"python-version": "3.9"
}
]
[
{
"ansible-version": "milestone"
},
{
"ansible-version": "devel"
},
{
"ansible-version": "stable-2.14",
"python-version": "3.12"
},
{
"ansible-version": "stable-2.15",
"python-version": "3.12"
},
{
"ansible-version": "stable-2.16",
"python-version": "3.9"
}
]
26 changes: 25 additions & 1 deletion .github/workflows/units.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,28 @@ on: [workflow_call] # allow this workflow to be called from other workflows

jobs:
unit-source:
uses: ansible-network/github_actions/.github/workflows/unit_source.yml@main
# stable-6 unit test versions locked based on tested versions as of 7.0.0 release
uses: ansible-network/github_actions/.github/workflows/unit_source.yml@b2b68168f3040e55553664b1fbcdc19cf10f49bc
with:
# devel and milestone are a moving target while we should fix issues in the
# main and our current major releases, they're no always appropriate to
# backport to older releases.
matrix_exclude: >-
[
{
"ansible-version": "milestone"
},
{
"ansible-version": "devel"
},
{
"python-version": "3.11"
},
{
"python-version": "3.12"
},
{
"ansible-version": "stable-2.16",
"python-version": "3.9"
}
]
18 changes: 9 additions & 9 deletions plugins/modules/autoscaling_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -1675,15 +1675,15 @@ def get_instances_by_launch_config(props, lc_check, initial_instances):
old_instances.append(i)

else:
module.debug(f"Comparing initial instances with current: {*initial_instances,}")
module.debug(f"Comparing initial instances with current: {*initial_instances, }")
for i in props["instances"]:
if i not in initial_instances:
new_instances.append(i)
else:
old_instances.append(i)

module.debug(f"New instances: {len(new_instances)}, {*new_instances,}")
module.debug(f"Old instances: {len(old_instances)}, {*old_instances,}")
module.debug(f"New instances: {len(new_instances)}, {*new_instances, }")
module.debug(f"Old instances: {len(old_instances)}, {*old_instances, }")

return new_instances, old_instances

Expand All @@ -1702,15 +1702,15 @@ def get_instances_by_launch_template(props, lt_check, initial_instances):
else:
old_instances.append(i)
else:
module.debug(f"Comparing initial instances with current: {*initial_instances,}")
module.debug(f"Comparing initial instances with current: {*initial_instances, }")
for i in props["instances"]:
if i not in initial_instances:
new_instances.append(i)
else:
old_instances.append(i)

module.debug(f"New instances: {len(new_instances)}, {*new_instances,}")
module.debug(f"Old instances: {len(old_instances)}, {*old_instances,}")
module.debug(f"New instances: {len(new_instances)}, {*new_instances, }")
module.debug(f"Old instances: {len(old_instances)}, {*old_instances, }")

return new_instances, old_instances

Expand Down Expand Up @@ -1775,9 +1775,9 @@ def terminate_batch(connection, replace_instances, initial_instances, leftovers=
instances_to_terminate = list_purgeable_instances(props, lc_check, lt_check, replace_instances, initial_instances)

module.debug(f"new instances needed: {num_new_inst_needed}")
module.debug(f"new instances: {*new_instances,}")
module.debug(f"old instances: {*old_instances,}")
module.debug(f"batch instances: {*instances_to_terminate,}")
module.debug(f"new instances: {*new_instances, }")
module.debug(f"old instances: {*old_instances, }")
module.debug(f"batch instances: {*instances_to_terminate, }")

if num_new_inst_needed == 0:
decrement_capacity = True
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/rds_instance_snapshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ def get_parameters(parameters, method_name):
required_options = get_boto3_client_method_parameters(client, method_name, required=True)
if any(parameters.get(k) is None for k in required_options):
method_description = get_rds_method_attribute(method_name, module).operation_description
module.fail_json(msg=f"To {method_description} requires the parameters: {*required_options,}")
module.fail_json(msg=f"To {method_description} requires the parameters: {*required_options, }")
options = get_boto3_client_method_parameters(client, method_name)
parameters = dict((k, v) for k, v in parameters.items() if k in options and v is not None)

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/plugins/modules/test_ec2_ami_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ def test_list_ec2_images(m_get_images, m_get_image_attribute):
m_get_images.assert_called_with(ec2_client, request_args)

assert m_get_image_attribute.call_count == 2
assert m_get_image_attribute.has_calls([call(ec2_client, images[0])], [call(ec2_client, images[1])])
assert m_get_image_attribute.has_called_with([call(ec2_client, images[0]), call(ec2_client, images[1])])

assert len(list_ec2_images_result) == 2
assert list_ec2_images_result[0]["image_id"] == "ami-1234567890"
Expand Down

0 comments on commit 34b7a30

Please sign in to comment.