Skip to content

Fix setupInstanceFirewall function for accounts with default firewall #741

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

zliang-akamai
Copy link
Member

@zliang-akamai zliang-akamai commented May 5, 2025

📝 Description

For some accounts with default firewall setting, the Linode will be created behind the default firewall even if firewall_id is not configured for the Linode creation options. Updating the test function to add the firewall_id in the creation options to override the default firewall. Otherwise, we won't be able to add the Linode to the test firewall after creation because it would already be behind the default firewall.

Other changes:

  1. Migrate manual deferral cleanup function calls with t.Cleanup for setupInstanceFirewall.

✔️ How to Test

If you would like to add a default firewall to your account before verifying the test case, you can call the API with cURL with the default firewall ID for each Linode resource as below.

WARNING:
This action cannot be undone. Once you configure the default firewall, you can only change it to another firewall; you cannot unset it.
And it's unclear whether having a default firewall will affect some other tests.

curl --request PUT \   
     --url https://api.linode.com/v4beta/networking/firewalls/settings \ 
     --header 'accept: application/json' \
     --header "authorization: Bearer $TOKEN" \
     --header 'content-type: application/json' \
     --data '
{
    "default_firewall_ids": { 
        "public_interface": 1629606,
        "vpc_interface": 1629606,
        "linode": 1629606,
        "nodebalancer": 1629606
    }               
}

'
make TEST_ARGS="-run TestInstanceFirewalls_List" fixtures

@zliang-akamai zliang-akamai requested a review from a team as a code owner May 5, 2025 18:54
@zliang-akamai zliang-akamai requested review from ykim-akamai and yec-akamai and removed request for a team May 5, 2025 18:54
@zliang-akamai zliang-akamai force-pushed the zhiwei/update-setup-instance-firewall branch from 5059b6a to 1afcec8 Compare May 5, 2025 18:57
@zliang-akamai zliang-akamai marked this pull request as draft May 5, 2025 19:01
@zliang-akamai zliang-akamai force-pushed the zhiwei/update-setup-instance-firewall branch from 1afcec8 to a4bd8a6 Compare May 5, 2025 19:19
@zliang-akamai zliang-akamai changed the title Fix setupInstanceFirewall for accounts with default firewall Fix setupInstanceFirewall function for accounts with default firewall May 5, 2025
@zliang-akamai zliang-akamai marked this pull request as ready for review May 5, 2025 21:33
@zliang-akamai zliang-akamai added the testing for updates to the testing suite in the changelog. label May 5, 2025
@zliang-akamai zliang-akamai requested a review from vshanthe May 7, 2025 18:53
Copy link
Contributor

@yec-akamai yec-akamai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for putting up the fix!

@zliang-akamai zliang-akamai merged commit 255b155 into linode:main May 16, 2025
10 checks passed
@zliang-akamai zliang-akamai deleted the zhiwei/update-setup-instance-firewall branch May 16, 2025 18:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
testing for updates to the testing suite in the changelog.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants