Skip to content
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

Release v0.25.7 #495

Merged
merged 10 commits into from
Apr 22, 2024
38 changes: 38 additions & 0 deletions .github/labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# PR Labels
- name: new-feature
description: for new features in the changelog.
color: 225fee
- name: improvement
description: for improvements in existing functionality in the changelog.
color: 22ee47
- name: repo-ci-improvement
description: for improvements in the repository or CI workflow in the changelog.
color: c922ee
- name: bugfix
description: for any bug fixes in the changelog.
color: ed8e21
- name: documentation
description: for updates to the documentation in the changelog.
color: d3e1e6
- name: dependencies
description: dependency updates usually from dependabot
color: 5c9dff
- name: testing
description: for updates to the testing suite in the changelog.
color: 933ac9
- name: breaking-change
description: for breaking changes in the changelog.
color: ff0000
- name: ignore-for-release
description: PRs you do not want to render in the changelog
color: 7b8eac
- name: do-not-merge
description: PRs that should not be merged until the commented issue is resolved
color: eb1515
# Issue Labels
- name: enhancement
description: issues that request a enhancement
color: 22ee47
- name: bug
description: issues that report a bug
color: ed8e21
21 changes: 0 additions & 21 deletions .github/release-drafter.yml

This file was deleted.

32 changes: 32 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
changelog:
exclude:
labels:
- ignore-for-release
categories:
- title: ⚠️ Breaking Change
labels:
- breaking-change
- title: 🐛 Bug Fixes
labels:
- bugfix
- title: 🚀 New Features
labels:
- new-feature
- title: 💡 Improvements
labels:
- improvement
- title: 🧪 Testing Improvements
labels:
- testing
- title: ⚙️ Repo/CI Improvements
labels:
- repo-ci-improvement
- title: 📖 Documentation
labels:
- documentation
- title: 📦 Dependency Updates
labels:
- dependencies
- title: Other Changes
labels:
- "*"
31 changes: 31 additions & 0 deletions .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: labeler

on:
push:
branches:
- 'main'
paths:
- '.github/labels.yml'
- '.github/workflows/labeler.yml'
pull_request:
paths:
- '.github/labels.yml'
- '.github/workflows/labeler.yml'

jobs:
labeler:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Run Labeler
uses: crazy-max/ghaction-github-labeler@de749cf181958193cb7debf1a9c5bb28922f3e1b
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
yaml-file: .github/labels.yml
dry-run: ${{ github.event_name == 'pull_request' }}
exclude: |
help*
*issue
16 changes: 0 additions & 16 deletions .github/workflows/release-drafter.yml

This file was deleted.

1 change: 1 addition & 0 deletions docs/modules/account_availability_info.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Get info about a Linode Account Availability.

{
"region": "us-east",
"available": ["NodeBalancers", "Block Storage", "Kubernetes"],
"unavailable": ["Linode"]
}

Expand Down
2 changes: 2 additions & 0 deletions docs/modules/account_availability_list.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,12 @@ List and filter on Account Availabilitys.
[
{
"region": "ap-west",
"available": ["NodeBalancers", "Block Storage", "Kubernetes"],
"unavailable": ["Linode"]
},
{
"region": "ca-central",
"available": ["NodeBalancers", "Kubernetes"],
"unavailable": ["Linode", "Block Storage"]
}
]
Expand Down
1 change: 1 addition & 0 deletions docs/modules/nodebalancer.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ Manage a Linode NodeBalancer.
| `client_conn_throttle` | <center>`int`</center> | <center>Optional</center> | Throttle connections per second. Set to 0 (zero) to disable throttling. **(Updatable)** |
| `region` | <center>`str`</center> | <center>Optional</center> | The ID of the Region to create this NodeBalancer in. |
| `firewall_id` | <center>`int`</center> | <center>Optional</center> | The ID of the Firewall to assign this NodeBalancer to. |
| `tags` | <center>`list`</center> | <center>Optional</center> | Tags to assign to this NodeBalancer. **(Updatable)** |
| [`configs` (sub-options)](#configs) | <center>`list`</center> | <center>Optional</center> | A list of configs to apply to the NodeBalancer. **(Updatable)** |

### configs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
result_account_availability_samples = ['''
{
"region": "us-east",
"available": ["NodeBalancers", "Block Storage", "Kubernetes"],
"unavailable": ["Linode"]
}
''']
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@
result_account_availabilities_samples = ['''[
{
"region": "ap-west",
"available": ["NodeBalancers", "Block Storage", "Kubernetes"],
"unavailable": ["Linode"]
},
{
"region": "ca-central",
"available": ["NodeBalancers", "Kubernetes"],
"unavailable": ["Linode", "Block Storage"]
}
]''']
17 changes: 16 additions & 1 deletion plugins/module_utils/linode_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ def handle_updates(

obj._api_get()

# We need the type to access property metadata
property_metadata = type(obj).properties

# Update mutable values
params = filter_null_values(params)

Expand All @@ -128,7 +131,19 @@ def handle_updates(

old_value = parse_linode_types(getattr(obj, key))

if new_value != old_value:
has_diff = new_value != old_value

# We should convert properties to sets
# if they are annotated as unordered in the
# Python SDK.
if (
property_metadata is not None
and property_metadata.get(key) is not None
and property_metadata.get(key).unordered
):
has_diff = set(old_value) != set(new_value)

if has_diff:
if key in mutable_fields:
put_request[key] = new_value
result.add(key)
Expand Down
45 changes: 13 additions & 32 deletions plugins/modules/instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
drop_empty_strings,
filter_null_values,
filter_null_values_recursive,
handle_updates,
paginated_list_to_json,
parse_linode_types,
poll_condition,
Expand Down Expand Up @@ -538,7 +539,7 @@
)

# Fields that can be updated on an existing instance
linode_instance_mutable = {"group", "tags"}
MUTABLE_FIELDS = {"group", "tags"}

linode_instance_config_mutable = {
"comments",
Expand Down Expand Up @@ -1049,7 +1050,7 @@ def _update_config(

# Special diffing due to handling in linode_api4-python
if key == "devices":
for device_key, device in old_value.items():
for device_key, device in vars(config.devices).items():
if not self._compare_param_to_device(
new_value[device_key], device
):
Expand Down Expand Up @@ -1172,47 +1173,27 @@ def _update_disks(self) -> None:

def _update_instance(self) -> None:
"""Update instance handles all update functionality for the current instance"""
should_update = False

params = filter_null_values(self.module.params)

for key, new_value in params.items():
if not hasattr(self._instance, key):
continue

if key in (
update_params = {
k: v
for k, v in params.items()
if k
not in (
"configs",
"disks",
"boot_config_label",
"reboot",
"backups_enabled",
"type",
"region",
):
continue

old_value = parse_linode_types(getattr(self._instance, key))

if new_value != old_value:
if key in linode_instance_mutable:
setattr(self._instance, key, new_value)
self.register_action(
'Updated instance {0}: "{1}" -> "{2}"'.format(
key, old_value, new_value
)
)

should_update = True
continue

self.fail(
"failed to update instance {0}: {1} is a non-updatable field".format(
self._instance.label, key
)
)
)
}

if should_update:
self._instance.save()
handle_updates(
self._instance, update_params, MUTABLE_FIELDS, self.register_action
)

backups_enabled = params.get("backups_enabled")
if (
Expand Down
Loading
Loading