aws-solutions / network-orchestration-for-aws-transit-gateway

The Network Orchestration for AWS Transit Gateway solution automates the process of setting up and managing transit networks in distributed AWS environments. It creates a web interface to help control, audit, and approve (transit) network changes.
https://aws.amazon.com/solutions/implementations/serverless-transit-network-orchestrator/
Apache License 2.0
110 stars 48 forks source link

if statement is always true #19

Closed andres-vara closed 3 years ago

groverlalit commented 3 years ago

Thanks for bringing to our attention.

There 4 possible states ('State': 'associating'|'associated'|'disassociating'|'disassociated'). The condition is to make sure we wait for the transitioning state (associating | disassociating) to a stable state (associated | disassociated). Thus, in _get_association_state function we make _get_transit_gateway_route_tableassociations API to make sure is in a stable state.

It seems removing this condition would not impact the workflow but it would add another _get_transit_gateway_route_tableassociations API to the workflow.

andres-vara commented 3 years ago

it hits get_transit_gateway_route_table_associations anyway at least once since if status != 'associated' or status != 'disassociated': is always true, you can replace that statement with

if True:
    flag = True

existing code is not broken tho