Closed superwesman closed 2 years ago
Files identified in the description:
plugins/modules/ecs_service.py
](https://github.com/['ansible-collections/amazon.aws', 'ansible-collections/community.aws', 'ansible-collections/community.vmware']/blob/main/plugins/modules/ecs_service.py)If these files are inaccurate, please update the component name
section of the description or use the !component
bot command.
cc @Java1Guy @jillr @kaczynskid @markuman @s-hertel @tremble @zacblazic click here for bot help
@superwesman
Thx for the detail reporting. I can confirm the bug.
The bug here is that the above code effectively mandates that
expression
is required.
But that's not valid. The parameter is set to required=False,
.
The parameter placement_constraints
is just path through, from 789 to Line 599.
A possible fix might be easy. All what's to do is to pop None
values from params['placement_constraints']
somewhere here ...
@superwesman are you willing to provide a PR to fix this issue?
hello @markuman - Unfortunately, I don't think I'm in a position to provide a PR. I've discovered this bug at work and the exact corporate policies related to open source development are many, and not clear to me. I hope that my input is at least helpful for anyone who does have capacity to implement. I'm sorry I can't do more at the moment.
@markuman I think I can provide a PR. I have been investigating issues with our automation and ended up having a solution which looks pretty similar to your proposal. I can confirm that this worked for me, so it looks like not much work is left
@markuman I think I can provide a PR. I have been investigating issues with our automation and ended up having a solution which looks pretty similar to your proposal. I can confirm that this worked for me, so it looks like not much work is left
That would be awesome @novak-as
I've test your branch and the current integration test passes. From my perspective, there are 3 steps left.
just a few days left until we're going to release 3.3.0. But I think we can made it.
Summary
Most Placement Constraint options have both a
type
and anexpression
. You can see this isecs_service.py
main()
...However, the
distinctInstance
Placement Constraint does not require anexpression.
The bug here is that the above code effectively mandates thatexpression
is required. If it is omitted from the playbook, we end up with the value beingNone
which I was able to capture by modifying the code ....The presence of
expression
here, even with the value ofNone
, yields the following error:I've confirmed that
boto
supports this just fine ...The bug appears to be in
ecs_service.py
during the create service path of execution.Issue Type
Bug Report
Component Name
ecs_service
Ansible Version
Collection Versions
AWS SDK versions
We do a lot of our ansible stuff from with virtual envs and docker containers. I don't happen to have
boto
installed, but don't let that be a distraction. The bug here is inecs_service.py
.Configuration
I ran this and it produced no output
OS / Environment
Steps to Reproduce
Run
ansible-playbook ./this.yml
to reproduce the error.Notes:
distinctInstance
Placement Constraint, it will be retained.distinctInstance
Placement Constraint, it will not be added.Expected Results
distinctInstance
Placement Strategy in my Ansible playbook, regardless of the state of the ECS Service.distinctInstance
Placement Strategy defined in the playbok should be applied to the ECS Service in question.Actual Results
ansible-playbook
generates an error and fails. No ECS Service is created.distinctInstance
Placement Strategy, this Placement Strategy is retained.distinctInstance
Placement Strategy, this Placement Strategy (which is supplied in the playbook) is not applied to the ECS Service.Code of Conduct