diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml
index 1ca64373..d8f2a4f5 100644
--- a/.github/workflows/docs.yml
+++ b/.github/workflows/docs.yml
@@ -4,7 +4,7 @@ on: pull_request
jobs:
run-docs-validation:
- runs-on: ubuntu-20.04
+ runs-on: ubuntu-latest
defaults:
run:
working-directory: .ansible/collections/ansible_collections/linode/cloud
diff --git a/.github/workflows/integration-tests-pr.yml b/.github/workflows/integration-tests-pr.yml
index cea0f2bb..92b590de 100644
--- a/.github/workflows/integration-tests-pr.yml
+++ b/.github/workflows/integration-tests-pr.yml
@@ -48,7 +48,7 @@ jobs:
run: pip3 install -r requirements-dev.txt -r requirements.txt
- name: install ansible dependencies
- run: ansible-galaxy collection install amazon.aws:==1.5.1
+ run: ansible-galaxy collection install amazon.aws:==6.0.1
- name: install collection
run: make install
@@ -61,7 +61,7 @@ jobs:
env:
LINODE_API_TOKEN: ${{ secrets.DX_LINODE_TOKEN }}
- - uses: actions/github-script@v5
+ - uses: actions/github-script@v6
id: update-check-run
if: ${{ always() }}
env:
diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml
index 8f063034..8dae042e 100644
--- a/.github/workflows/integration-tests.yml
+++ b/.github/workflows/integration-tests.yml
@@ -9,7 +9,7 @@ on:
jobs:
run-tests:
- runs-on: ubuntu-20.04
+ runs-on: ubuntu-latest
defaults:
run:
working-directory: .ansible/collections/ansible_collections/linode/cloud
@@ -34,7 +34,7 @@ jobs:
run: pip3 install -r requirements-dev.txt -r requirements.txt
- name: install ansible dependencies
- run: ansible-galaxy collection install amazon.aws:==1.5.1
+ run: ansible-galaxy collection install amazon.aws:==6.0.1
- name: install collection
run: make install
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
index 4c9bd566..9d820edb 100644
--- a/.github/workflows/lint.yml
+++ b/.github/workflows/lint.yml
@@ -4,7 +4,7 @@ on: pull_request
jobs:
lint:
- runs-on: ubuntu-20.04
+ runs-on: ubuntu-latest
steps:
- name: checkout repo
uses: actions/checkout@v3
diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml
index 54bb68be..0dbf2f62 100644
--- a/.github/workflows/release-drafter.yml
+++ b/.github/workflows/release-drafter.yml
@@ -9,7 +9,7 @@ jobs:
update_release_draft:
runs-on: ubuntu-latest
steps:
- - uses: release-drafter/release-drafter@fe52e97d262833ae07d05efaf1a239df3f1b5cd4 # pin@v5
+ - uses: release-drafter/release-drafter@569eb7ee3a85817ab916c8f8ff03a5bd96c9c83e # pin@v5.23.0
with:
config-name: release-drafter.yml
env:
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index d6643ddd..c992497b 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -33,7 +33,7 @@ jobs:
run: pip3 install -r requirements-dev.txt -r requirements.txt
- name: install ansible dependencies
- run: ansible-galaxy collection install amazon.aws:==1.5.1
+ run: ansible-galaxy collection install amazon.aws:==6.0.1
- name: publish the collection
run: make publish
diff --git a/.pylintrc b/.pylintrc
deleted file mode 100644
index f3423e7b..00000000
--- a/.pylintrc
+++ /dev/null
@@ -1,25 +0,0 @@
-[MASTER]
-
-[MESSAGES CONTROL]
-disable=protected-access,
- broad-except,
- unused-argument,
- no-name-in-module,
- import-error,
- inconsistent-return-statements,
- assignment-from-no-return,
- too-many-arguments,
- too-few-public-methods,
- duplicate-code,
- too-many-lines,
- too-many-branches,
- anomalous-backslash-in-string,
- too-many-locals,
- consider-using-f-string,
- consider-using-dict-items,
- used-before-assignment,
- unused-variable,
- missing-timeout,
- use-sequence-for-iteration
-
-extension-pkg-whitelist=math
\ No newline at end of file
diff --git a/docs/modules/firewall.md b/docs/modules/firewall.md
index 9d11b652..5657f543 100644
--- a/docs/modules/firewall.md
+++ b/docs/modules/firewall.md
@@ -86,7 +86,7 @@ Manage Linode Firewalls.
| `action` |
`str` | **Required** | Controls whether traffic is accepted or dropped by this rule. **(Choices: `ACCEPT`, `DROP`)** |
| [`addresses` (sub-options)](#addresses) | `dict` | Optional | Allowed IPv4 or IPv6 addresses. |
| `description` | `str` | Optional | A description for this rule. |
-| `ports` | `str` | Optional | A string representing the port or ports on which traffic will be allowed. See U(https://www.linode.com/docs/api/networking/#firewall-create) |
+| `ports` | `str` | Optional | A string representing the port or ports on which traffic will be allowed. See https://www.linode.com/docs/api/networking/#firewall-create |
| `protocol` | `str` | Optional | The type of network traffic to allow. |
### addresses
@@ -104,7 +104,7 @@ Manage Linode Firewalls.
| `action` | `str` | **Required** | Controls whether traffic is accepted or dropped by this rule. **(Choices: `ACCEPT`, `DROP`)** |
| [`addresses` (sub-options)](#addresses) | `dict` | Optional | Allowed IPv4 or IPv6 addresses. |
| `description` | `str` | Optional | A description for this rule. |
-| `ports` | `str` | Optional | A string representing the port or ports on which traffic will be allowed. See U(https://www.linode.com/docs/api/networking/#firewall-create) |
+| `ports` | `str` | Optional | A string representing the port or ports on which traffic will be allowed. See https://www.linode.com/docs/api/networking/#firewall-create |
| `protocol` | `str` | Optional | The type of network traffic to allow. |
## Return Values
diff --git a/docs/modules/instance.md b/docs/modules/instance.md
index 02e002f8..01f2dc3e 100644
--- a/docs/modules/instance.md
+++ b/docs/modules/instance.md
@@ -90,7 +90,8 @@ Manage Linode Instances, Configs, and Disks.
| Field | Type | Required | Description |
|-----------|------|----------|------------------------------------------------------------------------------|
| `state` | `str` | **Required** | The desired state of the target. **(Choices: `present`, `absent`)** |
-| `type` | `str` | Optional | The unique label to give this instance. |
+| `label` | `str` | Optional | The unique label to give this instance. |
+| `type` | `str` | Optional | The Linode Type of the Linode you are creating. |
| `region` | `str` | Optional | The location to deploy the instance in. See the [Linode API documentation](https://api.linode.com/v4/regions). |
| `image` | `str` | Optional | The image ID to deploy the instance disk from. **(Conflicts With: `disks`,`configs`)** |
| `authorized_keys` | `list` | Optional | A list of SSH public key parts to deploy for the root user. |
@@ -108,6 +109,7 @@ Manage Linode Instances, Configs, and Disks.
| `wait` | `bool` | Optional | Wait for the instance to have status "running" before returning. **(Default: `True`)** |
| `wait_timeout` | `int` | Optional | The amount of time, in seconds, to wait for an instance to have status "running". **(Default: `240`)** |
| [`additional_ipv4` (sub-options)](#additional_ipv4) | `list` | Optional | Additional ipv4 addresses to allocate. |
+| `rebooted` | `bool` | Optional | If true, the Linode Instance will be rebooted. NOTE: The instance will only be rebooted if it was previously in a running state. To ensure your Linode will always be rebooted, consider also setting the `booted` field. **(Default: `False`)** |
### configs
diff --git a/docs/modules/volume.md b/docs/modules/volume.md
index 3b795512..72bcb8cc 100644
--- a/docs/modules/volume.md
+++ b/docs/modules/volume.md
@@ -66,7 +66,7 @@ Manage a Linode Volume.
| `label` | `str` | Optional | The Volume’s label, which is also used in the filesystem_path of the resulting volume. |
| `config_id` | `int` | Optional | When creating a Volume attached to a Linode, the ID of the Linode Config to include the new Volume in. |
| `linode_id` | `int` | Optional | The Linode this volume should be attached to upon creation. If not given, the volume will be created without an attachment. **(Updatable)** |
-| `region` | `str` | Optional | The location to deploy the volume in. See U(https://api.linode.com/v4/regions) |
+| `region` | `str` | Optional | The location to deploy the volume in. See https://api.linode.com/v4/regions |
| `size` | `int` | Optional | The size of this volume, in GB. Be aware that volumes may only be resized up after creation. **(Updatable)** |
| `attached` | `bool` | Optional | If true, the volume will be attached to a Linode. Otherwise, the volume will be detached. **(Default: `True`; Updatable)** |
| `wait_timeout` | `int` | Optional | The amount of time, in seconds, to wait for a volume to have the active status. **(Default: `240`)** |
diff --git a/plugins/module_utils/linode_common.py b/plugins/module_utils/linode_common.py
index 1d6fb0cb..6cd48992 100644
--- a/plugins/module_utils/linode_common.py
+++ b/plugins/module_utils/linode_common.py
@@ -52,42 +52,45 @@
f"Ansible/{ANSIBLE_VERSION}"
)
-LINODE_COMMON_ARGS = dict(
- api_token=dict(
- type="str",
- fallback=(env_fallback, ["LINODE_API_TOKEN", "LINODE_TOKEN"]),
- required=True,
- no_log=True,
- ),
- api_version=dict(
- type="str",
- fallback=(env_fallback, ["LINODE_API_VERSION"]),
- default="v4",
- ),
- state=dict(
- type="str",
- required=True,
- choices=["present", "absent"],
- ),
- ua_prefix=dict(
- type="str",
- description="An HTTP User-Agent Prefix to prepend in API requests.",
- doc_hide=True,
- fallback=(env_fallback, ["LINODE_UA_PREFIX"]),
- ),
-)
-
-LINODE_TAG_ARGS = dict(
- tags=dict(type="list", description="The tags to assign to this resource."),
-)
-
-LINODE_LABEL_ARGS = dict(
- label=dict(
- type="str",
- required=True,
- description="The label to assign to this resource.",
- ),
-)
+LINODE_COMMON_ARGS = {
+ "api_token": {
+ "type": "str",
+ "fallback": (env_fallback, ["LINODE_API_TOKEN", "LINODE_TOKEN"]),
+ "required": True,
+ "no_log": True,
+ },
+ "api_version": {
+ "type": "str",
+ "fallback": (env_fallback, ["LINODE_API_VERSION"]),
+ "default": "v4",
+ },
+ "state": {
+ "type": "str",
+ "required": True,
+ "choices": ["present", "absent"],
+ },
+ "ua_prefix": {
+ "type": "str",
+ "description": "An HTTP User-Agent Prefix to prepend in API requests.",
+ "doc_hide": True,
+ "fallback": (env_fallback, ["LINODE_UA_PREFIX"]),
+ },
+}
+
+LINODE_TAG_ARGS = {
+ "tags": {
+ "type": "list",
+ "description": "The tags to assign to this resource.",
+ },
+}
+
+LINODE_LABEL_ARGS = {
+ "label": {
+ "type": "str",
+ "required": True,
+ "description": "The label to assign to this resource.",
+ },
+}
RESOURCE_NAMES = (
{
@@ -103,6 +106,10 @@
else {}
)
+MAX_RETRIES = 5
+RETRY_INTERVAL_SECONDS = float(4)
+RETRY_STATUSES = {408, 429, 502}
+
class LinodeModuleBase:
"""A base for all Linode resource modules."""
@@ -147,7 +154,7 @@ def __init__(
required_if=required_if,
)
- self.results: dict = self.results or dict(changed=False, actions=[])
+ self.results: dict = self.results or {"changed": False, "actions": []}
# This field may or may not be present depending on the module
timeout_param = self.module.params.get("wait_timeout", 120)
@@ -240,7 +247,9 @@ def client(self) -> LinodeClient:
api_token,
base_url="https://api.linode.com/{0}".format(api_version),
user_agent=user_agent,
- retry_rate_limit_interval=10,
+ retry_rate_limit_interval=RETRY_INTERVAL_SECONDS,
+ retry_max=MAX_RETRIES,
+ retry_statuses=RETRY_STATUSES,
)
return self._client
diff --git a/plugins/module_utils/linode_database_shared.py b/plugins/module_utils/linode_database_shared.py
index b6ee8a0b..bf0d379d 100644
--- a/plugins/module_utils/linode_database_shared.py
+++ b/plugins/module_utils/linode_database_shared.py
@@ -7,8 +7,8 @@
from ansible_specdoc.objects import FieldType, SpecField
from linode_api4 import ApiError
-SPEC_UPDATE_WINDOW = dict(
- day_of_week=SpecField(
+SPEC_UPDATE_WINDOW = {
+ "day_of_week": SpecField(
type=FieldType.integer,
required=True,
choices=list(range(1, 8)),
@@ -16,13 +16,13 @@
"The day to perform maintenance. 1=Monday, 2=Tuesday, etc."
],
),
- duration=SpecField(
+ "duration": SpecField(
type=FieldType.integer,
required=True,
choices=[1, 3],
description=["The maximum maintenance window time in hours."],
),
- frequency=SpecField(
+ "frequency": SpecField(
type=FieldType.string,
choices=["weekly", "monthly"],
default="weekly",
@@ -30,12 +30,12 @@
"Whether maintenance occurs on a weekly or monthly basis."
],
),
- hour_of_day=SpecField(
+ "hour_of_day": SpecField(
type=FieldType.integer,
required=True,
description=["The hour to begin maintenance based in UTC time."],
),
- week_of_month=SpecField(
+ "week_of_month": SpecField(
type=FieldType.integer,
description=[
"The week of the month to perform monthly frequency updates.",
@@ -44,7 +44,7 @@
"Must be null for weekly frequency updates.",
],
),
-)
+}
def validate_allow_list(allow_list: Set[str]) -> None:
diff --git a/plugins/module_utils/linode_helper.py b/plugins/module_utils/linode_helper.py
index 30aa4c0b..e082bc5d 100644
--- a/plugins/module_utils/linode_helper.py
+++ b/plugins/module_utils/linode_helper.py
@@ -1,6 +1,5 @@
"""This module contains helper functions for various Linode modules."""
import math
-import time
from typing import Any, Callable, Dict, List, Optional, Set, Tuple, cast
import linode_api4
@@ -19,10 +18,6 @@
FilterableMetaclass,
)
-MAX_RETRIES = 5
-RETRY_INTERVAL_SECONDS = 4
-RETRY_STATUSES = {408}
-
def dict_select_spec(target: dict, spec: dict) -> dict:
"""Returns a new dictionary that only selects the keys from target that are specified in spec"""
@@ -205,41 +200,6 @@ def validate_required(required_fields: Set[str], params: Dict[str, Any]):
raise Exception("missing fields: {}".format(", ".join(missing_fields)))
-def request_retry(
- request_func: Callable,
- retry_statuses=None,
- retry_interval=RETRY_INTERVAL_SECONDS,
- max_retries=MAX_RETRIES,
-) -> any:
- """Retries requests if the response status code matches the retry_statuses set."""
- # Default value for set
- if retry_statuses is None:
- retry_statuses = RETRY_STATUSES
-
- number_attempts = 0
-
- while number_attempts < max_retries:
- number_attempts += 1
-
- try:
- response = request_func()
- except ApiError as exception:
- if exception.status not in retry_statuses:
- raise exception
-
- time.sleep(retry_interval)
-
- continue
- except Exception as exception:
- raise exception
-
- return response
-
- raise Exception(
- "exceeded maximum number of retries: {0}".format(max_retries)
- )
-
-
def filter_null_values_recursive(obj: Any) -> Any:
"""Recursively removes null values and keys from a structure."""
if isinstance(obj, dict):
diff --git a/plugins/modules/account_info.py b/plugins/modules/account_info.py
index 3a2472a5..3f5cf7ae 100644
--- a/plugins/modules/account_info.py
+++ b/plugins/modules/account_info.py
@@ -5,7 +5,6 @@
from __future__ import absolute_import, division, print_function
-# pylint: disable=unused-import
from typing import Any, List, Optional
import ansible_collections.linode.cloud.plugins.module_utils.doc_fragments.account_info as docs
@@ -23,11 +22,11 @@
SpecReturnValue,
)
-spec = dict(
+spec = {
# Disable the default values
- label=SpecField(type=FieldType.string, required=False, doc_hide=True),
- state=SpecField(type=FieldType.string, required=False, doc_hide=True),
-)
+ "label": SpecField(type=FieldType.string, required=False, doc_hide=True),
+ "state": SpecField(type=FieldType.string, required=False, doc_hide=True),
+}
SPECDOC_META = SpecDocMeta(
description=["Get info about a Linode Account."],
@@ -35,14 +34,14 @@
author=global_authors,
options=spec,
examples=docs.specdoc_examples,
- return_values=dict(
- account=SpecReturnValue(
+ return_values={
+ "account": SpecReturnValue(
description="The account info in JSON serialized form.",
docs_url="https://www.linode.com/docs/api/account/#account-view__response-samples",
type=FieldType.dict,
sample=docs.result_account_samples,
)
- ),
+ },
)
@@ -51,9 +50,7 @@ class Module(LinodeModuleBase):
def __init__(self) -> None:
self.required_one_of: List[str] = []
- self.results = dict(
- account=None,
- )
+ self.results = {"account": None}
self.module_arg_spec = SPECDOC_META.ansible_spec
diff --git a/plugins/modules/api_request.py b/plugins/modules/api_request.py
index f5102a50..7da27dee 100644
--- a/plugins/modules/api_request.py
+++ b/plugins/modules/api_request.py
@@ -7,8 +7,6 @@
import ast
import contextlib
-
-# pylint: disable=unused-import
import json
from typing import Any, Optional, Tuple
@@ -28,10 +26,10 @@
)
from linode_api4 import ApiError
-SPEC = dict(
- label=SpecField(type=FieldType.string, doc_hide=True),
- state=SpecField(type=FieldType.string, doc_hide=True),
- path=SpecField(
+SPEC = {
+ "label": SpecField(type=FieldType.string, doc_hide=True),
+ "state": SpecField(type=FieldType.string, doc_hide=True),
+ "path": SpecField(
type=FieldType.string,
required=True,
description=[
@@ -39,13 +37,13 @@
'e.g. "linode/instances"',
],
),
- method=SpecField(
+ "method": SpecField(
type=FieldType.string,
required=True,
description=["The HTTP method of the request or response."],
choices=["POST", "PUT", "GET", "DELETE"],
),
- body=SpecField(
+ "body": SpecField(
type=FieldType.dict,
conflicts_with=["body_json"],
description=[
@@ -53,19 +51,19 @@
"This is a YAML structure that will be marshalled to JSON.",
],
),
- body_json=SpecField(
+ "body_json": SpecField(
type=FieldType.string,
conflicts_with=["body"],
description=["The body of the request in JSON format."],
),
- filters=SpecField(
+ "filters": SpecField(
type=FieldType.dict,
description=[
"A YAML structure corresponding to the X-Filter request header.",
"See: https://www.linode.com/docs/api/#filtering-and-sorting",
],
),
-)
+}
SPECDOC_META = SpecDocMeta(
description=[
@@ -77,16 +75,16 @@
author=global_authors,
options=SPEC,
examples=docs.specdoc_examples,
- return_values=dict(
- body=SpecReturnValue(
+ return_values={
+ "body": SpecReturnValue(
description="The deserialized response body.",
type=FieldType.dict,
sample=docs.result_body_samples,
),
- status=SpecReturnValue(
+ "status": SpecReturnValue(
description="The response status code.", type=FieldType.integer
),
- ),
+ },
)
@@ -95,7 +93,7 @@ class Module(LinodeModuleBase):
def __init__(self) -> None:
self.module_arg_spec = SPECDOC_META.ansible_spec
- self.results = dict(body={}, status=0, changed=False)
+ self.results = {"body": {}, "status": 0, "changed": False}
super().__init__(
module_arg_spec=self.module_arg_spec,
diff --git a/plugins/modules/database_engine_list.py b/plugins/modules/database_engine_list.py
index 01f87f8c..aad7b303 100644
--- a/plugins/modules/database_engine_list.py
+++ b/plugins/modules/database_engine_list.py
@@ -27,8 +27,8 @@
SpecReturnValue,
)
-spec_filter = dict(
- name=SpecField(
+spec_filter = {
+ "name": SpecField(
type=FieldType.string,
required=True,
description=[
@@ -38,7 +38,7 @@
"#managed-database-engines-list__responses",
],
),
- values=SpecField(
+ "values": SpecField(
type=FieldType.list,
element_type=FieldType.string,
required=True,
@@ -47,23 +47,23 @@
"Fields will pass this filter if at least one of these values matches.",
],
),
-)
+}
-spec = dict(
+spec = {
# Disable the default values
- state=SpecField(type=FieldType.string, required=False, doc_hide=True),
- label=SpecField(type=FieldType.string, required=False, doc_hide=True),
- order=SpecField(
+ "state": SpecField(type=FieldType.string, required=False, doc_hide=True),
+ "label": SpecField(type=FieldType.string, required=False, doc_hide=True),
+ "order": SpecField(
type=FieldType.string,
description=["The order to list database engine types in."],
default="asc",
choices=["desc", "asc"],
),
- order_by=SpecField(
+ "order_by": SpecField(
type=FieldType.string,
description=["The attribute to order database engine types by."],
),
- filters=SpecField(
+ "filters": SpecField(
type=FieldType.list,
element_type=FieldType.dict,
suboptions=spec_filter,
@@ -71,14 +71,14 @@
"A list of filters to apply to the resulting database engine types."
],
),
- count=SpecField(
+ "count": SpecField(
type=FieldType.integer,
description=[
"The number of results to return.",
"If undefined, all results will be returned.",
],
),
-)
+}
SPECDOC_META = SpecDocMeta(
description=["List and filter on Managed Database engine types."],
@@ -86,8 +86,8 @@
author=global_authors,
options=spec,
examples=docs.specdoc_examples,
- return_values=dict(
- engines=SpecReturnValue(
+ return_values={
+ "engines": SpecReturnValue(
description="The returned database engine types.",
docs_url="https://www.linode.com/docs/api/databases/"
"#managed-database-engines-list__response-samples",
@@ -95,7 +95,7 @@
elements=FieldType.dict,
sample=docs.result_engines_samples,
)
- ),
+ },
)
diff --git a/plugins/modules/database_list.py b/plugins/modules/database_list.py
index 05db94fb..ffb24e39 100644
--- a/plugins/modules/database_list.py
+++ b/plugins/modules/database_list.py
@@ -5,7 +5,6 @@
from __future__ import absolute_import, division, print_function
-# pylint: disable=unused-import
from typing import Any, Dict, Optional
import ansible_collections.linode.cloud.plugins.module_utils.doc_fragments.database_list as docs
@@ -27,8 +26,8 @@
SpecReturnValue,
)
-spec_filter = dict(
- name=SpecField(
+spec_filter = {
+ "name": SpecField(
type=FieldType.string,
required=True,
description=[
@@ -40,7 +39,7 @@
),
],
),
- values=SpecField(
+ "values": SpecField(
type=FieldType.list,
element_type=FieldType.string,
required=True,
@@ -49,36 +48,36 @@
"Fields will pass this filter if at least one of these values matches.",
],
),
-)
+}
-spec = dict(
+spec = {
# Disable the default values
- state=SpecField(type=FieldType.string, required=False, doc_hide=True),
- label=SpecField(type=FieldType.string, required=False, doc_hide=True),
- order=SpecField(
+ "state": SpecField(type=FieldType.string, required=False, doc_hide=True),
+ "label": SpecField(type=FieldType.string, required=False, doc_hide=True),
+ "order": SpecField(
type=FieldType.string,
description=["The order to list databases in."],
default="asc",
choices=["desc", "asc"],
),
- order_by=SpecField(
+ "order_by": SpecField(
type=FieldType.string,
description=["The attribute to order databases by."],
),
- filters=SpecField(
+ "filters": SpecField(
type=FieldType.list,
element_type=FieldType.dict,
suboptions=spec_filter,
description=["A list of filters to apply to the resulting databases."],
),
- count=SpecField(
+ "count": SpecField(
type=FieldType.integer,
description=[
"The number of results to return.",
"If undefined, all results will be returned.",
],
),
-)
+}
SPECDOC_META = SpecDocMeta(
description=["List and filter on Linode Managed Databases."],
@@ -86,8 +85,8 @@
author=global_authors,
options=spec,
examples=docs.specdoc_examples,
- return_values=dict(
- databases=SpecReturnValue(
+ return_values={
+ "databases": SpecReturnValue(
description="The returned database.",
docs_url="https://www.linode.com/docs/api/databases/"
"#managed-databases-list-all__response-samples",
@@ -95,7 +94,7 @@
elements=FieldType.dict,
sample=docs.result_images_samples,
)
- ),
+ },
)
diff --git a/plugins/modules/database_mysql.py b/plugins/modules/database_mysql.py
index fe0eb832..b86cfd09 100644
--- a/plugins/modules/database_mysql.py
+++ b/plugins/modules/database_mysql.py
@@ -5,7 +5,6 @@
from __future__ import absolute_import, division, print_function
-# pylint: disable=unused-import
from typing import Any, Optional, Set
import ansible_collections.linode.cloud.plugins.module_utils.doc_fragments.database_mysql as docs
@@ -38,19 +37,19 @@
from linode_api4 import ApiError
from linode_api4.objects import MySQLDatabase
-SPEC = dict(
- label=SpecField(
+SPEC = {
+ "label": SpecField(
type=FieldType.string,
required=True,
description=["This database's unique label."],
),
- state=SpecField(
+ "state": SpecField(
type=FieldType.string,
choices=["present", "absent"],
required=True,
description=["The state of this database."],
),
- allow_list=SpecField(
+ "allow_list": SpecField(
type=FieldType.list,
element_type=FieldType.string,
description=[
@@ -60,7 +59,7 @@
default=[],
editable=True,
),
- cluster_size=SpecField(
+ "cluster_size": SpecField(
type=FieldType.integer,
description=[
"The number of Linode Instance nodes deployed to the Managed Database."
@@ -68,19 +67,19 @@
choices=[1, 3],
default=1,
),
- encrypted=SpecField(
+ "encrypted": SpecField(
type=FieldType.bool,
description=["Whether the Managed Databases is encrypted."],
),
- engine=SpecField(
+ "engine": SpecField(
type=FieldType.string,
description=["The Managed Database engine in engine/version format."],
),
- region=SpecField(
+ "region": SpecField(
type=FieldType.string,
description=["The Region ID for the Managed Database."],
),
- replication_type=SpecField(
+ "replication_type": SpecField(
type=FieldType.string,
description=[
"The replication method used for the Managed Database.",
@@ -92,7 +91,7 @@
choices=["none", "asynch", "semi_synch"],
default="none",
),
- ssl_connection=SpecField(
+ "ssl_connection": SpecField(
type=FieldType.bool,
description=[
"Whether to require SSL credentials to "
@@ -100,14 +99,14 @@
],
default=True,
),
- type=SpecField(
+ "type": SpecField(
type=FieldType.string,
description=[
"The Linode Instance type used by the "
"Managed Database for its nodes."
],
),
- updates=SpecField(
+ "updates": SpecField(
type=FieldType.dict,
suboptions=SPEC_UPDATE_WINDOW,
description=[
@@ -116,14 +115,14 @@
],
editable=True,
),
- wait=SpecField(
+ "wait": SpecField(
type=FieldType.bool,
default=True,
description=[
"Wait for the database to have status `available` before returning."
],
),
- wait_timeout=SpecField(
+ "wait_timeout": SpecField(
type=FieldType.integer,
default=3600,
description=[
@@ -131,7 +130,7 @@
"have status `available`."
],
),
-)
+}
SPECDOC_META = SpecDocMeta(
description=["Manage a Linode MySQL database."],
@@ -139,36 +138,36 @@
author=global_authors,
options=SPEC,
examples=docs.specdoc_examples,
- return_values=dict(
- database=SpecReturnValue(
+ return_values={
+ "database": SpecReturnValue(
description="The database in JSON serialized form.",
docs_url="https://www.linode.com/docs/api/databases/"
"#managed-mysql-database-view__response-samples",
type=FieldType.dict,
sample=docs.result_database_samples,
),
- backups=SpecReturnValue(
+ "backups": SpecReturnValue(
description="The database backups in JSON serialized form.",
docs_url="https://www.linode.com/docs/api/databases/"
"#managed-mysql-database-backup-view__responses",
type=FieldType.dict,
sample=docs.result_backups_samples,
),
- ssl_cert=SpecReturnValue(
+ "ssl_cert": SpecReturnValue(
description="The SSL CA certificate for an accessible Managed MySQL Database.",
docs_url="https://www.linode.com/docs/api/databases/"
"#managed-mysql-database-ssl-certificate-view__responses",
type=FieldType.dict,
sample=docs.result_ssl_cert_samples,
),
- credentials=SpecReturnValue(
+ "credentials": SpecReturnValue(
description="The root username and password for an accessible Managed MySQL Database.",
docs_url="https://www.linode.com/docs/api/databases/"
"#managed-mysql-database-credentials-view__responses",
type=FieldType.dict,
sample=docs.result_credentials_samples,
),
- ),
+ },
)
MUTABLE_FIELDS = {"allow_list", "updates"}
@@ -179,14 +178,14 @@ class Module(LinodeModuleBase):
def __init__(self) -> None:
self.module_arg_spec = SPECDOC_META.ansible_spec
- self.results = dict(
- changed=False,
- actions=[],
- database=None,
- backups=None,
- credentials=None,
- ssl_cert=None,
- )
+ self.results = {
+ "changed": False,
+ "actions": [],
+ "database": None,
+ "backups": None,
+ "credentials": None,
+ "ssl_cert": None,
+ }
super().__init__(
module_arg_spec=self.module_arg_spec,
diff --git a/plugins/modules/database_mysql_info.py b/plugins/modules/database_mysql_info.py
index dd74233f..a2908c9c 100644
--- a/plugins/modules/database_mysql_info.py
+++ b/plugins/modules/database_mysql_info.py
@@ -5,7 +5,6 @@
from __future__ import absolute_import, division, print_function
-# pylint: disable=unused-import
from typing import Any, Optional
from ansible_collections.linode.cloud.plugins.module_utils.doc_fragments import (
@@ -37,20 +36,20 @@
)
from linode_api4 import MySQLDatabase
-spec = dict(
+spec = {
# Disable the default values
- state=SpecField(type=FieldType.string, required=False, doc_hide=True),
- id=SpecField(
+ "state": SpecField(type=FieldType.string, required=False, doc_hide=True),
+ "id": SpecField(
type=FieldType.string,
conflicts_with=["label"],
description=["The ID of the MySQL Database."],
),
- label=SpecField(
+ "label": SpecField(
type=FieldType.string,
conflicts_with=["id"],
description=["The label of the MySQL Database."],
),
-)
+}
SPECDOC_META = SpecDocMeta(
description=["Get info about a Linode MySQL Managed Database."],
@@ -58,29 +57,29 @@
author=global_authors,
options=spec,
examples=docs.specdoc_examples,
- return_values=dict(
- database=SpecReturnValue(
+ return_values={
+ "database": SpecReturnValue(
description="The database in JSON serialized form.",
docs_url="https://www.linode.com/docs/api/databases/"
"#managed-mysql-database-view__response-samples",
type=FieldType.dict,
sample=docs_parent.result_database_samples,
),
- backups=SpecReturnValue(
+ "backups": SpecReturnValue(
description="The database backups in JSON serialized form.",
docs_url="https://www.linode.com/docs/api/databases/"
"#managed-mysql-database-backup-view__responses",
type=FieldType.dict,
sample=docs_parent.result_backups_samples,
),
- ssl_cert=SpecReturnValue(
+ "ssl_cert": SpecReturnValue(
description="The SSL CA certificate for an accessible Managed MySQL Database.",
docs_url="https://www.linode.com/docs/api/databases/"
"#managed-mysql-database-ssl-certificate-view__responses",
type=FieldType.dict,
sample=docs_parent.result_ssl_cert_samples,
),
- credentials=SpecReturnValue(
+ "credentials": SpecReturnValue(
description="The root username and password for an accessible Managed MySQL Database.",
docs_url="https://www.linode.com/docs/api/databases/"
"#managed-mysql-database-credenti"
@@ -88,7 +87,7 @@
type=FieldType.dict,
sample=docs_parent.result_credentials_samples,
),
- ),
+ },
)
diff --git a/plugins/modules/database_postgresql.py b/plugins/modules/database_postgresql.py
index 4ae87d7a..9a43edf2 100644
--- a/plugins/modules/database_postgresql.py
+++ b/plugins/modules/database_postgresql.py
@@ -5,7 +5,6 @@
from __future__ import absolute_import, division, print_function
-# pylint: disable=unused-import
from typing import Any, Optional, Set
import polling
@@ -39,19 +38,19 @@
)
from linode_api4 import ApiError, PostgreSQLDatabase
-SPEC = dict(
- label=SpecField(
+SPEC = {
+ "label": SpecField(
type=FieldType.string,
required=True,
description=["This database's unique label."],
),
- state=SpecField(
+ "state": SpecField(
type=FieldType.string,
choices=["present", "absent"],
required=True,
description=["The state of this database."],
),
- allow_list=SpecField(
+ "allow_list": SpecField(
type=FieldType.list,
element_type=FieldType.string,
description=[
@@ -61,7 +60,7 @@
default=[],
editable=True,
),
- cluster_size=SpecField(
+ "cluster_size": SpecField(
type=FieldType.integer,
description=[
"The number of Linode Instance nodes deployed to the Managed Database."
@@ -69,19 +68,19 @@
choices=[1, 3],
default=1,
),
- encrypted=SpecField(
+ "encrypted": SpecField(
type=FieldType.bool,
description=["Whether the Managed Databases is encrypted."],
),
- engine=SpecField(
+ "engine": SpecField(
type=FieldType.string,
description=["The Managed Database engine in engine/version format."],
),
- region=SpecField(
+ "region": SpecField(
type=FieldType.string,
description=["The Region ID for the Managed Database."],
),
- replication_type=SpecField(
+ "replication_type": SpecField(
type=FieldType.string,
description=[
"The replication method used for the Managed Database.",
@@ -93,7 +92,7 @@
choices=["none", "asynch", "semi_synch"],
default="none",
),
- replication_commit_type=SpecField(
+ "replication_commit_type": SpecField(
type=FieldType.string,
description=[
"The synchronization level of the replicating server.",
@@ -103,7 +102,7 @@
choices=["off", "on", "local", "remote_write", "remote_apply"],
default="local",
),
- ssl_connection=SpecField(
+ "ssl_connection": SpecField(
type=FieldType.bool,
description=[
"Whether to require SSL credentials to "
@@ -111,14 +110,14 @@
],
default=True,
),
- type=SpecField(
+ "type": SpecField(
type=FieldType.string,
description=[
"The Linode Instance type used by the "
"Managed Database for its nodes."
],
),
- updates=SpecField(
+ "updates": SpecField(
type=FieldType.dict,
suboptions=SPEC_UPDATE_WINDOW,
description=[
@@ -127,14 +126,14 @@
],
editable=True,
),
- wait=SpecField(
+ "wait": SpecField(
type=FieldType.bool,
default=True,
description=[
"Wait for the database to have status `available` before returning."
],
),
- wait_timeout=SpecField(
+ "wait_timeout": SpecField(
type=FieldType.integer,
default=3600,
description=[
@@ -142,7 +141,7 @@
"have status `available`."
],
),
-)
+}
SPECDOC_META = SpecDocMeta(
description=["Manage a Linode PostgreSQL database."],
@@ -150,29 +149,29 @@
author=global_authors,
options=SPEC,
examples=docs.specdoc_examples,
- return_values=dict(
- database=SpecReturnValue(
+ return_values={
+ "database": SpecReturnValue(
description="The database in JSON serialized form.",
docs_url="https://www.linode.com/docs/api/databases/"
"#managed-postgresql-database-view__response-samples",
type=FieldType.dict,
sample=docs.result_database_samples,
),
- backups=SpecReturnValue(
+ "backups": SpecReturnValue(
description="The database backups in JSON serialized form.",
docs_url="https://www.linode.com/docs/api/databases/#"
"managed-postgresql-database-backups-list",
type=FieldType.dict,
sample=docs.result_backups_samples,
),
- ssl_cert=SpecReturnValue(
+ "ssl_cert": SpecReturnValue(
description="The SSL CA certificate for an accessible Managed PostgreSQL Database.",
docs_url="https://www.linode.com/docs/api/databases/"
"#managed-postgresql-database-ssl-certificate-view__responses",
type=FieldType.dict,
sample=docs.result_ssl_cert_samples,
),
- credentials=SpecReturnValue(
+ "credentials": SpecReturnValue(
description="The root username and password for an "
"accessible Managed PostgreSQL Database.",
docs_url="https://www.linode.com/docs/api/databases/"
@@ -180,7 +179,7 @@
type=FieldType.dict,
sample=docs.result_credentials_samples,
),
- ),
+ },
)
MUTABLE_FIELDS = {"allow_list", "updates"}
@@ -191,14 +190,14 @@ class Module(LinodeModuleBase):
def __init__(self) -> None:
self.module_arg_spec = SPECDOC_META.ansible_spec
- self.results = dict(
- changed=False,
- actions=[],
- database=None,
- backups=None,
- credentials=None,
- ssl_cert=None,
- )
+ self.results = {
+ "changed": False,
+ "actions": [],
+ "database": None,
+ "backups": None,
+ "credentials": None,
+ "ssl_cert": None,
+ }
super().__init__(
module_arg_spec=self.module_arg_spec,
diff --git a/plugins/modules/database_postgresql_info.py b/plugins/modules/database_postgresql_info.py
index ab2b0bee..cef230cc 100644
--- a/plugins/modules/database_postgresql_info.py
+++ b/plugins/modules/database_postgresql_info.py
@@ -5,7 +5,6 @@
from __future__ import absolute_import, division, print_function
-# pylint: disable=unused-import
from typing import Any, Optional
from ansible_collections.linode.cloud.plugins.module_utils.doc_fragments import (
@@ -37,20 +36,20 @@
)
from linode_api4 import PostgreSQLDatabase
-spec = dict(
+spec = {
# Disable the default values
- state=SpecField(type=FieldType.string, required=False, doc_hide=True),
- id=SpecField(
+ "state": SpecField(type=FieldType.string, required=False, doc_hide=True),
+ "id": SpecField(
type=FieldType.string,
conflicts_with=["label"],
description=["The ID of the PostgreSQL Database."],
),
- label=SpecField(
+ "label": SpecField(
type=FieldType.string,
conflicts_with=["id"],
description=["The label of the PostgreSQL Database."],
),
-)
+}
SPECDOC_META = SpecDocMeta(
description=["Get info about a Linode PostgreSQL Managed Database."],
@@ -58,29 +57,29 @@
author=global_authors,
options=spec,
examples=docs.specdoc_examples,
- return_values=dict(
- database=SpecReturnValue(
+ return_values={
+ "database": SpecReturnValue(
description="The database in JSON serialized form.",
docs_url="https://www.linode.com/docs/api/databases/"
"#managed-postgresql-database-view__response-samples",
type=FieldType.dict,
sample=docs_parent.result_database_samples,
),
- backups=SpecReturnValue(
+ "backups": SpecReturnValue(
description="The database backups in JSON serialized form.",
docs_url="https://www.linode.com/docs/api/databases/"
"#managed-postgresql-database-backups-list__response-samples",
type=FieldType.dict,
sample=docs_parent.result_backups_samples,
),
- ssl_cert=SpecReturnValue(
+ "ssl_cert": SpecReturnValue(
description="The SSL CA certificate for an accessible Managed PostgreSQL Database.",
docs_url="https://www.linode.com/docs/api/databases/"
"#managed-postgresql-database-ssl-certificate-view",
type=FieldType.dict,
sample=docs_parent.result_ssl_cert_samples,
),
- credentials=SpecReturnValue(
+ "credentials": SpecReturnValue(
description="The root username and password for an accessible Managed "
"PostgreSQL Database.",
docs_url="https://www.linode.com/docs/api/databases/"
@@ -88,7 +87,7 @@
type=FieldType.dict,
sample=docs_parent.result_credentials_samples,
),
- ),
+ },
)
diff --git a/plugins/modules/domain.py b/plugins/modules/domain.py
index e21d27c3..ac0db60f 100644
--- a/plugins/modules/domain.py
+++ b/plugins/modules/domain.py
@@ -5,7 +5,6 @@
from __future__ import absolute_import, division, print_function
-# pylint: disable=unused-import
from typing import Any, List, Optional, Set
import ansible_collections.linode.cloud.plugins.module_utils.doc_fragments.domain as docs
@@ -28,10 +27,10 @@
)
from linode_api4 import Domain
-linode_domain_spec = dict(
+linode_domain_spec = {
# Unused for domain objects
- label=SpecField(type=FieldType.string, required=False, doc_hide=True),
- axfr_ips=SpecField(
+ "label": SpecField(type=FieldType.string, required=False, doc_hide=True),
+ "axfr_ips": SpecField(
type=FieldType.list,
element_type=FieldType.string,
editable=True,
@@ -39,7 +38,7 @@
"The list of IPs that may perform a zone transfer for this Domain."
],
),
- description=SpecField(
+ "description": SpecField(
type=FieldType.string,
editable=True,
description=[
@@ -47,12 +46,12 @@
"zone transfer for this Domain."
],
),
- domain=SpecField(
+ "domain": SpecField(
type=FieldType.string,
required=True,
description=["The domain this Domain represents."],
),
- expire_sec=SpecField(
+ "expire_sec": SpecField(
type=FieldType.integer,
editable=True,
description=[
@@ -60,7 +59,7 @@
" before this Domain is no longer authoritative."
],
),
- master_ips=SpecField(
+ "master_ips": SpecField(
type=FieldType.list,
element_type=FieldType.string,
editable=True,
@@ -68,7 +67,7 @@
"The IP addresses representing the master DNS for this Domain."
],
),
- refresh_sec=SpecField(
+ "refresh_sec": SpecField(
type=FieldType.integer,
editable=True,
description=[
@@ -76,7 +75,7 @@
"this Domain should be refreshed."
],
),
- retry_sec=SpecField(
+ "retry_sec": SpecField(
type=FieldType.integer,
editable=True,
description=[
@@ -84,12 +83,12 @@
"failed refresh should be retried."
],
),
- soa_email=SpecField(
+ "soa_email": SpecField(
type=FieldType.string,
description=["The Start of Authority email address."],
editable=True,
),
- status=SpecField(
+ "status": SpecField(
type=FieldType.string,
description=[
"Used to control whether this Domain is "
@@ -97,19 +96,19 @@
],
editable=True,
),
- state=SpecField(
+ "state": SpecField(
type=FieldType.string,
description=["The desired state of the target."],
choices=["present", "absent"],
required=True,
),
- tags=SpecField(
+ "tags": SpecField(
type=FieldType.list,
element_type=FieldType.string,
editable=True,
description=["An array of tags applied to this object."],
),
- ttl_sec=SpecField(
+ "ttl_sec": SpecField(
type=FieldType.integer,
editable=True,
description=[
@@ -118,7 +117,7 @@
"or other domain servers."
],
),
- type=SpecField(
+ "type": SpecField(
type=FieldType.string,
editable=True,
description=[
@@ -129,8 +128,8 @@
],
),
# Deprecated
- group=SpecField(type=FieldType.string, doc_hide=True),
-)
+ "group": SpecField(type=FieldType.string, doc_hide=True),
+}
SPECDOC_META = SpecDocMeta(
description=["Manage Linode Domains."],
@@ -138,26 +137,26 @@
author=global_authors,
options=linode_domain_spec,
examples=docs.specdoc_examples,
- return_values=dict(
- domain=SpecReturnValue(
+ return_values={
+ "domain": SpecReturnValue(
description="The domain in JSON serialized form.",
docs_url="https://www.linode.com/docs/api/domains/#domain-view",
type=FieldType.dict,
sample=docs.result_domain_samples,
),
- records=SpecReturnValue(
+ "records": SpecReturnValue(
description="The domain record in JSON serialized form.",
docs_url="https://www.linode.com/docs/api/domains/#domain-record-view",
type=FieldType.list,
sample=docs.result_records_samples,
),
- zone_file=SpecReturnValue(
+ "zone_file": SpecReturnValue(
description="The zone file for the last rendered zone for the specified domain.",
docs_url="https://www.linode.com/docs/api/domains/#domain-zone-file-view",
type=FieldType.list,
sample=docs.result_zone_file_samples,
),
- ),
+ },
)
linode_domain_mutable: Set[str] = {
@@ -182,12 +181,12 @@ class LinodeDomain(LinodeModuleBase):
def __init__(self) -> None:
self.module_arg_spec = SPECDOC_META.ansible_spec
self.required_one_of: List[str] = []
- self.results = dict(
- changed=False,
- actions=[],
- domain=None,
- zone_file=None,
- )
+ self.results = {
+ "changed": False,
+ "actions": [],
+ "domain": None,
+ "zone_file": None,
+ }
self._domain: Optional[Domain] = None
diff --git a/plugins/modules/domain_info.py b/plugins/modules/domain_info.py
index c945d907..f26d15f2 100644
--- a/plugins/modules/domain_info.py
+++ b/plugins/modules/domain_info.py
@@ -5,7 +5,6 @@
from __future__ import absolute_import, division, print_function
-# pylint: disable=unused-import
from typing import Any, List, Optional
import ansible_collections.linode.cloud.plugins.module_utils.doc_fragments.domain as docs_parent
@@ -29,11 +28,11 @@
)
from linode_api4 import Domain
-linode_domain_info_spec = dict(
+linode_domain_info_spec = {
# We need to overwrite attributes to exclude them as requirements
- state=SpecField(type=FieldType.string, required=False, doc_hide=True),
- label=SpecField(type=FieldType.string, required=False, doc_hide=True),
- id=SpecField(
+ "state": SpecField(type=FieldType.string, required=False, doc_hide=True),
+ "label": SpecField(type=FieldType.string, required=False, doc_hide=True),
+ "id": SpecField(
type=FieldType.integer,
required=False,
conflicts_with=["domain"],
@@ -42,7 +41,7 @@
"Optional if `domain` is defined.",
],
),
- domain=SpecField(
+ "domain": SpecField(
type=FieldType.string,
required=False,
conflicts_with=["id"],
@@ -51,7 +50,7 @@
"Optional if `id` is defined.",
],
),
-)
+}
SPECDOC_META = SpecDocMeta(
description=["Get info about a Linode Domain."],
@@ -59,26 +58,26 @@
author=global_authors,
options=linode_domain_info_spec,
examples=docs.specdoc_examples,
- return_values=dict(
- domain=SpecReturnValue(
+ return_values={
+ "domain": SpecReturnValue(
description="The domain in JSON serialized form.",
docs_url="https://www.linode.com/docs/api/domains/#domain-view",
type=FieldType.dict,
sample=docs_parent.result_domain_samples,
),
- records=SpecReturnValue(
+ "records": SpecReturnValue(
description="The domain record in JSON serialized form.",
docs_url="https://www.linode.com/docs/api/domains/#domain-record-view",
type=FieldType.list,
sample=docs_parent.result_records_samples,
),
- zone_file=SpecReturnValue(
+ "zone_file": SpecReturnValue(
description="The zone file for the last rendered zone for the specified domain.",
docs_url="https://www.linode.com/docs/api/domains/#domain-zone-file-view",
type=FieldType.list,
sample=docs_parent.result_zone_file_samples,
),
- ),
+ },
)
linode_domain_valid_filters = ["id", "domain"]
@@ -90,7 +89,7 @@ class LinodeDomainInfo(LinodeModuleBase):
def __init__(self) -> None:
self.module_arg_spec = SPECDOC_META.ansible_spec
self.required_one_of: List[str] = []
- self.results = dict(domain=None, records=None, zone_file=None)
+ self.results = {"domain": None, "records": None, "zone_file": None}
super().__init__(
module_arg_spec=self.module_arg_spec,
diff --git a/plugins/modules/domain_list.py b/plugins/modules/domain_list.py
index 1e9e5573..aee35a60 100644
--- a/plugins/modules/domain_list.py
+++ b/plugins/modules/domain_list.py
@@ -24,8 +24,8 @@
SpecReturnValue,
)
-spec_filter = dict(
- name=SpecField(
+spec_filter = {
+ "name": SpecField(
type=FieldType.string,
required=True,
description=[
@@ -35,7 +35,7 @@
"#domains-list__responses",
],
),
- values=SpecField(
+ "values": SpecField(
type=FieldType.list,
element_type=FieldType.string,
required=True,
@@ -44,36 +44,36 @@
"Fields will pass this filter if at least one of these values matches.",
],
),
-)
+}
-spec = dict(
+spec = {
# Disable the default values
- state=SpecField(type=FieldType.string, required=False, doc_hide=True),
- label=SpecField(type=FieldType.string, required=False, doc_hide=True),
- order=SpecField(
+ "state": SpecField(type=FieldType.string, required=False, doc_hide=True),
+ "label": SpecField(type=FieldType.string, required=False, doc_hide=True),
+ "order": SpecField(
type=FieldType.string,
description=["The order to list domains in."],
default="asc",
choices=["desc", "asc"],
),
- order_by=SpecField(
+ "order_by": SpecField(
type=FieldType.string,
description=["The attribute to order domains by."],
),
- filters=SpecField(
+ "filters": SpecField(
type=FieldType.list,
element_type=FieldType.dict,
suboptions=spec_filter,
description=["A list of filters to apply to the resulting domains."],
),
- count=SpecField(
+ "count": SpecField(
type=FieldType.integer,
description=[
"The number of results to return.",
"If undefined, all results will be returned.",
],
),
-)
+}
SPECDOC_META = SpecDocMeta(
description=["List and filter on Domains."],
@@ -81,8 +81,8 @@
author=global_authors,
options=spec,
examples=docs.specdoc_examples,
- return_values=dict(
- domains=SpecReturnValue(
+ return_values={
+ "domains": SpecReturnValue(
description="The returned domains.",
docs_url="https://www.linode.com/docs/api/domains/"
"#domains-list__response-samples",
@@ -90,7 +90,7 @@
elements=FieldType.dict,
sample=docs.result_domains_samples,
)
- ),
+ },
)
diff --git a/plugins/modules/domain_record.py b/plugins/modules/domain_record.py
index 3728750d..ff5fbec0 100644
--- a/plugins/modules/domain_record.py
+++ b/plugins/modules/domain_record.py
@@ -5,7 +5,6 @@
from __future__ import absolute_import, division, print_function
-# pylint: disable=unused-import
from typing import Any, List, Optional, Set
import ansible_collections.linode.cloud.plugins.module_utils.doc_fragments.domain_record as docs
@@ -27,21 +26,21 @@
)
from linode_api4 import Domain, DomainRecord
-linode_domain_record_spec = dict(
+linode_domain_record_spec = {
# Unused for domain record objects
- label=SpecField(type=FieldType.string, required=False, doc_hide=True),
- domain_id=SpecField(
+ "label": SpecField(type=FieldType.string, required=False, doc_hide=True),
+ "domain_id": SpecField(
type=FieldType.integer, description=["The ID of the parent Domain."]
),
- domain=SpecField(
+ "domain": SpecField(
type=FieldType.string, description=["The name of the parent Domain."]
),
- record_id=SpecField(
+ "record_id": SpecField(
type=FieldType.integer,
conflicts_with=["name"],
description=["The id of the record to modify."],
),
- name=SpecField(
+ "name": SpecField(
type=FieldType.string,
conflicts_with=["record_id"],
description=[
@@ -50,7 +49,7 @@
"it will be dropped from the resulting record's name.",
],
),
- port=SpecField(
+ "port": SpecField(
type=FieldType.integer,
editable=True,
description=[
@@ -58,7 +57,7 @@
"Only valid and required for SRV record requests.",
],
),
- priority=SpecField(
+ "priority": SpecField(
type=FieldType.integer,
editable=True,
description=[
@@ -68,7 +67,7 @@
"Required for SRV record requests.",
],
),
- protocol=SpecField(
+ "protocol": SpecField(
type=FieldType.string,
editable=True,
description=[
@@ -77,7 +76,7 @@
"the submitted value for this property.",
],
),
- service=SpecField(
+ "service": SpecField(
type=FieldType.string,
editable=True,
description=[
@@ -87,13 +86,13 @@
"The name of the service.",
],
),
- state=SpecField(
+ "state": SpecField(
type=FieldType.string,
description=["The desired state of the target."],
choices=["present", "absent"],
required=True,
),
- tag=SpecField(
+ "tag": SpecField(
type=FieldType.string,
editable=True,
description=[
@@ -101,12 +100,12 @@
"Only valid and required for CAA record requests.",
],
),
- target=SpecField(
+ "target": SpecField(
type=FieldType.string,
description=["The target for this Record."],
default="",
),
- ttl_sec=SpecField(
+ "ttl_sec": SpecField(
type=FieldType.integer,
editable=True,
description=[
@@ -115,11 +114,11 @@
"or other domain servers."
],
),
- type=SpecField(
+ "type": SpecField(
type=FieldType.string,
description=["The type of Record this is in the DNS system."],
),
- weight=SpecField(
+ "weight": SpecField(
type=FieldType.integer,
editable=True,
description=[
@@ -127,7 +126,7 @@
"used in the case of identical priority."
],
),
-)
+}
SPECDOC_META = SpecDocMeta(
description=[
@@ -138,14 +137,14 @@
author=global_authors,
options=linode_domain_record_spec,
examples=docs.specdoc_examples,
- return_values=dict(
- record=SpecReturnValue(
+ return_values={
+ "record": SpecReturnValue(
description="View a single Record on this Domain.",
docs_url="https://www.linode.com/docs/api/domains/#domain-record-view",
type=FieldType.dict,
sample=docs.result_record_samples,
)
- ),
+ },
)
linode_domain_record_mutable: Set[str] = {
@@ -170,11 +169,7 @@ def __init__(self) -> None:
]
self.mutually_exclusive: List[List[str]] = [["name", "record_id"]]
self.required_together: List[List[str]] = [["name", "type"]]
- self.results = dict(
- changed=False,
- actions=[],
- record=None,
- )
+ self.results = {"changed": False, "actions": [], "record": None}
self._domain: Optional[Domain] = None
self._record: Optional[DomainRecord] = None
diff --git a/plugins/modules/domain_record_info.py b/plugins/modules/domain_record_info.py
index 6d32c80d..aab0ae9b 100644
--- a/plugins/modules/domain_record_info.py
+++ b/plugins/modules/domain_record_info.py
@@ -5,7 +5,6 @@
from __future__ import absolute_import, division, print_function
-# pylint: disable=unused-import
from typing import Any, Dict, List, Optional
from ansible_collections.linode.cloud.plugins.module_utils.doc_fragments import (
@@ -32,11 +31,11 @@
)
from linode_api4 import Domain, DomainRecord
-linode_domain_record_info_spec = dict(
+linode_domain_record_info_spec = {
# We need to overwrite attributes to exclude them as requirements
- state=SpecField(type=FieldType.string, required=False, doc_hide=True),
- label=SpecField(type=FieldType.string, required=False, doc_hide=True),
- domain_id=SpecField(
+ "state": SpecField(type=FieldType.string, required=False, doc_hide=True),
+ "label": SpecField(type=FieldType.string, required=False, doc_hide=True),
+ "domain_id": SpecField(
type=FieldType.integer,
conflicts_with=["domain"],
description=[
@@ -44,7 +43,7 @@
"Optional if `domain` is defined.",
],
),
- domain=SpecField(
+ "domain": SpecField(
type=FieldType.string,
conflicts_with=["domain_id"],
description=[
@@ -52,7 +51,7 @@
"Optional if `domain_id` is defined.",
],
),
- id=SpecField(
+ "id": SpecField(
type=FieldType.integer,
conflicts_with=["name"],
description=[
@@ -60,7 +59,7 @@
"Optional if `name` is defined.",
],
),
- name=SpecField(
+ "name": SpecField(
type=FieldType.string,
conflicts_with=["id"],
description=[
@@ -68,7 +67,7 @@
"Optional if `id` is defined.",
],
),
-)
+}
SPECDOC_META = SpecDocMeta(
description=["Get info about a Linode Domain Record."],
@@ -76,14 +75,14 @@
author=global_authors,
options=linode_domain_record_info_spec,
examples=docs.specdoc_examples,
- return_values=dict(
- record=SpecReturnValue(
+ return_values={
+ "record": SpecReturnValue(
description="View a single Record on this Domain.",
docs_url="https://www.linode.com/docs/api/domains/#domain-record-view",
type=FieldType.dict,
sample=docs_parent.result_record_samples,
)
- ),
+ },
)
@@ -96,7 +95,7 @@ def __init__(self) -> None:
["domain_id", "domain"],
["id", "name"],
]
- self.results: Dict[Any, Any] = dict(records=[])
+ self.results: Dict[Any, Any] = {"records": []}
super().__init__(
module_arg_spec=self.module_arg_spec,
diff --git a/plugins/modules/event_list.py b/plugins/modules/event_list.py
index 60e38278..5f85c8d7 100644
--- a/plugins/modules/event_list.py
+++ b/plugins/modules/event_list.py
@@ -5,7 +5,6 @@
from __future__ import absolute_import, division, print_function
-# pylint: disable=unused-import
from typing import Any, Dict, Optional
import ansible_collections.linode.cloud.plugins.module_utils.doc_fragments.event_list as docs
@@ -27,8 +26,8 @@
SpecReturnValue,
)
-spec_filter = dict(
- name=SpecField(
+spec_filter = {
+ "name": SpecField(
type=FieldType.string,
required=True,
description=[
@@ -37,7 +36,7 @@
"https://www.linode.com/docs/api/account/#events-list__responses",
],
),
- values=SpecField(
+ "values": SpecField(
type=FieldType.list,
element_type=FieldType.string,
required=True,
@@ -46,35 +45,35 @@
"Fields will pass this filter if at least one of these values matches.",
],
),
-)
+}
-spec = dict(
+spec = {
# Disable the default values
- state=SpecField(type=FieldType.string, required=False, doc_hide=True),
- label=SpecField(type=FieldType.string, required=False, doc_hide=True),
- order=SpecField(
+ "state": SpecField(type=FieldType.string, required=False, doc_hide=True),
+ "label": SpecField(type=FieldType.string, required=False, doc_hide=True),
+ "order": SpecField(
type=FieldType.string,
description=["The order to list events in."],
default="asc",
choices=["desc", "asc"],
),
- order_by=SpecField(
+ "order_by": SpecField(
type=FieldType.string, description=["The attribute to order events by."]
),
- filters=SpecField(
+ "filters": SpecField(
type=FieldType.list,
element_type=FieldType.dict,
suboptions=spec_filter,
description=["A list of filters to apply to the resulting events."],
),
- count=SpecField(
+ "count": SpecField(
type=FieldType.integer,
description=[
"The number of results to return.",
"If undefined, all results will be returned.",
],
),
-)
+}
SPECDOC_META = SpecDocMeta(
description=["List and filter on Linode events."],
@@ -82,15 +81,15 @@
author=global_authors,
options=spec,
examples=docs.specdoc_examples,
- return_values=dict(
- events=SpecReturnValue(
+ return_values={
+ "events": SpecReturnValue(
description="The returned events.",
docs_url="https://www.linode.com/docs/api/account/#events-list__responses",
type=FieldType.list,
elements=FieldType.dict,
sample=docs.result_events_samples,
)
- ),
+ },
)
diff --git a/plugins/modules/firewall.py b/plugins/modules/firewall.py
index 74f6714a..509665f8 100644
--- a/plugins/modules/firewall.py
+++ b/plugins/modules/firewall.py
@@ -36,8 +36,8 @@
# handled in module_utils.linode_common
pass
-linode_firewall_addresses_spec: dict = dict(
- ipv4=SpecField(
+linode_firewall_addresses_spec: dict = {
+ "ipv4": SpecField(
type=FieldType.list,
element_type=FieldType.string,
description=[
@@ -45,7 +45,7 @@
"Must be in IP/mask format.",
],
),
- ipv6=SpecField(
+ "ipv6": SpecField(
type=FieldType.list,
element_type=FieldType.string,
description=[
@@ -53,15 +53,15 @@
"Must be in IP/mask format.",
],
),
-)
+}
-linode_firewall_rule_spec: dict = dict(
- label=SpecField(
+linode_firewall_rule_spec: dict = {
+ "label": SpecField(
type=FieldType.string,
required=True,
description=["The label of this rule."],
),
- action=SpecField(
+ "action": SpecField(
type=FieldType.string,
choices=["ACCEPT", "DROP"],
required=True,
@@ -69,76 +69,77 @@
"Controls whether traffic is accepted or dropped by this rule."
],
),
- addresses=SpecField(
+ "addresses": SpecField(
type=FieldType.dict,
suboptions=linode_firewall_addresses_spec,
description=["Allowed IPv4 or IPv6 addresses."],
),
- description=SpecField(
+ "description": SpecField(
type=FieldType.string, description=["A description for this rule."]
),
- ports=SpecField(
+ "ports": SpecField(
type=FieldType.string,
description=[
"A string representing the port or ports on which traffic will be allowed.",
- "See U(https://www.linode.com/docs/api/networking/#firewall-create)",
+ "See https://www.linode.com/docs/api/networking/#firewall-create",
],
),
- protocol=SpecField(
+ "protocol": SpecField(
type=FieldType.string,
description=["The type of network traffic to allow."],
),
-)
+}
-linode_firewall_rules_spec: dict = dict(
- inbound=SpecField(
+
+linode_firewall_rules_spec: dict = {
+ "inbound": SpecField(
type=FieldType.list,
element_type=FieldType.dict,
suboptions=linode_firewall_rule_spec,
description=["A list of rules for inbound traffic."],
),
- inbound_policy=SpecField(
+ "inbound_policy": SpecField(
type=FieldType.string,
description=["The default behavior for inbound traffic."],
),
- outbound=SpecField(
+ "outbound": SpecField(
type=FieldType.list,
element_type=FieldType.dict,
suboptions=linode_firewall_rule_spec,
description=["A list of rules for outbound traffic."],
),
- outbound_policy=SpecField(
+ "outbound_policy": SpecField(
type=FieldType.string,
description=["The default behavior for outbound traffic."],
),
-)
+}
-linode_firewall_device_spec: dict = dict(
- id=SpecField(
+linode_firewall_device_spec: dict = {
+ "id": SpecField(
type=FieldType.integer,
required=True,
description=["The unique ID of the device to attach to this Firewall."],
),
- type=SpecField(
+ "type": SpecField(
type=FieldType.string,
default="linode",
description=["The type of device to be attached to this Firewall."],
),
-)
+}
-linode_firewall_spec: dict = dict(
- label=SpecField(
+linode_firewall_spec: dict = {
+ "label": SpecField(
type=FieldType.string,
description=["The unique label to give this Firewall."],
),
- devices=SpecField(
+ "devices": SpecField(
type=FieldType.list,
element_type=FieldType.dict,
suboptions=linode_firewall_device_spec,
editable=True,
description=["The devices that are attached to this Firewall."],
),
- rules=SpecField(
+ "rules": SpecField(
type=FieldType.dict,
suboptions=linode_firewall_rules_spec,
editable=True,
@@ -146,18 +147,18 @@
"The inbound and outbound access rules to apply to this Firewall."
],
),
- status=SpecField(
+ "status": SpecField(
type=FieldType.string,
editable=True,
description=["The status of this Firewall."],
),
- state=SpecField(
+ "state": SpecField(
type=FieldType.string,
description=["The desired state of the target."],
choices=["present", "absent", "update"],
required=True,
),
-)
+}
SPECDOC_META = SpecDocMeta(
description=["Manage Linode Firewalls."],
@@ -165,20 +166,20 @@
author=global_authors,
options=linode_firewall_spec,
examples=docs.specdoc_examples,
- return_values=dict(
- firewall=SpecReturnValue(
+ return_values={
+ "firewall": SpecReturnValue(
description="The Firewall description in JSON serialized form.",
docs_url="https://www.linode.com/docs/api/networking/#firewall-view",
type=FieldType.dict,
sample=docs.result_firewall_samples,
),
- devices=SpecReturnValue(
+ "devices": SpecReturnValue(
description="A list of Firewall devices JSON serialized form.",
docs_url="https://www.linode.com/docs/api/networking/#firewall-device-view",
type=FieldType.list,
sample=docs.result_devices_samples,
),
- ),
+ },
)
# Fields that can be updated on an existing Firewall
@@ -191,9 +192,12 @@ class LinodeFirewall(LinodeModuleBase):
def __init__(self) -> None:
self.module_arg_spec = SPECDOC_META.ansible_spec
- self.results: dict = dict(
- changed=False, actions=[], firewall=None, devices=None
- )
+ self.results: dict = {
+ "changed": False,
+ "actions": [],
+ "firewall": None,
+ "devices": None,
+ }
self._firewall: Optional[Firewall] = None
diff --git a/plugins/modules/firewall_device.py b/plugins/modules/firewall_device.py
index 31cddc97..873924b9 100644
--- a/plugins/modules/firewall_device.py
+++ b/plugins/modules/firewall_device.py
@@ -3,7 +3,6 @@
"""This module contains all of the functionality for Linode Domains."""
-# pylint: disable=unused-import
import copy
from typing import Any, List, Optional
@@ -23,20 +22,20 @@
SpecReturnValue,
)
-MODULE_SPEC = dict(
- firewall_id=SpecField(
+MODULE_SPEC = {
+ "firewall_id": SpecField(
type=FieldType.integer,
required=True,
description=["The ID of the Firewall that contains this device."],
),
- entity_id=SpecField(
+ "entity_id": SpecField(
type=FieldType.integer,
required=True,
description=[
"The ID for this Firewall Device. This will be the ID of the Linode Entity."
],
),
- entity_type=SpecField(
+ "entity_type": SpecField(
type=FieldType.string,
required=True,
description=[
@@ -44,18 +43,18 @@
],
choices=["linode"],
),
- label=SpecField(
+ "label": SpecField(
type=FieldType.string,
required=False,
doc_hide=True,
),
- state=SpecField(
+ "state": SpecField(
type=FieldType.string,
description=["The desired state of the target."],
choices=["present", "absent"],
required=True,
),
-)
+}
SPECDOC_META = SpecDocMeta(
description=["Manage Linode Firewall Devices."],
@@ -63,14 +62,14 @@
author=global_authors,
options=MODULE_SPEC,
examples=docs.specdoc_examples,
- return_values=dict(
- device=SpecReturnValue(
+ return_values={
+ "device": SpecReturnValue(
description="The Firewall Device in JSON serialized form.",
docs_url="https://www.linode.com/docs/api/networking/#firewall-device-view__responses",
type=FieldType.dict,
sample=docs.result_device_samples,
)
- ),
+ },
)
@@ -80,11 +79,11 @@ class LinodeFirewallDevice(LinodeModuleBase):
def __init__(self) -> None:
self.module_arg_spec = SPECDOC_META.ansible_spec
self.required_one_of: List[str] = []
- self.results = dict(
- changed=False,
- actions=[],
- device=None,
- )
+ self.results = {
+ "changed": False,
+ "actions": [],
+ "device": None,
+ }
super().__init__(
module_arg_spec=self.module_arg_spec,
diff --git a/plugins/modules/firewall_info.py b/plugins/modules/firewall_info.py
index 34190051..a4fec71a 100644
--- a/plugins/modules/firewall_info.py
+++ b/plugins/modules/firewall_info.py
@@ -5,7 +5,6 @@
from __future__ import absolute_import, division, print_function
-# pylint: disable=unused-import
from typing import Any, Dict, List, Optional
import ansible_collections.linode.cloud.plugins.module_utils.doc_fragments.firewall as docs_parent
@@ -29,10 +28,10 @@
)
from linode_api4 import Firewall
-linode_firewall_info_spec = dict(
+linode_firewall_info_spec = {
# We need to overwrite attributes to exclude them as requirements
- state=SpecField(type=FieldType.string, required=False, doc_hide=True),
- id=SpecField(
+ "state": SpecField(type=FieldType.string, required=False, doc_hide=True),
+ "id": SpecField(
type=FieldType.integer,
required=False,
conflicts_with=["label"],
@@ -41,13 +40,13 @@
"Optional if `label` is defined.",
],
),
- label=SpecField(
+ "label": SpecField(
type=FieldType.string,
required=False,
conflicts_with=["id"],
description=["The Firewall’s label.", "Optional if `id` is defined."],
),
-)
+}
SPECDOC_META = SpecDocMeta(
description=["Get info about a Linode Firewall."],
@@ -55,20 +54,20 @@
author=global_authors,
options=linode_firewall_info_spec,
examples=docs.specdoc_examples,
- return_values=dict(
- firewall=SpecReturnValue(
+ return_values={
+ "firewall": SpecReturnValue(
description="The Firewall description in JSON serialized form.",
docs_url="https://www.linode.com/docs/api/networking/#firewall-view",
type=FieldType.dict,
sample=docs_parent.result_firewall_samples,
),
- devices=SpecReturnValue(
+ "devices": SpecReturnValue(
description="A list of Firewall devices JSON serialized form.",
docs_url="https://www.linode.com/docs/api/networking/#firewall-device-view",
type=FieldType.list,
sample=docs_parent.result_devices_samples,
),
- ),
+ },
)
linode_firewall_valid_filters = ["id", "label"]
@@ -80,9 +79,7 @@ class LinodeFirewallInfo(LinodeModuleBase):
def __init__(self) -> None:
self.module_arg_spec = SPECDOC_META.ansible_spec
self.required_one_of: List[str] = []
- self.results: Dict[str, Any] = dict(
- firewall=None,
- )
+ self.results: Dict[str, Any] = {"firewall": None}
super().__init__(
module_arg_spec=self.module_arg_spec,
diff --git a/plugins/modules/firewall_list.py b/plugins/modules/firewall_list.py
index 666f10ec..70eb628e 100644
--- a/plugins/modules/firewall_list.py
+++ b/plugins/modules/firewall_list.py
@@ -25,8 +25,8 @@
SpecReturnValue,
)
-spec_filter = dict(
- name=SpecField(
+spec_filter = {
+ "name": SpecField(
type=FieldType.string,
required=True,
description=[
@@ -36,7 +36,7 @@
"#firewalls-list__responses",
],
),
- values=SpecField(
+ "values": SpecField(
type=FieldType.list,
element_type=FieldType.string,
required=True,
@@ -45,36 +45,36 @@
"Fields will pass this filter if at least one of these values matches.",
],
),
-)
+}
-spec = dict(
+spec = {
# Disable the default values
- state=SpecField(type=FieldType.string, required=False, doc_hide=True),
- label=SpecField(type=FieldType.string, required=False, doc_hide=True),
- order=SpecField(
+ "state": SpecField(type=FieldType.string, required=False, doc_hide=True),
+ "label": SpecField(type=FieldType.string, required=False, doc_hide=True),
+ "order": SpecField(
type=FieldType.string,
description=["The order to list firewalls in."],
default="asc",
choices=["desc", "asc"],
),
- order_by=SpecField(
+ "order_by": SpecField(
type=FieldType.string,
description=["The attribute to order firewalls by."],
),
- filters=SpecField(
+ "filters": SpecField(
type=FieldType.list,
element_type=FieldType.dict,
suboptions=spec_filter,
description=["A list of filters to apply to the resulting firewalls."],
),
- count=SpecField(
+ "count": SpecField(
type=FieldType.integer,
description=[
"The number of results to return.",
"If undefined, all results will be returned.",
],
),
-)
+}
SPECDOC_META = SpecDocMeta(
description=["List and filter on Firewalls."],
@@ -82,8 +82,8 @@
author=global_authors,
options=spec,
examples=docs.specdoc_examples,
- return_values=dict(
- firewalls=SpecReturnValue(
+ return_values={
+ "firewalls": SpecReturnValue(
description="The returned firewalls.",
docs_url="https://www.linode.com/docs/api/networking/"
"#firewalls-list__response-samples",
@@ -91,7 +91,7 @@
elements=FieldType.dict,
sample=docs.result_firewalls_samples,
)
- ),
+ },
)
diff --git a/plugins/modules/image.py b/plugins/modules/image.py
index 15979603..79019130 100644
--- a/plugins/modules/image.py
+++ b/plugins/modules/image.py
@@ -5,7 +5,6 @@
from __future__ import absolute_import, division, print_function
-# pylint: disable=unused-import
import os
from typing import Any, Optional, Set
@@ -31,53 +30,53 @@
)
from linode_api4 import Image
-SPEC = dict(
- label=SpecField(
+SPEC = {
+ "label": SpecField(
type=FieldType.string,
required=True,
description=["This Image's unique label."],
),
- state=SpecField(
+ "state": SpecField(
type=FieldType.string,
choices=["present", "absent"],
required=True,
description=["The state of this Image."],
),
- description=SpecField(
+ "description": SpecField(
type=FieldType.string,
editable=True,
description=["A description for the Image."],
),
- disk_id=SpecField(
+ "disk_id": SpecField(
type=FieldType.integer,
conflicts_with=["source_file"],
description=["The ID of the disk to clone this image from."],
),
- recreate=SpecField(
+ "recreate": SpecField(
type=FieldType.bool,
default=False,
description=[
"If true, the image with the given label will be deleted and recreated"
],
),
- region=SpecField(
+ "region": SpecField(
type=FieldType.string,
description=["The Linode region to upload this image to."],
default="us-east",
),
- source_file=SpecField(
+ "source_file": SpecField(
type=FieldType.string,
conflicts_with=["disk_id"],
description=["An image file to create this image with."],
),
- wait=SpecField(
+ "wait": SpecField(
type=FieldType.bool,
default=True,
description=[
"Wait for the image to have status `available` before returning."
],
),
- wait_timeout=SpecField(
+ "wait_timeout": SpecField(
type=FieldType.integer,
default=600,
description=[
@@ -85,7 +84,7 @@
"have status `available`."
],
),
-)
+}
SPECDOC_META = SpecDocMeta(
description=["Manage a Linode Image."],
@@ -93,15 +92,15 @@
author=global_authors,
options=SPEC,
examples=docs.specdoc_examples,
- return_values=dict(
- image=SpecReturnValue(
+ return_values={
+ "image": SpecReturnValue(
description="The Image in JSON serialized form.",
docs_url="https://www.linode.com/docs/api/images/"
"#image-view__response-samples",
type=FieldType.dict,
sample=docs.result_image_samples,
)
- ),
+ },
)
MUTABLE_FIELDS = {"description"}
@@ -112,11 +111,11 @@ class Module(LinodeModuleBase):
def __init__(self) -> None:
self.module_arg_spec = SPECDOC_META.ansible_spec
- self.results = dict(
- changed=False,
- actions=[],
- image=None,
- )
+ self.results = {
+ "changed": False,
+ "actions": [],
+ "image": None,
+ }
super().__init__(
module_arg_spec=self.module_arg_spec,
diff --git a/plugins/modules/image_info.py b/plugins/modules/image_info.py
index ce5535ee..4a653f4e 100644
--- a/plugins/modules/image_info.py
+++ b/plugins/modules/image_info.py
@@ -5,7 +5,6 @@
from __future__ import absolute_import, division, print_function
-# pylint: disable=unused-import
from typing import Any, Optional
import ansible_collections.linode.cloud.plugins.module_utils.doc_fragments.image as docs_parent
@@ -28,20 +27,20 @@
)
from linode_api4 import Image
-spec = dict(
+spec = {
# Disable the default values
- state=SpecField(type=FieldType.string, required=False, doc_hide=True),
- id=SpecField(
+ "state": SpecField(type=FieldType.string, required=False, doc_hide=True),
+ "id": SpecField(
type=FieldType.string,
description=["The ID of the image."],
conflicts_with=["label"],
),
- label=SpecField(
+ "label": SpecField(
type=FieldType.string,
description=["The label of the image."],
conflicts_with=["id"],
),
-)
+}
SPECDOC_META = SpecDocMeta(
description=["Get info about a Linode Image."],
@@ -49,14 +48,14 @@
author=global_authors,
options=spec,
examples=docs.specdoc_examples,
- return_values=dict(
- image=SpecReturnValue(
+ return_values={
+ "image": SpecReturnValue(
description="The image in JSON serialized form.",
docs_url="https://www.linode.com/docs/api/images/#image-view__responses",
type=FieldType.dict,
sample=docs_parent.result_image_samples,
)
- ),
+ },
)
diff --git a/plugins/modules/image_list.py b/plugins/modules/image_list.py
index b16d3784..56ae75d5 100644
--- a/plugins/modules/image_list.py
+++ b/plugins/modules/image_list.py
@@ -5,7 +5,6 @@
from __future__ import absolute_import, division, print_function
-# pylint: disable=unused-import
from typing import Any, Dict, Optional
import ansible_collections.linode.cloud.plugins.module_utils.doc_fragments.image_list as docs
@@ -27,8 +26,8 @@
SpecReturnValue,
)
-spec_filter = dict(
- name=SpecField(
+spec_filter = {
+ "name": SpecField(
type=FieldType.string,
required=True,
description=[
@@ -37,7 +36,7 @@
"https://www.linode.com/docs/api/images/#images-list__responses",
],
),
- values=SpecField(
+ "values": SpecField(
type=FieldType.list,
element_type=FieldType.string,
required=True,
@@ -46,35 +45,35 @@
"Fields will pass this filter if at least one of these values matches.",
],
),
-)
+}
-spec = dict(
+spec = {
# Disable the default values
- state=SpecField(type=FieldType.string, required=False, doc_hide=True),
- label=SpecField(type=FieldType.string, required=False, doc_hide=True),
- order=SpecField(
+ "state": SpecField(type=FieldType.string, required=False, doc_hide=True),
+ "label": SpecField(type=FieldType.string, required=False, doc_hide=True),
+ "order": SpecField(
type=FieldType.string,
description=["The order to list events in."],
default="asc",
choices=["desc", "asc"],
),
- order_by=SpecField(
+ "order_by": SpecField(
type=FieldType.string, description=["The attribute to order events by."]
),
- filters=SpecField(
+ "filters": SpecField(
type=FieldType.list,
element_type=FieldType.dict,
suboptions=spec_filter,
description=["A list of filters to apply to the resulting events."],
),
- count=SpecField(
+ "count": SpecField(
type=FieldType.integer,
description=[
"The number of results to return.",
"If undefined, all results will be returned.",
],
),
-)
+}
SPECDOC_META = SpecDocMeta(
description=["List and filter on Linode images."],
@@ -82,15 +81,15 @@
author=global_authors,
options=spec,
examples=docs.specdoc_examples,
- return_values=dict(
- images=SpecReturnValue(
+ return_values={
+ "images": SpecReturnValue(
description="The returned images.",
docs_url="https://www.linode.com/docs/api/images/#images-list__response-samples",
type=FieldType.list,
elements=FieldType.dict,
sample=docs.result_images_samples,
)
- ),
+ },
)
diff --git a/plugins/modules/instance.py b/plugins/modules/instance.py
index ed1026b6..649a3ec7 100644
--- a/plugins/modules/instance.py
+++ b/plugins/modules/instance.py
@@ -26,7 +26,6 @@
filter_null_values_recursive,
paginated_list_to_json,
parse_linode_types,
- request_retry,
)
from ansible_specdoc.objects import (
FieldType,
@@ -41,50 +40,50 @@
# handled in module_utils.linode_common
pass
-linode_instance_disk_spec = dict(
- authorized_keys=SpecField(
+linode_instance_disk_spec = {
+ "authorized_keys": SpecField(
type=FieldType.list,
element_type=FieldType.string,
description=[
"A list of SSH public key parts to deploy for the root user."
],
),
- authorized_users=SpecField(
+ "authorized_users": SpecField(
type=FieldType.list,
element_type=FieldType.string,
description=["A list of usernames."],
),
- filesystem=SpecField(
+ "filesystem": SpecField(
type=FieldType.string,
description=["The filesystem to create this disk with."],
),
- image=SpecField(
+ "image": SpecField(
type=FieldType.string,
description=["An Image ID to deploy the Disk from."],
),
- label=SpecField(
+ "label": SpecField(
type=FieldType.string,
required=True,
description=["The label to give this Disk."],
),
- root_pass=SpecField(
+ "root_pass": SpecField(
type=FieldType.string,
description=["The root user’s password on the newly-created Linode."],
),
- size=SpecField(
+ "size": SpecField(
type=FieldType.integer,
required=True,
editable=True,
description=["The size of the Disk in MB."],
),
- stackscript_id=SpecField(
+ "stackscript_id": SpecField(
type=FieldType.integer,
description=[
"The ID of the StackScript to use when creating the instance.",
"See the [Linode API documentation](https://www.linode.com/docs/api/stackscripts/).",
],
),
- stackscript_data=SpecField(
+ "stackscript_data": SpecField(
type=FieldType.dict,
description=[
"An object containing arguments to any User Defined Fields present in "
@@ -93,22 +92,22 @@
"See the [Linode API documentation](https://www.linode.com/docs/api/stackscripts/).",
],
),
-)
+}
-linode_instance_device_spec = dict(
- disk_label=SpecField(
+linode_instance_device_spec = {
+ "disk_label": SpecField(
type=FieldType.string,
description=["The label of the disk to attach to this Linode."],
),
- disk_id=SpecField(
+ "disk_id": SpecField(
type=FieldType.integer,
description=["The ID of the disk to attach to this Linode."],
),
- volume_id=SpecField(
+ "volume_id": SpecField(
type=FieldType.integer,
description=["The ID of the volume to attach to this Linode."],
),
-)
+}
linode_instance_devices_spec = {
f"sd{k}": SpecField(
@@ -119,41 +118,41 @@
for k in "abcdefgh"
}
-linode_instance_helpers_spec = dict(
- devtmpfs_automount=SpecField(
+linode_instance_helpers_spec = {
+ "devtmpfs_automount": SpecField(
type=FieldType.bool,
description=[
"Populates the /dev directory early during boot without udev."
],
),
- distro=SpecField(
+ "distro": SpecField(
type=FieldType.bool,
description=["Helps maintain correct inittab/upstart console device."],
),
- modules_dep=SpecField(
+ "modules_dep": SpecField(
type=FieldType.bool,
description=[
"Creates a modules dependency file for the Kernel you run."
],
),
- network=SpecField(
+ "network": SpecField(
type=FieldType.bool,
description=["Automatically configures static networking."],
),
- updatedb_disabled=SpecField(
+ "updatedb_disabled": SpecField(
type=FieldType.bool,
description=["Disables updatedb cron job to avoid disk thrashing."],
),
-)
+}
-linode_instance_interface_spec = dict(
- purpose=SpecField(
+linode_instance_interface_spec = {
+ "purpose": SpecField(
type=FieldType.string,
required=True,
description=["The type of interface."],
choices=["public", "vlan"],
),
- label=SpecField(
+ "label": SpecField(
type=FieldType.string,
description=[
"The name of this interface.",
@@ -161,66 +160,66 @@
"Must be an empty string or null for public purpose interfaces.",
],
),
- ipam_address=SpecField(
+ "ipam_address": SpecField(
type=FieldType.string,
description=[
"This Network Interface’s private IP address in Classless "
"Inter-Domain Routing (CIDR) notation."
],
),
-)
+}
-linode_instance_config_spec = dict(
- comments=SpecField(
+linode_instance_config_spec = {
+ "comments": SpecField(
type=FieldType.string,
editable=True,
description=["Arbitrary User comments on this Config."],
),
- devices=SpecField(
+ "devices": SpecField(
type=FieldType.dict,
required=True,
suboptions=linode_instance_devices_spec,
description=["The devices to map to this configuration."],
),
- helpers=SpecField(
+ "helpers": SpecField(
type=FieldType.dict,
suboptions=linode_instance_helpers_spec,
description=["Helpers enabled when booting to this Linode Config."],
),
- kernel=SpecField(
+ "kernel": SpecField(
type=FieldType.string,
editable=True,
description=[
'A Kernel ID to boot a Linode with. Defaults to "linode/latest-64bit".'
],
),
- label=SpecField(
+ "label": SpecField(
type=FieldType.string,
required=True,
description=["The label to assign to this config."],
),
- memory_limit=SpecField(
+ "memory_limit": SpecField(
type=FieldType.integer,
editable=True,
description=["Defaults to the total RAM of the Linode."],
),
- root_device=SpecField(
+ "root_device": SpecField(
type=FieldType.string,
editable=True,
description=["The root device to boot."],
),
- run_level=SpecField(
+ "run_level": SpecField(
type=FieldType.string,
editable=True,
description=["Defines the state of your Linode after booting."],
),
- virt_mode=SpecField(
+ "virt_mode": SpecField(
type=FieldType.string,
editable=True,
description=["Controls the virtualization mode."],
choices=["paravirt", "fullvirt"],
),
- interfaces=SpecField(
+ "interfaces": SpecField(
type=FieldType.list,
element_type=FieldType.dict,
suboptions=linode_instance_interface_spec,
@@ -231,41 +230,45 @@
"/#configuration-profile-create__request-body-schema).",
],
),
-)
+}
-spec_additional_ipv4 = dict(
- public=SpecField(
+spec_additional_ipv4 = {
+ "public": SpecField(
type=FieldType.bool,
description="Whether the allocated IPv4 address should be public or private.",
required=True,
)
-)
+}
-linode_instance_spec = dict(
- type=SpecField(
+linode_instance_spec = {
+ "label": SpecField(
type=FieldType.string,
description=["The unique label to give this instance."],
),
- region=SpecField(
+ "type": SpecField(
+ type=FieldType.string,
+ description=["The Linode Type of the Linode you are creating."],
+ ),
+ "region": SpecField(
type=FieldType.string,
description=[
"The location to deploy the instance in.",
"See the [Linode API documentation](https://api.linode.com/v4/regions).",
],
),
- image=SpecField(
+ "image": SpecField(
type=FieldType.string,
conflicts_with=["disks", "configs"],
description=["The image ID to deploy the instance disk from."],
),
- authorized_keys=SpecField(
+ "authorized_keys": SpecField(
type=FieldType.list,
element_type=FieldType.string,
description=[
"A list of SSH public key parts to deploy for the root user."
],
),
- root_pass=SpecField(
+ "root_pass": SpecField(
type=FieldType.string,
no_log=True,
description=[
@@ -274,14 +277,14 @@
"This generated password will be available in the task success JSON.",
],
),
- stackscript_id=SpecField(
+ "stackscript_id": SpecField(
type=FieldType.integer,
description=[
"The ID of the StackScript to use when creating the instance.",
"See the [Linode API documentation](https://www.linode.com/docs/api/stackscripts/).",
],
),
- stackscript_data=SpecField(
+ "stackscript_data": SpecField(
type=FieldType.dict,
description=[
"An object containing arguments to any User Defined Fields present in "
@@ -290,19 +293,19 @@
"See the [Linode API documentation](https://www.linode.com/docs/api/stackscripts/).",
],
),
- state=SpecField(
+ "state": SpecField(
type=FieldType.string,
description=["The desired state of the target."],
choices=["present", "absent"],
required=True,
),
- private_ip=SpecField(
+ "private_ip": SpecField(
type=FieldType.bool,
description=[
"If true, the created Linode will have private networking enabled."
],
),
- group=SpecField(
+ "group": SpecField(
type=FieldType.string,
editable=True,
description=[
@@ -311,11 +314,11 @@
"The encouraged method for marking instances is to use tags.",
],
),
- boot_config_label=SpecField(
+ "boot_config_label": SpecField(
type=FieldType.string,
description=["The label of the config to boot from."],
),
- configs=SpecField(
+ "configs": SpecField(
type=FieldType.list,
element_type=FieldType.dict,
suboptions=linode_instance_config_spec,
@@ -327,7 +330,7 @@
"/api/linode-instances/#configuration-profile-create).",
],
),
- disks=SpecField(
+ "disks": SpecField(
type=FieldType.list,
element_type=FieldType.dict,
suboptions=linode_instance_disk_spec,
@@ -339,7 +342,7 @@
"docs/api/linode-instances/#disk-create).",
],
),
- interfaces=SpecField(
+ "interfaces": SpecField(
type=FieldType.list,
element_type=FieldType.dict,
suboptions=linode_instance_interface_spec,
@@ -350,28 +353,28 @@
"#linode-create__request-body-schema).",
],
),
- booted=SpecField(
+ "booted": SpecField(
type=FieldType.bool,
description=[
"Whether the new Instance should be booted.",
"This will default to True if the Instance is deployed from an Image or Backup.",
],
),
- backup_id=SpecField(
+ "backup_id": SpecField(
type=FieldType.integer,
description=[
"The id of the Backup to restore to the new Instance.",
'May not be provided if "image" is given.',
],
),
- wait=SpecField(
+ "wait": SpecField(
type=FieldType.bool,
default=True,
description=[
'Wait for the instance to have status "running" before returning.'
],
),
- wait_timeout=SpecField(
+ "wait_timeout": SpecField(
type=FieldType.integer,
default=240,
description=[
@@ -379,14 +382,25 @@
'have status "running".'
],
),
- additional_ipv4=SpecField(
+ "additional_ipv4": SpecField(
type=FieldType.list,
element_type=FieldType.dict,
suboptions=spec_additional_ipv4,
description=["Additional ipv4 addresses to allocate."],
editable=False,
),
-)
+ "rebooted": SpecField(
+ type=FieldType.bool,
+ description=[
+ "If true, the Linode Instance will be rebooted.",
+ "NOTE: The instance will only be rebooted if it was "
+ "previously in a running state.",
+ "To ensure your Linode will always be rebooted, consider "
+ "also setting the `booted` field.",
+ ],
+ default=False,
+ ),
+}
SPECDOC_META = SpecDocMeta(
description=["Manage Linode Instances, Configs, and Disks."],
@@ -394,34 +408,34 @@
author=global_authors,
options=linode_instance_spec,
examples=docs.specdoc_examples,
- return_values=dict(
- instance=SpecReturnValue(
+ return_values={
+ "instance": SpecReturnValue(
description="The instance description in JSON serialized form.",
docs_url="https://www.linode.com/docs/api/linode-instances/#linode-view__responses",
type=FieldType.dict,
sample=docs.result_instance_samples,
),
- configs=SpecReturnValue(
+ "configs": SpecReturnValue(
description="A list of configs tied to this Linode Instance.",
docs_url="https://www.linode.com/docs/api/linode-instances/"
"#configuration-profile-view__responses",
type=FieldType.list,
sample=docs.result_configs_samples,
),
- disks=SpecReturnValue(
+ "disks": SpecReturnValue(
description="A list of disks tied to this Linode Instance.",
docs_url="https://www.linode.com/docs/api/linode-instances/#disk-view__responses",
type=FieldType.list,
sample=docs.result_disks_samples,
),
- networking=SpecReturnValue(
+ "networking": SpecReturnValue(
description="Networking information about this Linode Instance.",
docs_url="https://www.linode.com/docs/api/linode-instances/"
"#networking-information-list__responses",
type=FieldType.dict,
sample=docs.result_networking_samples,
),
- ),
+ },
)
# Fields that can be updated on an existing instance
@@ -451,13 +465,13 @@ def __init__(self) -> None:
("interfaces", "disks"),
]
- self.results: dict = dict(
- changed=False,
- actions=[],
- instance=None,
- configs=None,
- networking=None,
- )
+ self.results = {
+ "changed": False,
+ "actions": [],
+ "instance": None,
+ "configs": None,
+ "networking": None,
+ }
self._instance: Optional[Instance] = None
self._root_pass: str = ""
@@ -568,9 +582,7 @@ def _create_instance(self) -> dict:
result = {"instance": None, "root_pass": ""}
# We want to retry on 408s
- response = request_retry(
- lambda: self.client.linode.instance_create(ltype, region, **params)
- )
+ response = self.client.linode.instance_create(ltype, region, **params)
# Weird variable return type
if isinstance(response, tuple):
@@ -831,7 +843,7 @@ def _update_instance(self) -> None:
if not hasattr(self._instance, key):
continue
- if key in {"configs", "disks", "boot_config_label"}:
+ if key in {"configs", "disks", "boot_config_label", "reboot"}:
continue
old_value = parse_linode_types(getattr(self._instance, key))
@@ -857,15 +869,18 @@ def _update_instance(self) -> None:
if should_update:
self._instance.save()
- ipv4_length = len(self.module.params.get("additional_ipv4") or [])
+ needs_private_ip = self.module.params.get("private_ip")
+ additional_ipv4 = self.module.params.get("additional_ipv4")
- min_ips = 2 if self.module.params.get("private_ip") else 1
- if ipv4_length != len(getattr(self._instance, "ipv4")) - min_ips:
- self.fail(
- "failed to update instance {0}:additional_ipv4 is a non-updatable field".format(
- self._instance.label
+ if needs_private_ip or additional_ipv4:
+ ipv4_length = len(additional_ipv4 or [])
+
+ min_ips = 2 if needs_private_ip else 1
+ if ipv4_length != len(getattr(self._instance, "ipv4")) - min_ips:
+ self.fail(
+ "failed to update instance {0}: additional_ipv4 is a "
+ "non-updatable field".format(self._instance.label)
)
- )
# Update interfaces
self._update_interfaces()
@@ -918,6 +933,40 @@ def _handle_instance_boot(self) -> None:
self._timeout_ctx.seconds_remaining
)
+ def _handle_instance_reboot(self) -> None:
+ if not self.module.params.get("rebooted"):
+ return
+
+ should_poll = self.module.params.get("wait")
+
+ # Wait for instance to not be busy
+ wait_for_resource_free(
+ self.client,
+ "linode",
+ self._instance.id,
+ self._timeout_ctx.seconds_remaining,
+ )
+
+ self._instance._api_get()
+
+ # We don't want to reboot if the Linode is already offline
+ if self._instance.status != "running":
+ return
+
+ reboot_poller = EventPoller(
+ self.client, "linode", "linode_reboot", entity_id=self._instance.id
+ )
+
+ self._instance.reboot()
+ self.register_action(
+ "Rebooted instance {}".format(self._instance.label)
+ )
+
+ if should_poll:
+ reboot_poller.wait_for_next_event_finished(
+ self._timeout_ctx.seconds_remaining
+ )
+
def _handle_present(self) -> None:
"""Updates the instance defined in kwargs"""
@@ -925,8 +974,9 @@ def _handle_present(self) -> None:
should_wait = self.module.params.get("wait")
self._instance = self._get_instance_by_label(label)
+ already_exists = self._instance is not None
- if self._instance is None:
+ if not already_exists:
create_poller = EventPoller(self.client, "linode", "linode_create")
result = self._create_instance()
@@ -967,6 +1017,10 @@ def _handle_present(self) -> None:
self._update_disks()
self._update_configs()
+ # Don't reboot on instance creation
+ if self.module.params.get("rebooted") is not None and already_exists:
+ self._handle_instance_reboot()
+
if self.module.params.get("booted") is not None:
self._handle_instance_boot()
diff --git a/plugins/modules/instance_info.py b/plugins/modules/instance_info.py
index d7ae83da..22fad3f5 100644
--- a/plugins/modules/instance_info.py
+++ b/plugins/modules/instance_info.py
@@ -5,7 +5,6 @@
from __future__ import absolute_import, division, print_function
-# pylint: disable=unused-import
from typing import Any, Dict, List, Optional
import ansible_collections.linode.cloud.plugins.module_utils.doc_fragments.instance as docs_parent
@@ -29,10 +28,10 @@
)
from linode_api4 import Instance
-linode_instance_info_spec = dict(
+linode_instance_info_spec = {
# We need to overwrite attributes to exclude them as requirements
- state=SpecField(type=FieldType.string, required=False, doc_hide=True),
- id=SpecField(
+ "state": SpecField(type=FieldType.string, required=False, doc_hide=True),
+ "id": SpecField(
type=FieldType.integer,
required=False,
conflicts_with=["label"],
@@ -41,7 +40,7 @@
"Optional if `label` is defined.",
],
),
- label=SpecField(
+ "label": SpecField(
type=FieldType.string,
required=False,
conflicts_with=["id"],
@@ -50,7 +49,7 @@
"Optional if `id` is defined.",
],
),
-)
+}
SPECDOC_META = SpecDocMeta(
description=["Get info about a Linode Instance."],
@@ -58,34 +57,34 @@
author=global_authors,
options=linode_instance_info_spec,
examples=docs.specdoc_examples,
- return_values=dict(
- instance=SpecReturnValue(
+ return_values={
+ "instance": SpecReturnValue(
description="The instance description in JSON serialized form.",
docs_url="https://www.linode.com/docs/api/linode-instances/#linode-view__responses",
type=FieldType.dict,
sample=docs_parent.result_instance_samples,
),
- configs=SpecReturnValue(
+ "configs": SpecReturnValue(
description="A list of configs tied to this Linode Instance.",
docs_url="https://www.linode.com/docs/api/linode-instances/"
"#configuration-profile-view__responses",
type=FieldType.list,
sample=docs_parent.result_configs_samples,
),
- disks=SpecReturnValue(
+ "disks": SpecReturnValue(
description="A list of disks tied to this Linode Instance.",
docs_url="https://www.linode.com/docs/api/linode-instances/#disk-view__responses",
type=FieldType.list,
sample=docs_parent.result_disks_samples,
),
- networking=SpecReturnValue(
+ "networking": SpecReturnValue(
description="Networking information about this Linode Instance.",
docs_url="https://www.linode.com/docs/api/linode-instances/"
"#networking-information-list__responses",
type=FieldType.dict,
sample=docs_parent.result_networking_samples,
),
- ),
+ },
)
linode_instance_valid_filters = ["id", "label"]
@@ -97,9 +96,12 @@ class LinodeInstanceInfo(LinodeModuleBase):
def __init__(self) -> None:
self.module_arg_spec = SPECDOC_META.ansible_spec
self.required_one_of: List[str] = []
- self.results: Dict[str, Any] = dict(
- instance=None, configs=None, disks=None, networking=None
- )
+ self.results: Dict[str, Any] = {
+ "instance": None,
+ "configs": None,
+ "disks": None,
+ "networking": None,
+ }
super().__init__(
module_arg_spec=self.module_arg_spec,
diff --git a/plugins/modules/instance_list.py b/plugins/modules/instance_list.py
index 5d06871a..58adbed7 100644
--- a/plugins/modules/instance_list.py
+++ b/plugins/modules/instance_list.py
@@ -25,8 +25,8 @@
SpecReturnValue,
)
-spec_filter = dict(
- name=SpecField(
+spec_filter = {
+ "name": SpecField(
type=FieldType.string,
required=True,
description=[
@@ -36,7 +36,7 @@
"#linodes-list__responses",
],
),
- values=SpecField(
+ "values": SpecField(
type=FieldType.list,
element_type=FieldType.string,
required=True,
@@ -45,36 +45,36 @@
"Fields will pass this filter if at least one of these values matches.",
],
),
-)
+}
-spec = dict(
+spec = {
# Disable the default values
- state=SpecField(type=FieldType.string, required=False, doc_hide=True),
- label=SpecField(type=FieldType.string, required=False, doc_hide=True),
- order=SpecField(
+ "state": SpecField(type=FieldType.string, required=False, doc_hide=True),
+ "label": SpecField(type=FieldType.string, required=False, doc_hide=True),
+ "order": SpecField(
type=FieldType.string,
description=["The order to list instances in."],
default="asc",
choices=["desc", "asc"],
),
- order_by=SpecField(
+ "order_by": SpecField(
type=FieldType.string,
description=["The attribute to order instances by."],
),
- filters=SpecField(
+ "filters": SpecField(
type=FieldType.list,
element_type=FieldType.dict,
suboptions=spec_filter,
description=["A list of filters to apply to the resulting instances."],
),
- count=SpecField(
+ "count": SpecField(
type=FieldType.integer,
description=[
"The number of results to return.",
"If undefined, all results will be returned.",
],
),
-)
+}
SPECDOC_META = SpecDocMeta(
description=["List and filter on Linode Instances."],
@@ -82,8 +82,8 @@
author=global_authors,
options=spec,
examples=docs.specdoc_examples,
- return_values=dict(
- instances=SpecReturnValue(
+ return_values={
+ "instances": SpecReturnValue(
description="The returned instances.",
docs_url="https://www.linode.com/docs/api/linode-instances/"
"#linodes-list__response-samples",
@@ -91,7 +91,7 @@
elements=FieldType.dict,
sample=docs.result_images_samples,
)
- ),
+ },
)
diff --git a/plugins/modules/instance_type_list.py b/plugins/modules/instance_type_list.py
index 4cd7d19f..dd27b20b 100644
--- a/plugins/modules/instance_type_list.py
+++ b/plugins/modules/instance_type_list.py
@@ -27,8 +27,8 @@
SpecReturnValue,
)
-spec_filter = dict(
- name=SpecField(
+spec_filter = {
+ "name": SpecField(
type=FieldType.string,
required=True,
description=[
@@ -38,7 +38,7 @@
"#types-list__responses",
],
),
- values=SpecField(
+ "values": SpecField(
type=FieldType.list,
element_type=FieldType.string,
required=True,
@@ -47,23 +47,23 @@
"Fields will pass this filter if at least one of these values matches.",
],
),
-)
+}
-spec = dict(
+spec = {
# Disable the default values
- state=SpecField(type=FieldType.string, required=False, doc_hide=True),
- label=SpecField(type=FieldType.string, required=False, doc_hide=True),
- order=SpecField(
+ "state": SpecField(type=FieldType.string, required=False, doc_hide=True),
+ "label": SpecField(type=FieldType.string, required=False, doc_hide=True),
+ "order": SpecField(
type=FieldType.string,
description=["The order to list instance types in."],
default="asc",
choices=["desc", "asc"],
),
- order_by=SpecField(
+ "order_by": SpecField(
type=FieldType.string,
description=["The attribute to order instance types by."],
),
- filters=SpecField(
+ "filters": SpecField(
type=FieldType.list,
element_type=FieldType.dict,
suboptions=spec_filter,
@@ -71,14 +71,14 @@
"A list of filters to apply to the resulting instance types."
],
),
- count=SpecField(
+ "count": SpecField(
type=FieldType.integer,
description=[
"The number of results to return.",
"If undefined, all results will be returned.",
],
),
-)
+}
SPECDOC_META = SpecDocMeta(
description=["List and filter on Linode Instance Types."],
@@ -86,8 +86,8 @@
author=global_authors,
options=spec,
examples=docs.specdoc_examples,
- return_values=dict(
- instance_types=SpecReturnValue(
+ return_values={
+ "instance_types": SpecReturnValue(
description="The returned instance types.",
docs_url="https://www.linode.com/docs/api/linode-types/"
"#types-list__response-samples",
@@ -95,7 +95,7 @@
elements=FieldType.dict,
sample=docs.result_instance_type_samples,
)
- ),
+ },
)
diff --git a/plugins/modules/ip_info.py b/plugins/modules/ip_info.py
index 48ed57e9..995438f3 100644
--- a/plugins/modules/ip_info.py
+++ b/plugins/modules/ip_info.py
@@ -5,7 +5,6 @@
from __future__ import absolute_import, division, print_function
-# pylint: disable=unused-import
from typing import Any, Optional
import ansible_collections.linode.cloud.plugins.module_utils.doc_fragments.ip_info as docs
@@ -27,16 +26,16 @@
)
from linode_api4 import IPAddress
-spec = dict(
+spec = {
# Disable the default values
- state=SpecField(type=FieldType.string, required=False, doc_hide=True),
- label=SpecField(type=FieldType.string, required=False, doc_hide=True),
- address=SpecField(
+ "state": SpecField(type=FieldType.string, required=False, doc_hide=True),
+ "label": SpecField(type=FieldType.string, required=False, doc_hide=True),
+ "address": SpecField(
type=FieldType.string,
required=True,
description=["The IP address to operate on."],
),
-)
+}
SPECDOC_META = SpecDocMeta(
description=["Get info about a Linode IP."],
@@ -44,14 +43,14 @@
author=global_authors,
options=spec,
examples=docs.specdoc_examples,
- return_values=dict(
- ip=SpecReturnValue(
+ return_values={
+ "ip": SpecReturnValue(
description="The IP in JSON serialized form.",
docs_url="https://www.linode.com/docs/api/networking/#ip-address-view__responses",
type=FieldType.dict,
sample=docs.result_ip_samples,
)
- ),
+ },
)
diff --git a/plugins/modules/ip_rdns.py b/plugins/modules/ip_rdns.py
index 2482cb29..9216b589 100644
--- a/plugins/modules/ip_rdns.py
+++ b/plugins/modules/ip_rdns.py
@@ -22,27 +22,27 @@
SpecField,
SpecReturnValue,
)
-from linode_api4 import IPAddress
+from linode_api4 import ExplicitNullValue, IPAddress
-ip_rdns_spec = dict(
+ip_rdns_spec = {
# Disable the default values
- label=SpecField(type=FieldType.string, required=False, doc_hide=True),
- state=SpecField(
+ "label": SpecField(type=FieldType.string, required=False, doc_hide=True),
+ "state": SpecField(
type=FieldType.string,
choices=["present", "absent"],
description=["The state of this rDNS of the IP address."],
),
- address=SpecField(
+ "address": SpecField(
type=FieldType.string,
description=["The IP address."],
required=True,
),
- rdns=SpecField(
+ "rdns": SpecField(
type=FieldType.string,
editable=True,
description=["The desired rDNS value."],
),
-)
+}
SPECDOC_META = SpecDocMeta(
description=["Manage a Linode IP address's rDNS."],
@@ -50,8 +50,8 @@
author=global_authors,
options=ip_rdns_spec,
examples=ip_rdns_docs.specdoc_examples,
- return_values=dict(
- ip=SpecReturnValue(
+ return_values={
+ "ip": SpecReturnValue(
description=(
"The updated IP address with the new "
"reverse DNS in JSON serialized form."
@@ -62,7 +62,7 @@
type=FieldType.dict,
sample=ip_docs.result_ip_samples,
)
- ),
+ },
)
@@ -72,11 +72,11 @@ class ReverseDNSModule(LinodeModuleBase):
def __init__(self) -> None:
self.module_arg_spec = SPECDOC_META.ansible_spec
self.required_one_of = ["state", "rdns"]
- self.results = dict(
- changed=False,
- actions=[],
- ip=None,
- )
+ self.results = {
+ "changed": False,
+ "actions": [],
+ "ip": None,
+ }
super().__init__(
module_arg_spec=self.module_arg_spec,
required_if=[["state", "present", ["rdns"]]],
@@ -103,7 +103,7 @@ def _handle_present(self) -> None:
self.update_rdns(rdns)
def _handle_absent(self) -> None:
- self.update_rdns(None)
+ self.update_rdns(ExplicitNullValue())
def exec_module(self, **kwargs: Any) -> Optional[dict]:
"""Entrypoint for reverse DNS module"""
diff --git a/plugins/modules/ipv6_range_info.py b/plugins/modules/ipv6_range_info.py
index c4d6011d..179ad898 100644
--- a/plugins/modules/ipv6_range_info.py
+++ b/plugins/modules/ipv6_range_info.py
@@ -5,7 +5,6 @@
from __future__ import absolute_import, division, print_function
-# pylint: disable=unused-import
from typing import Any, Optional
import ansible_collections.linode.cloud.plugins.module_utils.doc_fragments.ipv6_range_info as docs
@@ -27,14 +26,14 @@
)
from linode_api4 import IPv6Range
-spec = dict(
+spec = {
# Disable the default values
- state=SpecField(type=FieldType.string, required=False, doc_hide=True),
- label=SpecField(type=FieldType.string, required=False, doc_hide=True),
- range=SpecField(
+ "state": SpecField(type=FieldType.string, required=False, doc_hide=True),
+ "label": SpecField(type=FieldType.string, required=False, doc_hide=True),
+ "range": SpecField(
type=FieldType.string, description=["The IPv6 range to access."]
),
-)
+}
SPECDOC_META = SpecDocMeta(
description=["Get info about a Linode IPv6 range."],
@@ -42,15 +41,15 @@
author=global_authors,
options=spec,
examples=docs.specdoc_examples,
- return_values=dict(
- range=SpecReturnValue(
+ return_values={
+ "range": SpecReturnValue(
description="The IPv6 range in JSON serialized form.",
docs_url="https://www.linode.com/docs/api/networking/"
"#ipv6-range-view__response-samples",
type=FieldType.dict,
sample=docs.result_range_samples,
)
- ),
+ },
)
@@ -65,10 +64,7 @@ def __init__(self) -> None:
def _get_range(self, address: str) -> IPv6Range:
try:
- # Workaround for endpoint formatting issue
- data = self.client.get(IPv6Range.api_endpoint.format(address))
-
- result = IPv6Range(self.client, address, json=data)
+ result = self.client.load(IPv6Range, address)
return result
except Exception as exception:
self.fail(
diff --git a/plugins/modules/lke_cluster.py b/plugins/modules/lke_cluster.py
index 3902c417..086b0457 100644
--- a/plugins/modules/lke_cluster.py
+++ b/plugins/modules/lke_cluster.py
@@ -5,7 +5,6 @@
from __future__ import absolute_import, division, print_function
-# pylint: disable=unused-import
import copy
from typing import Any, List, Optional, Set
@@ -33,8 +32,8 @@
)
from linode_api4 import ApiError, LKECluster
-linode_lke_cluster_autoscaler = dict(
- enabled=SpecField(
+linode_lke_cluster_autoscaler = {
+ "enabled": SpecField(
type=FieldType.bool,
editable=True,
description=[
@@ -42,7 +41,7 @@
"NOTE: Subsequent playbook runs will override nodes created by the cluster autoscaler.",
],
),
- max=SpecField(
+ "max": SpecField(
type=FieldType.integer,
editable=True,
description=[
@@ -50,7 +49,7 @@
"Defaults to the value provided by the count field."
],
),
- min=SpecField(
+ "min": SpecField(
type=FieldType.integer,
editable=True,
description=[
@@ -58,34 +57,34 @@
"Defaults to the Node Pool’s count."
],
),
-)
+}
-linode_lke_cluster_disk = dict(
- size=SpecField(
+linode_lke_cluster_disk = {
+ "size": SpecField(
type=FieldType.integer,
description=["This Node Pool’s custom disk layout."],
required=True,
),
- type=SpecField(
+ "type": SpecField(
type=FieldType.string,
description=["This custom disk partition’s filesystem type."],
choices=["raw", "ext4"],
),
-)
+}
-linode_lke_cluster_node_pool_spec = dict(
- count=SpecField(
+linode_lke_cluster_node_pool_spec = {
+ "count": SpecField(
type=FieldType.integer,
editable=True,
description=["The number of nodes in the Node Pool."],
required=True,
),
- type=SpecField(
+ "type": SpecField(
type=FieldType.string,
description=["The Linode Type for all of the nodes in the Node Pool."],
required=True,
),
- autoscaler=SpecField(
+ "autoscaler": SpecField(
type=FieldType.dict,
editable=True,
description=[
@@ -94,15 +93,15 @@
],
suboptions=linode_lke_cluster_autoscaler,
),
-)
+}
-linode_lke_cluster_spec = dict(
- label=SpecField(
+linode_lke_cluster_spec = {
+ "label": SpecField(
type=FieldType.string,
required=True,
description=["This Kubernetes cluster’s unique label."],
),
- k8s_version=SpecField(
+ "k8s_version": SpecField(
type=FieldType.string,
editable=True,
description=[
@@ -112,16 +111,16 @@
"A version upgrade requires that you manually recycle the nodes in your cluster.",
],
),
- region=SpecField(
+ "region": SpecField(
type=FieldType.string,
description=["This Kubernetes cluster’s location."],
),
- tags=SpecField(
+ "tags": SpecField(
type=FieldType.list,
element_type=FieldType.string,
description=["An array of tags applied to the Kubernetes cluster."],
),
- high_availability=SpecField(
+ "high_availability": SpecField(
type=FieldType.bool,
editable=True,
description=[
@@ -130,28 +129,28 @@
],
default=False,
),
- node_pools=SpecField(
+ "node_pools": SpecField(
editable=True,
type=FieldType.list,
element_type=FieldType.dict,
suboptions=linode_lke_cluster_node_pool_spec,
description=["A list of node pools to configure the cluster with"],
),
- skip_polling=SpecField(
+ "skip_polling": SpecField(
type=FieldType.bool,
description=[
"If true, the module will not wait for all nodes in the cluster to be ready."
],
default=False,
),
- wait_timeout=SpecField(
+ "wait_timeout": SpecField(
type=FieldType.integer,
description=[
"The period to wait for the cluster to be ready in seconds."
],
default=600,
),
-)
+}
SPECDOC_META = SpecDocMeta(
description=["Manage Linode LKE clusters."],
@@ -159,35 +158,35 @@
author=global_authors,
options=linode_lke_cluster_spec,
examples=docs.examples,
- return_values=dict(
- cluster=SpecReturnValue(
+ return_values={
+ "cluster": SpecReturnValue(
description="The LKE cluster in JSON serialized form.",
docs_url="https://www.linode.com/docs/api/linode-kubernetes-engine-lke/"
"#kubernetes-cluster-view__response-samples",
type=FieldType.dict,
sample=docs.result_cluster,
),
- node_pools=SpecReturnValue(
+ "node_pools": SpecReturnValue(
description="A list of node pools in JSON serialized form.",
docs_url="https://www.linode.com/docs/api/linode-kubernetes-engine-lke/"
"#node-pools-list__response-samples",
type=FieldType.list,
sample=docs.result_node_pools,
),
- kubeconfig=SpecReturnValue(
+ "kubeconfig": SpecReturnValue(
description="The Base64-encoded kubeconfig used to access this cluster. \n"
"NOTE: This value may be unavailable if `skip_polling` is true.",
docs_url="https://www.linode.com/docs/api/linode-kubernetes-engine-lke/"
"#kubeconfig-view__responses",
type=FieldType.string,
),
- dashboard_url=SpecReturnValue(
+ "dashboard_url": SpecReturnValue(
description="The Cluster Dashboard access URL.",
docs_url="https://www.linode.com/docs/api/linode-kubernetes-engine-lke/"
"#kubernetes-cluster-dashboard-url-view__responses",
type=FieldType.string,
),
- ),
+ },
)
MUTABLE_FIELDS: Set[str] = {"tags"}
@@ -211,14 +210,14 @@ class LinodeLKECluster(LinodeModuleBase):
def __init__(self) -> None:
self.module_arg_spec = SPECDOC_META.ansible_spec
self.required_one_of: List[str] = []
- self.results = dict(
- changed=False,
- actions=[],
- cluster=None,
- node_pools=None,
- dashboard_url=None,
- kubeconfig=None,
- )
+ self.results = {
+ "changed": False,
+ "actions": [],
+ "cluster": None,
+ "node_pools": None,
+ "dashboard_url": None,
+ "kubeconfig": None,
+ }
super().__init__(
module_arg_spec=self.module_arg_spec,
diff --git a/plugins/modules/lke_cluster_info.py b/plugins/modules/lke_cluster_info.py
index 97969da2..fff729b7 100644
--- a/plugins/modules/lke_cluster_info.py
+++ b/plugins/modules/lke_cluster_info.py
@@ -5,7 +5,6 @@
from __future__ import absolute_import, division, print_function
-# pylint: disable=unused-import
from typing import Any, Dict, List, Optional
from ansible_collections.linode.cloud.plugins.module_utils.doc_fragments import (
@@ -33,10 +32,10 @@
)
from linode_api4 import ApiError, LKECluster
-linode_lke_cluster_info_spec = dict(
+linode_lke_cluster_info_spec = {
# We need to overwrite attributes to exclude them as requirements
- state=SpecField(type=FieldType.string, required=False, doc_hide=True),
- id=SpecField(
+ "state": SpecField(type=FieldType.string, required=False, doc_hide=True),
+ "id": SpecField(
type=FieldType.integer,
required=False,
conflicts_with=["label"],
@@ -45,7 +44,7 @@
"Optional if `label` is defined.",
],
),
- label=SpecField(
+ "label": SpecField(
type=FieldType.string,
required=False,
conflicts_with=["id"],
@@ -54,7 +53,7 @@
"Optional if `id` is defined.",
],
),
-)
+}
SPECDOC_META = SpecDocMeta(
description=["Get info about a Linode LKE cluster."],
@@ -62,22 +61,22 @@
author=global_authors,
options=linode_lke_cluster_info_spec,
examples=docs.examples,
- return_values=dict(
- cluster=SpecReturnValue(
+ return_values={
+ "cluster": SpecReturnValue(
description="The LKE cluster in JSON serialized form.",
docs_url="https://www.linode.com/docs/api/linode-kubernetes-engine-lke/"
"#kubernetes-cluster-view__response-samples",
type=FieldType.dict,
sample=docs_parent.result_cluster,
),
- node_pools=SpecReturnValue(
+ "node_pools": SpecReturnValue(
description="A list of node pools in JSON serialized form.",
docs_url="https://www.linode.com/docs/api/linode-kubernetes-engine-lke/"
"#node-pools-list__response-samples",
type=FieldType.list,
sample=docs_parent.result_node_pools,
),
- kubeconfig=SpecReturnValue(
+ "kubeconfig": SpecReturnValue(
description="The Base64-encoded kubeconfig used to access this cluster. \n"
"NOTE: This value may be unavailable if the cluster is not "
"fully provisioned.",
@@ -85,13 +84,13 @@
"#kubeconfig-view__responses",
type=FieldType.string,
),
- dashboard_url=SpecReturnValue(
+ "dashboard_url": SpecReturnValue(
description="The Cluster Dashboard access URL.",
docs_url="https://www.linode.com/docs/api/linode-kubernetes-engine-lke/"
"#kubernetes-cluster-dashboard-url-view__responses",
type=FieldType.string,
),
- ),
+ },
)
VALID_FILTERS = ["id", "label"]
@@ -103,9 +102,12 @@ class LinodeLKEClusterInfo(LinodeModuleBase):
def __init__(self) -> None:
self.module_arg_spec = SPECDOC_META.ansible_spec
self.required_one_of: List[str] = []
- self.results: Dict[str, Any] = dict(
- cluster=None, node_pools=[], dashboard_url=None, kubeconfig=None
- )
+ self.results: Dict[str, Any] = {
+ "cluster": None,
+ "node_pools": [],
+ "dashboard_url": None,
+ "kubeconfig": None,
+ }
super().__init__(
module_arg_spec=self.module_arg_spec,
diff --git a/plugins/modules/lke_node_pool.py b/plugins/modules/lke_node_pool.py
index f950c2c7..85f5ea09 100644
--- a/plugins/modules/lke_node_pool.py
+++ b/plugins/modules/lke_node_pool.py
@@ -3,7 +3,6 @@
"""This module contains all of the functionality for Linode LKE node pools."""
-# pylint: disable=unused-import
from typing import Any, List, Optional
import ansible_collections.linode.cloud.plugins.module_utils.doc_fragments.lke_node_pool as docs
@@ -29,8 +28,8 @@
)
from linode_api4 import LKENodePool
-linode_lke_pool_autoscaler = dict(
- enabled=SpecField(
+linode_lke_pool_autoscaler = {
+ "enabled": SpecField(
type=FieldType.bool,
editable=True,
description=[
@@ -38,7 +37,7 @@
"NOTE: Subsequent playbook runs will override nodes created by the cluster autoscaler.",
],
),
- max=SpecField(
+ "max": SpecField(
type=FieldType.integer,
editable=True,
description=[
@@ -46,7 +45,7 @@
"Defaults to the value provided by the count field."
],
),
- min=SpecField(
+ "min": SpecField(
type=FieldType.integer,
editable=True,
description=[
@@ -54,30 +53,30 @@
"Defaults to the Node Pool’s count."
],
),
-)
+}
-linode_lke_pool_disks = dict(
- type=SpecField(
+linode_lke_pool_disks = {
+ "type": SpecField(
type=FieldType.string,
required=True,
description=["This custom disk partition’s filesystem type."],
choices=["raw", "ext4"],
),
- size=SpecField(
+ "size": SpecField(
type=FieldType.integer,
required=True,
description=["The size of this custom disk partition in MB."],
),
-)
+}
-MODULE_SPEC = dict(
- label=SpecField(type=FieldType.string, required=False, doc_hide=True),
- cluster_id=SpecField(
+MODULE_SPEC = {
+ "label": SpecField(type=FieldType.string, required=False, doc_hide=True),
+ "cluster_id": SpecField(
type=FieldType.integer,
required=True,
description=["The ID of the LKE cluster that contains this node pool."],
),
- autoscaler=SpecField(
+ "autoscaler": SpecField(
type=FieldType.dict,
editable=True,
description=[
@@ -86,12 +85,12 @@
],
suboptions=linode_lke_pool_autoscaler,
),
- count=SpecField(
+ "count": SpecField(
type=FieldType.integer,
editable=True,
description=["The number of nodes in the Node Pool."],
),
- disks=SpecField(
+ "disks": SpecField(
type=FieldType.list,
element_type=FieldType.dict,
description=[
@@ -102,7 +101,7 @@
],
suboptions=linode_lke_pool_disks,
),
- tags=SpecField(
+ "tags": SpecField(
type=FieldType.list,
element_type=FieldType.string,
editable=True,
@@ -113,20 +112,20 @@
"`lke_node_pool` module to uniquely identify node pools.",
],
),
- type=SpecField(
+ "type": SpecField(
type=FieldType.string,
description=[
"The Linode Type for all of the nodes in the Node Pool.",
"Required if `state` == `present`.",
],
),
- state=SpecField(
+ "state": SpecField(
type=FieldType.string,
description=["The desired state of the target."],
choices=["present", "absent"],
required=True,
),
- skip_polling=SpecField(
+ "skip_polling": SpecField(
type=FieldType.bool,
description=[
"If true, the module will not wait for all "
@@ -134,14 +133,14 @@
],
default=False,
),
- wait_timeout=SpecField(
+ "wait_timeout": SpecField(
type=FieldType.integer,
description=[
"The period to wait for the node pool to be ready in seconds."
],
default=600,
),
-)
+}
SPECDOC_META = SpecDocMeta(
description=["Manage Linode LKE cluster node pools."],
@@ -149,15 +148,15 @@
author=global_authors,
options=MODULE_SPEC,
examples=docs.examples,
- return_values=dict(
- node_pool=SpecReturnValue(
+ return_values={
+ "node_pool": SpecReturnValue(
description="The Node Pool in JSON serialized form.",
docs_url="https://www.linode.com/docs/api/linode-kubernetes-engine-lke/"
"#node-pool-view__response-samples",
type=FieldType.dict,
sample=docs.result_node_pool,
)
- ),
+ },
)
@@ -167,11 +166,11 @@ class LinodeLKENodePool(LinodeModuleBase):
def __init__(self) -> None:
self.module_arg_spec = SPECDOC_META.ansible_spec
self.required_one_of: List[str] = []
- self.results = dict(
- changed=False,
- actions=[],
- node_pool=None,
- )
+ self.results = {
+ "changed": False,
+ "actions": [],
+ "node_pool": None,
+ }
super().__init__(
module_arg_spec=self.module_arg_spec,
diff --git a/plugins/modules/lke_version_list.py b/plugins/modules/lke_version_list.py
index 7c51b9e8..124133a0 100644
--- a/plugins/modules/lke_version_list.py
+++ b/plugins/modules/lke_version_list.py
@@ -24,24 +24,24 @@
SpecReturnValue,
)
-spec = dict(
+spec = {
# Disable the default values
- state=SpecField(type=FieldType.string, required=False, doc_hide=True),
- label=SpecField(type=FieldType.string, required=False, doc_hide=True),
- order=SpecField(
+ "state": SpecField(type=FieldType.string, required=False, doc_hide=True),
+ "label": SpecField(type=FieldType.string, required=False, doc_hide=True),
+ "order": SpecField(
type=FieldType.string,
description=["The order to list lke versions in."],
default="asc",
choices=["desc", "asc"],
),
- count=SpecField(
+ "count": SpecField(
type=FieldType.integer,
description=[
"The number of results to return.",
"If undefined, all results will be returned.",
],
),
-)
+}
SPECDOC_META = SpecDocMeta(
description=[
@@ -51,8 +51,8 @@
author=global_authors,
options=spec,
examples=docs.specdoc_examples,
- return_values=dict(
- lke_versions=SpecReturnValue(
+ return_values={
+ "lke_versions": SpecReturnValue(
description="The returned LKE versions.",
docs_url="https://www.linode.com/docs/api/linode-kubernetes-engine-lke/"
"#kubernetes-versions-list__response-samples",
@@ -60,7 +60,7 @@
elements=FieldType.dict,
sample=docs.result_lke_versions_samples,
)
- ),
+ },
)
diff --git a/plugins/modules/nodebalancer.py b/plugins/modules/nodebalancer.py
index c6cf8aff..5e8a4099 100644
--- a/plugins/modules/nodebalancer.py
+++ b/plugins/modules/nodebalancer.py
@@ -28,17 +28,15 @@
SpecField,
SpecReturnValue,
)
-
-# pylint: disable=unused-import
from linode_api4 import NodeBalancer, NodeBalancerConfig, NodeBalancerNode
-linode_nodes_spec = dict(
- label=SpecField(
+linode_nodes_spec = {
+ "label": SpecField(
type=FieldType.string,
required=True,
description=["The label for this node."],
),
- address=SpecField(
+ "address": SpecField(
type=FieldType.string,
required=True,
editable=True,
@@ -47,13 +45,13 @@
"This must be a private IP address.",
],
),
- weight=SpecField(
+ "weight": SpecField(
type=FieldType.integer,
required=False,
editable=True,
description=["Nodes with a higher weight will receive more traffic."],
),
- mode=SpecField(
+ "mode": SpecField(
type=FieldType.string,
required=False,
editable=True,
@@ -62,10 +60,10 @@
],
choices=["accept", "reject", "drain", "backup"],
),
-)
+}
-linode_configs_spec = dict(
- algorithm=SpecField(
+linode_configs_spec = {
+ "algorithm": SpecField(
type=FieldType.string,
required=False,
editable=True,
@@ -75,7 +73,7 @@
],
choices=["roundrobin", "leastconn", "source"],
),
- check=SpecField(
+ "check": SpecField(
type=FieldType.string,
required=False,
editable=True,
@@ -85,7 +83,7 @@
],
choices=["none", "connection", "http", "http_body"],
),
- check_attempts=SpecField(
+ "check_attempts": SpecField(
type=FieldType.integer,
required=False,
editable=True,
@@ -93,7 +91,7 @@
"How many times to attempt a check before considering a backend to be down."
],
),
- check_body=SpecField(
+ "check_body": SpecField(
type=FieldType.string,
required=False,
default="",
@@ -104,7 +102,7 @@
"considered to be down.",
],
),
- check_interval=SpecField(
+ "check_interval": SpecField(
type=FieldType.integer,
required=False,
editable=True,
@@ -112,7 +110,7 @@
"How often, in seconds, to check that backends are up and serving requests."
],
),
- check_passive=SpecField(
+ "check_passive": SpecField(
type=FieldType.bool,
required=False,
editable=True,
@@ -122,7 +120,7 @@
"and taken out of rotation."
],
),
- check_path=SpecField(
+ "check_path": SpecField(
type=FieldType.string,
required=False,
editable=True,
@@ -131,7 +129,7 @@
"not respond to this request it is considered to be down."
],
),
- check_timeout=SpecField(
+ "check_timeout": SpecField(
type=FieldType.integer,
required=False,
editable=True,
@@ -140,7 +138,7 @@
"failed."
],
),
- cipher_suite=SpecField(
+ "cipher_suite": SpecField(
type=FieldType.string,
required=False,
default="recommended",
@@ -150,20 +148,20 @@
],
choices=["recommended", "legacy"],
),
- port=SpecField(
+ "port": SpecField(
type=FieldType.integer,
required=False,
editable=True,
description=["The port this Config is for."],
),
- protocol=SpecField(
+ "protocol": SpecField(
type=FieldType.string,
required=False,
editable=True,
description=["The protocol this port is configured to serve."],
choices=["http", "https", "tcp"],
),
- proxy_protocol=SpecField(
+ "proxy_protocol": SpecField(
type=FieldType.string,
required=False,
editable=True,
@@ -173,7 +171,7 @@
],
choices=["none", "v1", "v2"],
),
- recreate=SpecField(
+ "recreate": SpecField(
type=FieldType.bool,
required=False,
default=False,
@@ -182,7 +180,7 @@
"This is useful for updates to redacted fields (`ssl_cert`, `ssl_key`)"
],
),
- ssl_cert=SpecField(
+ "ssl_cert": SpecField(
type=FieldType.string,
required=False,
editable=True,
@@ -192,7 +190,7 @@
"that should be served on this NodeBalancerConfig’s port."
],
),
- ssl_key=SpecField(
+ "ssl_key": SpecField(
type=FieldType.string,
required=False,
editable=True,
@@ -201,7 +199,7 @@
"set in the ssl_cert field."
],
),
- stickiness=SpecField(
+ "stickiness": SpecField(
type=FieldType.string,
required=False,
editable=True,
@@ -210,7 +208,7 @@
],
choices=["none", "table", "http_cookie"],
),
- nodes=SpecField(
+ "nodes": SpecField(
type=FieldType.list,
required=False,
element_type=FieldType.dict,
@@ -221,15 +219,15 @@
"These can alternatively be configured through the nodebalancer_node module."
],
),
-)
+}
-linode_nodebalancer_spec = dict(
- label=SpecField(
+linode_nodebalancer_spec = {
+ "label": SpecField(
type=FieldType.string,
description=["The unique label to give this NodeBalancer."],
required=True,
),
- client_conn_throttle=SpecField(
+ "client_conn_throttle": SpecField(
type=FieldType.integer,
editable=True,
description=[
@@ -237,24 +235,25 @@
"Set to 0 (zero) to disable throttling.",
],
),
- region=SpecField(
+ "region": SpecField(
type=FieldType.string,
description=["The ID of the Region to create this NodeBalancer in."],
),
- state=SpecField(
+ "state": SpecField(
type=FieldType.string,
description=["The desired state of the target."],
choices=["present", "absent"],
required=True,
),
- configs=SpecField(
+ "configs": SpecField(
type=FieldType.list,
element_type=FieldType.dict,
suboptions=linode_configs_spec,
editable=True,
description=["A list of configs to apply to the NodeBalancer."],
),
-)
+}
+
SPECDOC_META = SpecDocMeta(
description=["Manage a Linode NodeBalancer."],
@@ -262,26 +261,26 @@
author=global_authors,
options=linode_nodebalancer_spec,
examples=docs.specdoc_examples,
- return_values=dict(
- node_balancer=SpecReturnValue(
+ return_values={
+ "node_balancer": SpecReturnValue(
description="The NodeBalancer in JSON serialized form.",
docs_url="https://www.linode.com/docs/api/nodebalancers/#nodebalancer-view__responses",
type=FieldType.dict,
sample=docs.result_node_balancer_samples,
),
- configs=SpecReturnValue(
+ "configs": SpecReturnValue(
description="A list of configs applied to the NodeBalancer.",
docs_url="https://www.linode.com/docs/api/nodebalancers/#config-view__responses",
type=FieldType.list,
sample=docs.result_configs_samples,
),
- nodes=SpecReturnValue(
+ "nodes": SpecReturnValue(
description="A list of configs applied to the NodeBalancer.",
docs_url="https://www.linode.com/docs/api/nodebalancers/#node-view",
type=FieldType.list,
sample=docs.result_nodes_samples,
),
- ),
+ },
)
linode_nodebalancer_mutable: Set[str] = {"client_conn_throttle", "tags"}
@@ -293,9 +292,13 @@ class LinodeNodeBalancer(LinodeModuleBase):
def __init__(self) -> None:
self.module_arg_spec = SPECDOC_META.ansible_spec
self.required_one_of = ["state", "label"]
- self.results = dict(
- changed=False, actions=[], node_balancer=None, configs=[], nodes=[]
- )
+ self.results = {
+ "changed": False,
+ "actions": [],
+ "node_balancer": None,
+ "configs": [],
+ "nodes": [],
+ }
self._node_balancer: Optional[NodeBalancer] = None
@@ -353,7 +356,7 @@ def _create_config(
"""Creates a config with the given kwargs within the given NodeBalancer"""
try:
- return node_balancer.config_create(None, **config_params)
+ return node_balancer.config_create(**config_params)
except Exception as exception:
return self.fail(
msg="failed to create nodebalancer config: {0}".format(
diff --git a/plugins/modules/nodebalancer_info.py b/plugins/modules/nodebalancer_info.py
index 75707b75..4130879a 100644
--- a/plugins/modules/nodebalancer_info.py
+++ b/plugins/modules/nodebalancer_info.py
@@ -29,14 +29,12 @@
SpecField,
SpecReturnValue,
)
-
-# pylint: disable=unused-import
from linode_api4 import NodeBalancer, NodeBalancerConfig, NodeBalancerNode
-linode_nodebalancer_info_spec = dict(
+linode_nodebalancer_info_spec = {
# We need to overwrite attributes to exclude them as requirements
- state=SpecField(type=FieldType.string, required=False, doc_hide=True),
- id=SpecField(
+ "state": SpecField(type=FieldType.string, required=False, doc_hide=True),
+ "id": SpecField(
type=FieldType.integer,
required=False,
conflicts_with=["label"],
@@ -45,7 +43,7 @@
"Optional if `label` is defined.",
],
),
- label=SpecField(
+ "label": SpecField(
type=FieldType.string,
required=False,
conflicts_with=["id"],
@@ -54,7 +52,7 @@
"Optional if `id` is defined.",
],
),
-)
+}
SPECDOC_META = SpecDocMeta(
description=["Get info about a Linode NodeBalancer."],
@@ -62,26 +60,26 @@
author=global_authors,
options=linode_nodebalancer_info_spec,
examples=docs.specdoc_examples,
- return_values=dict(
- node_balancer=SpecReturnValue(
+ return_values={
+ "node_balancer": SpecReturnValue(
description="The NodeBalancer in JSON serialized form.",
docs_url="https://www.linode.com/docs/api/nodebalancers/#nodebalancer-view__responses",
type="dict",
sample=docs_parent.result_node_balancer_samples,
),
- configs=SpecReturnValue(
+ "configs": SpecReturnValue(
description="A list of configs applied to the NodeBalancer.",
docs_url="https://www.linode.com/docs/api/nodebalancers/#config-view__responses",
type=FieldType.list,
sample=docs_parent.result_configs_samples,
),
- nodes=SpecReturnValue(
+ "nodes": SpecReturnValue(
description="A list of configs applied to the NodeBalancer.",
docs_url="https://www.linode.com/docs/api/nodebalancers/#node-view",
type=FieldType.list,
sample=docs_parent.result_nodes_samples,
),
- ),
+ },
)
linode_nodebalancer_valid_filters = ["id", "label"]
@@ -93,7 +91,7 @@ class LinodeNodeBalancerInfo(LinodeModuleBase):
def __init__(self) -> None:
self.module_arg_spec = SPECDOC_META.ansible_spec
self.required_one_of: List[str] = []
- self.results: dict = dict(node_balancer=None, configs=[], nodes=[])
+ self.results: dict = {"node_balancer": None, "configs": [], "nodes": []}
super().__init__(
module_arg_spec=self.module_arg_spec,
diff --git a/plugins/modules/nodebalancer_list.py b/plugins/modules/nodebalancer_list.py
index aae8b3e3..c0514367 100644
--- a/plugins/modules/nodebalancer_list.py
+++ b/plugins/modules/nodebalancer_list.py
@@ -25,8 +25,8 @@
SpecReturnValue,
)
-spec_filter = dict(
- name=SpecField(
+spec_filter = {
+ "name": SpecField(
type=FieldType.string,
required=True,
description=[
@@ -36,7 +36,7 @@
"#nodebalancers-list__responses",
],
),
- values=SpecField(
+ "values": SpecField(
type=FieldType.list,
element_type=FieldType.string,
required=True,
@@ -45,23 +45,23 @@
"Fields will pass this filter if at least one of these values matches.",
],
),
-)
+}
-spec = dict(
+spec = {
# Disable the default values
- state=SpecField(type=FieldType.string, required=False, doc_hide=True),
- label=SpecField(type=FieldType.string, required=False, doc_hide=True),
- order=SpecField(
+ "state": SpecField(type=FieldType.string, required=False, doc_hide=True),
+ "label": SpecField(type=FieldType.string, required=False, doc_hide=True),
+ "order": SpecField(
type=FieldType.string,
description=["The order to list nodebalancers in."],
default="asc",
choices=["desc", "asc"],
),
- order_by=SpecField(
+ "order_by": SpecField(
type=FieldType.string,
description=["The attribute to order nodebalancers by."],
),
- filters=SpecField(
+ "filters": SpecField(
type=FieldType.list,
element_type=FieldType.dict,
suboptions=spec_filter,
@@ -69,14 +69,14 @@
"A list of filters to apply to the resulting nodebalancers."
],
),
- count=SpecField(
+ "count": SpecField(
type=FieldType.integer,
description=[
"The number of results to return.",
"If undefined, all results will be returned.",
],
),
-)
+}
SPECDOC_META = SpecDocMeta(
description=["List and filter on Nodebalancers."],
@@ -84,8 +84,8 @@
author=global_authors,
options=spec,
examples=docs.specdoc_examples,
- return_values=dict(
- nodebalancers=SpecReturnValue(
+ return_values={
+ "nodebalancers": SpecReturnValue(
description="The returned nodebalancers.",
docs_url="https://www.linode.com/docs/api/nodebalancers/"
"#nodebalancers-list__response-samples",
@@ -93,7 +93,7 @@
elements=FieldType.dict,
sample=docs.result_nodebalancers_samples,
)
- ),
+ },
)
diff --git a/plugins/modules/nodebalancer_node.py b/plugins/modules/nodebalancer_node.py
index 48b35c7d..8d46d655 100644
--- a/plugins/modules/nodebalancer_node.py
+++ b/plugins/modules/nodebalancer_node.py
@@ -5,7 +5,6 @@
from __future__ import absolute_import, division, print_function
-# pylint: disable=unused-import
import copy
from typing import Any, List, Optional, Set
@@ -28,27 +27,27 @@
SpecReturnValue,
)
-MODULE_SPEC = dict(
- nodebalancer_id=SpecField(
+MODULE_SPEC = {
+ "nodebalancer_id": SpecField(
type=FieldType.integer,
required=True,
description=["The ID of the NodeBalancer that contains this node."],
),
- config_id=SpecField(
+ "config_id": SpecField(
type=FieldType.integer,
required=True,
description=[
"The ID of the NodeBalancer Config that contains this node."
],
),
- label=SpecField(
+ "label": SpecField(
type=FieldType.string,
required=True,
description=[
"The label for this node. This is used to identify nodes within a config."
],
),
- address=SpecField(
+ "address": SpecField(
type=FieldType.string,
editable=True,
description=[
@@ -56,7 +55,7 @@
"This must be a private IP address."
],
),
- state=SpecField(
+ "state": SpecField(
type=FieldType.string,
description=[
"Whether the NodeBalancer node should be present or absent."
@@ -64,7 +63,7 @@
choices=["present", "absent"],
required=True,
),
- mode=SpecField(
+ "mode": SpecField(
type=FieldType.string,
editable=True,
description=[
@@ -72,12 +71,12 @@
],
choices=["accept", "reject", "drain", "backup"],
),
- weight=SpecField(
+ "weight": SpecField(
type=FieldType.integer,
editable=True,
description=["Nodes with a higher weight will receive more traffic."],
),
-)
+}
SPECDOC_META = SpecDocMeta(
description=["Manage Linode NodeBalancer Nodes."],
@@ -85,14 +84,14 @@
author=global_authors,
options=MODULE_SPEC,
examples=docs.specdoc_examples,
- return_values=dict(
- node=SpecReturnValue(
+ return_values={
+ "node": SpecReturnValue(
description="The NodeBalancer Node in JSON serialized form.",
docs_url="https://www.linode.com/docs/api/nodebalancers/#node-view__responses",
type=FieldType.dict,
sample=docs.result_node_samples,
)
- ),
+ },
)
MUTABLE_FIELDS: Set[str] = {"address", "mode", "weight"}
@@ -104,11 +103,11 @@ class LinodeNodeBalancerNode(LinodeModuleBase):
def __init__(self) -> None:
self.module_arg_spec = SPECDOC_META.ansible_spec
self.required_one_of: List[str] = []
- self.results = dict(
- changed=False,
- actions=[],
- node=None,
- )
+ self.results = {
+ "changed": False,
+ "actions": [],
+ "node": None,
+ }
super().__init__(
module_arg_spec=self.module_arg_spec,
diff --git a/plugins/modules/nodebalancer_stats.py b/plugins/modules/nodebalancer_stats.py
index b165fed6..19356c45 100644
--- a/plugins/modules/nodebalancer_stats.py
+++ b/plugins/modules/nodebalancer_stats.py
@@ -25,23 +25,23 @@
)
from linode_api4 import NodeBalancer
-linode_nodebalancer_stats_spec = dict(
- state=SpecField(type=FieldType.string, required=False, doc_hide=True),
- id=SpecField(
+linode_nodebalancer_stats_spec = {
+ "state": SpecField(type=FieldType.string, required=False, doc_hide=True),
+ "id": SpecField(
type=FieldType.integer,
description=[
"The id of the nodebalancer for which the statistics apply to."
],
conflicts_with=["label"],
),
- label=SpecField(
+ "label": SpecField(
type=FieldType.string,
description=[
"The label of the nodebalancer for which the statistics apply to."
],
conflicts_with=["id"],
),
-)
+}
SPECDOC_META = SpecDocMeta(
description=["View a Linode NodeBalancers Stats."],
@@ -49,15 +49,15 @@
author=global_authors,
options=linode_nodebalancer_stats_spec,
examples=docs.specdoc_examples,
- return_values=dict(
- node_balancer_stats=SpecReturnValue(
+ return_values={
+ "node_balancer_stats": SpecReturnValue(
description="The NodeBalancer Stats in JSON serialized form.",
docs_url="https://www.linode.com/docs/api/nodebalancers/"
+ "#nodebalancer-statistics-view__responses",
type=FieldType.dict,
sample=docs.result_nodebalancer_stats_samples,
),
- ),
+ },
)
diff --git a/plugins/modules/object_cluster_info.py b/plugins/modules/object_cluster_info.py
index 8e3620c6..3d5b4c2e 100644
--- a/plugins/modules/object_cluster_info.py
+++ b/plugins/modules/object_cluster_info.py
@@ -5,7 +5,6 @@
from __future__ import absolute_import, division, print_function
-# pylint: disable=unused-import
from typing import Any, List, Optional
from ansible_collections.linode.cloud.plugins.module_utils.doc_fragments import (
@@ -29,31 +28,31 @@
)
from linode_api4 import ObjectStorageCluster
-linode_object_cluster_info_spec = dict(
+linode_object_cluster_info_spec = {
# We need to overwrite attributes to exclude them as requirements
- state=SpecField(type=FieldType.string, required=False, doc_hide=True),
- label=SpecField(type=FieldType.string, required=False, doc_hide=True),
- id=SpecField(
+ "state": SpecField(type=FieldType.string, required=False, doc_hide=True),
+ "label": SpecField(type=FieldType.string, required=False, doc_hide=True),
+ "id": SpecField(
type=FieldType.string,
required=False,
description=["The unique id given to the clusters."],
),
- region=SpecField(
+ "region": SpecField(
type=FieldType.string,
required=False,
description=["The region the clusters are in."],
),
- domain=SpecField(
+ "domain": SpecField(
type=FieldType.string,
required=False,
description=["The domain of the clusters."],
),
- static_site_domain=SpecField(
+ "static_site_domain": SpecField(
type=FieldType.string,
required=False,
description=["The static-site domain of the clusters."],
),
-)
+}
SPECDOC_META = SpecDocMeta(
description=["Get info about a Linode Object Storage Cluster."],
@@ -61,14 +60,14 @@
author=global_authors,
options=linode_object_cluster_info_spec,
examples=docs.specdoc_examples,
- return_values=dict(
- clusters=SpecReturnValue(
+ return_values={
+ "clusters": SpecReturnValue(
description="The Object Storage clusters in JSON serialized form.",
docs_url="https://www.linode.com/docs/api/object-storage/#cluster-view__responses",
type=FieldType.list,
sample=docs.result_clusters_samples,
)
- ),
+ },
)
linode_object_cluster_valid_filters = [
@@ -85,11 +84,7 @@ class LinodeObjectStorageClustersInfo(LinodeModuleBase):
def __init__(self) -> None:
self.module_arg_spec = SPECDOC_META.ansible_spec
self.required_one_of: List[str] = []
- self.results = dict(
- changed=False,
- actions=[],
- clusters=None,
- )
+ self.results = {"changed": False, "actions": [], "clusters": None}
super().__init__(
module_arg_spec=self.module_arg_spec,
diff --git a/plugins/modules/object_cluster_list.py b/plugins/modules/object_cluster_list.py
index 89c8e5a6..bb40a7ca 100644
--- a/plugins/modules/object_cluster_list.py
+++ b/plugins/modules/object_cluster_list.py
@@ -27,8 +27,8 @@
SpecReturnValue,
)
-spec_filter = dict(
- name=SpecField(
+spec_filter = {
+ "name": SpecField(
type=FieldType.string,
required=True,
description=[
@@ -38,7 +38,7 @@
"#clusters-list__responses",
],
),
- values=SpecField(
+ "values": SpecField(
type=FieldType.list,
element_type=FieldType.string,
required=True,
@@ -47,23 +47,23 @@
"Fields will pass this filter if at least one of these values matches.",
],
),
-)
+}
-spec = dict(
+spec = {
# Disable the default values
- state=SpecField(type=FieldType.string, required=False, doc_hide=True),
- label=SpecField(type=FieldType.string, required=False, doc_hide=True),
- order=SpecField(
+ "state": SpecField(type=FieldType.string, required=False, doc_hide=True),
+ "label": SpecField(type=FieldType.string, required=False, doc_hide=True),
+ "order": SpecField(
type=FieldType.string,
description=["The order to list object storage clusters in."],
default="asc",
choices=["desc", "asc"],
),
- order_by=SpecField(
+ "order_by": SpecField(
type=FieldType.string,
description=["The attribute to order object storage clusters by."],
),
- filters=SpecField(
+ "filters": SpecField(
type=FieldType.list,
element_type=FieldType.dict,
suboptions=spec_filter,
@@ -71,14 +71,14 @@
"A list of filters to apply to the resulting object storage clusters."
],
),
- count=SpecField(
+ "count": SpecField(
type=FieldType.integer,
description=[
"The number of results to return.",
"If undefined, all results will be returned.",
],
),
-)
+}
SPECDOC_META = SpecDocMeta(
description=["List and filter on Object Storage Clusters."],
@@ -86,8 +86,8 @@
author=global_authors,
options=spec,
examples=docs.specdoc_examples,
- return_values=dict(
- clusters=SpecReturnValue(
+ return_values={
+ "clusters": SpecReturnValue(
description="The returned object storage clusters.",
docs_url="https://www.linode.com/docs/api/object-storage/"
"#clusters-list__response-samples",
@@ -95,7 +95,7 @@
elements=FieldType.dict,
sample=docs.result_object_clusters_samples,
)
- ),
+ },
)
diff --git a/plugins/modules/object_keys.py b/plugins/modules/object_keys.py
index 316ca939..e81e8197 100644
--- a/plugins/modules/object_keys.py
+++ b/plugins/modules/object_keys.py
@@ -5,7 +5,6 @@
from __future__ import absolute_import, division, print_function
-# pylint: disable=unused-import
from typing import Any, List, Optional, Union
import ansible_collections.linode.cloud.plugins.module_utils.doc_fragments.object_keys as docs
@@ -24,47 +23,47 @@
)
from linode_api4 import ObjectStorageKeys
-linode_access_spec = dict(
- cluster=SpecField(
+linode_access_spec = {
+ "cluster": SpecField(
type=FieldType.string,
required=True,
description=[
"The id of the cluster that the provided bucket exists under."
],
),
- bucket_name=SpecField(
+ "bucket_name": SpecField(
type=FieldType.string,
required=True,
description=[
"The name of the bucket to set the key's permissions for."
],
),
- permissions=SpecField(
+ "permissions": SpecField(
type=FieldType.string,
required=True,
description=["The permissions to give the key."],
choices=["read_only", "write_only", "read_write"],
),
-)
+}
-linode_object_keys_spec = dict(
- label=SpecField(
+linode_object_keys_spec = {
+ "label": SpecField(
type=FieldType.string,
description=["The unique label to give this key."],
),
- access=SpecField(
+ "access": SpecField(
type=FieldType.list,
element_type=FieldType.dict,
suboptions=linode_access_spec,
description=["A list of access permissions to give the key."],
),
- state=SpecField(
+ "state": SpecField(
type=FieldType.string,
description=["The desired state of the target."],
choices=["present", "absent"],
required=True,
),
-)
+}
SPECDOC_META = SpecDocMeta(
description=["Manage Linode Object Storage Keys."],
@@ -72,15 +71,15 @@
author=global_authors,
options=linode_object_keys_spec,
examples=docs.specdoc_examples,
- return_values=dict(
- key=SpecReturnValue(
+ return_values={
+ "key": SpecReturnValue(
description="The Object Storage key in JSON serialized form.",
docs_url="https://www.linode.com/docs/api/object-storage/#object-storage"
"-key-view__responses",
type=FieldType.dict,
sample=docs.result_key_samples,
)
- ),
+ },
)
@@ -90,11 +89,11 @@ class LinodeObjectStorageKeys(LinodeModuleBase):
def __init__(self) -> None:
self.module_arg_spec = SPECDOC_META.ansible_spec
self.required_one_of = ["state", "label"]
- self.results = dict(
- changed=False,
- actions=[],
- key=None,
- )
+ self.results = {
+ "changed": False,
+ "actions": [],
+ "key": None,
+ }
self._key: Optional[ObjectStorageKeys] = None
diff --git a/plugins/modules/profile_info.py b/plugins/modules/profile_info.py
index 6e799f10..6fcc1b15 100644
--- a/plugins/modules/profile_info.py
+++ b/plugins/modules/profile_info.py
@@ -5,7 +5,6 @@
from __future__ import absolute_import, division, print_function
-# pylint: disable=unused-import
from typing import Any, List, Optional
import ansible_collections.linode.cloud.plugins.module_utils.doc_fragments.profile_info as docs
@@ -23,11 +22,12 @@
SpecReturnValue,
)
-spec = dict(
+spec = {
# Disable the default values
- label=SpecField(type=FieldType.string, required=False, doc_hide=True),
- state=SpecField(type=FieldType.string, required=False, doc_hide=True),
-)
+ "label": SpecField(type=FieldType.string, required=False, doc_hide=True),
+ "state": SpecField(type=FieldType.string, required=False, doc_hide=True),
+}
+
SPECDOC_META = SpecDocMeta(
description=["Get info about a Linode Profile."],
@@ -35,14 +35,14 @@
author=global_authors,
options=spec,
examples=docs.specdoc_examples,
- return_values=dict(
- profile=SpecReturnValue(
+ return_values={
+ "profile": SpecReturnValue(
description="The profile info in JSON serialized form.",
docs_url="https://www.linode.com/docs/api/profile/#profile-view__response-samples",
type=FieldType.dict,
sample=docs.result_profile_samples,
)
- ),
+ },
)
@@ -51,9 +51,7 @@ class Module(LinodeModuleBase):
def __init__(self) -> None:
self.required_one_of: List[str] = []
- self.results = dict(
- profile=None,
- )
+ self.results = {"profile": None}
self.module_arg_spec = SPECDOC_META.ansible_spec
diff --git a/plugins/modules/region_list.py b/plugins/modules/region_list.py
index 5a161b4a..64a8a866 100644
--- a/plugins/modules/region_list.py
+++ b/plugins/modules/region_list.py
@@ -25,8 +25,8 @@
SpecReturnValue,
)
-spec_filter = dict(
- name=SpecField(
+spec_filter = {
+ "name": SpecField(
type=FieldType.string,
required=True,
description=[
@@ -36,7 +36,7 @@
"#regions-list__responses",
],
),
- values=SpecField(
+ "values": SpecField(
type=FieldType.list,
element_type=FieldType.string,
required=True,
@@ -45,36 +45,36 @@
"Fields will pass this filter if at least one of these values matches.",
],
),
-)
+}
-spec = dict(
+spec = {
# Disable the default values
- state=SpecField(type=FieldType.string, required=False, doc_hide=True),
- label=SpecField(type=FieldType.string, required=False, doc_hide=True),
- order=SpecField(
+ "state": SpecField(type=FieldType.string, required=False, doc_hide=True),
+ "label": SpecField(type=FieldType.string, required=False, doc_hide=True),
+ "order": SpecField(
type=FieldType.string,
description=["The order to list regions in."],
default="asc",
choices=["desc", "asc"],
),
- order_by=SpecField(
+ "order_by": SpecField(
type=FieldType.string,
description=["The attribute to order regions by."],
),
- filters=SpecField(
+ "filters": SpecField(
type=FieldType.list,
element_type=FieldType.dict,
suboptions=spec_filter,
description=["A list of filters to apply to the resulting regions."],
),
- count=SpecField(
+ "count": SpecField(
type=FieldType.integer,
description=[
"The number of results to return.",
"If undefined, all results will be returned.",
],
),
-)
+}
SPECDOC_META = SpecDocMeta(
description=["List and filter on Linode Regions."],
@@ -82,8 +82,8 @@
author=global_authors,
options=spec,
examples=docs.specdoc_examples,
- return_values=dict(
- regions=SpecReturnValue(
+ return_values={
+ "regions": SpecReturnValue(
description="The returned regions.",
docs_url="https://www.linode.com/docs/api/regions/"
"#regions-list__response-samples",
@@ -91,7 +91,7 @@
elements=FieldType.dict,
sample=docs.result_regions_samples,
)
- ),
+ },
)
diff --git a/plugins/modules/ssh_key.py b/plugins/modules/ssh_key.py
index d153d0cb..68859bc2 100644
--- a/plugins/modules/ssh_key.py
+++ b/plugins/modules/ssh_key.py
@@ -26,24 +26,24 @@
)
from linode_api4 import SSHKey
-ssh_key_spec = dict(
- label=SpecField(
+ssh_key_spec = {
+ "label": SpecField(
type=FieldType.string,
required=True,
description=["This SSH key's unique label."],
),
- state=SpecField(
+ "state": SpecField(
type=FieldType.string,
choices=["present", "absent"],
required=True,
description=["The state of this SSH key."],
),
- ssh_key=SpecField(
+ "ssh_key": SpecField(
type=FieldType.string,
editable=True,
description=["The SSH public key value."],
),
-)
+}
SPECDOC_META = SpecDocMeta(
description=["Manage a Linode SSH key."],
@@ -51,15 +51,15 @@
author=global_authors,
options=ssh_key_spec,
examples=docs.specdoc_examples,
- return_values=dict(
- ssh_key=SpecReturnValue(
+ return_values={
+ "ssh_key": SpecReturnValue(
description="The created SSH key in JSON serialized form.",
docs_url="https://www.linode.com/docs/api/profile/"
"#ssh-key-add__response-samples",
type=FieldType.dict,
sample=docs.result_ssh_key_samples,
)
- ),
+ },
)
MUTABLE_FIELDS = {"label"}
@@ -70,11 +70,11 @@ class SSHKeyModule(LinodeModuleBase):
def __init__(self) -> None:
self.module_arg_spec = SPECDOC_META.ansible_spec
- self.results = dict(
- changed=False,
- actions=[],
- ssh_key=None,
- )
+ self.results = {
+ "changed": False,
+ "actions": [],
+ "ssh_key": None,
+ }
super().__init__(
module_arg_spec=self.module_arg_spec,
required_if=[["state", "present", ["ssh_key"]]],
diff --git a/plugins/modules/ssh_key_info.py b/plugins/modules/ssh_key_info.py
index 58c71af2..0e312d69 100644
--- a/plugins/modules/ssh_key_info.py
+++ b/plugins/modules/ssh_key_info.py
@@ -5,7 +5,6 @@
from __future__ import absolute_import, division, print_function
-# pylint: disable=unused-import
from typing import Any, Optional
import ansible_collections.linode.cloud.plugins.module_utils.doc_fragments.ssh_key_info as docs
@@ -27,20 +26,20 @@
)
from linode_api4 import SSHKey
-linode_ssh_key_info_spec = dict(
+linode_ssh_key_info_spec = {
# Disable the default values
- state=SpecField(type=FieldType.string, required=False, doc_hide=True),
- id=SpecField(
+ "state": SpecField(type=FieldType.string, required=False, doc_hide=True),
+ "id": SpecField(
type=FieldType.integer,
conflicts_with=["label"],
description=["The ID of the SSH key."],
),
- label=SpecField(
+ "label": SpecField(
type=FieldType.string,
conflicts_with=["id"],
description=["The label of the SSH key."],
),
-)
+}
SPECDOC_META = SpecDocMeta(
description=["Get info about the Linode SSH public key."],
@@ -48,15 +47,15 @@
author=global_authors,
options=linode_ssh_key_info_spec,
examples=docs.specdoc_examples,
- return_values=dict(
- ssh_key=SpecReturnValue(
+ return_values={
+ "ssh_key": SpecReturnValue(
description="The SSH key in JSON serialized form.",
docs_url="https://www.linode.com/docs/api/profile/"
"#ssh-key-view__response-samples",
type=FieldType.dict,
sample=docs.ssh_key_info_response_sample,
)
- ),
+ },
)
diff --git a/plugins/modules/ssh_key_list.py b/plugins/modules/ssh_key_list.py
index e28d7c5a..cf096fb6 100644
--- a/plugins/modules/ssh_key_list.py
+++ b/plugins/modules/ssh_key_list.py
@@ -26,8 +26,8 @@
SpecReturnValue,
)
-spec_filter = dict(
- name=SpecField(
+spec_filter = {
+ "name": SpecField(
type=FieldType.string,
required=True,
description=[
@@ -39,7 +39,7 @@
),
],
),
- values=SpecField(
+ "values": SpecField(
type=FieldType.list,
element_type=FieldType.string,
required=True,
@@ -48,36 +48,36 @@
"Fields will pass this filter if at least one of these values matches.",
],
),
-)
+}
-spec = dict(
+spec = {
# Disable the default values
- state=SpecField(type=FieldType.string, required=False, doc_hide=True),
- label=SpecField(type=FieldType.string, required=False, doc_hide=True),
- order=SpecField(
+ "state": SpecField(type=FieldType.string, required=False, doc_hide=True),
+ "label": SpecField(type=FieldType.string, required=False, doc_hide=True),
+ "order": SpecField(
type=FieldType.string,
description=["The order to list ssh keys in."],
default="asc",
choices=["desc", "asc"],
),
- order_by=SpecField(
+ "order_by": SpecField(
type=FieldType.string,
description=["The attribute to order ssh keys by."],
),
- filters=SpecField(
+ "filters": SpecField(
type=FieldType.list,
element_type=FieldType.dict,
suboptions=spec_filter,
description=["A list of filters to apply to the resulting ssh keys."],
),
- count=SpecField(
+ "count": SpecField(
type=FieldType.integer,
description=[
"The number of results to return.",
"If undefined, all results will be returned.",
],
),
-)
+}
SPECDOC_META = SpecDocMeta(
description=["List and filter on SSH keys in the Linode profile."],
@@ -85,17 +85,15 @@
author=global_authors,
options=spec,
examples=docs.ssh_key_list_specdoc_examples,
- return_values=dict(
- ssh_keys=SpecReturnValue(
+ return_values={
+ "ssh_keys": SpecReturnValue(
description="The returned SSH keys.",
- docs_url=(
- "https://www.linode.com/docs/api/profile/" "#ssh-keys-list"
- ),
+ docs_url="https://www.linode.com/docs/api/profile/#ssh-keys-list",
type=FieldType.list,
elements=FieldType.dict,
sample=docs.result_ssh_key_list_samples,
)
- ),
+ },
)
diff --git a/plugins/modules/stackscript.py b/plugins/modules/stackscript.py
index d9dce3b7..3ced49a2 100644
--- a/plugins/modules/stackscript.py
+++ b/plugins/modules/stackscript.py
@@ -5,7 +5,6 @@
from __future__ import absolute_import, division, print_function
-# pylint: disable=unused-import
import copy
from typing import Any, Optional
@@ -29,37 +28,37 @@
)
from linode_api4 import StackScript
-SPEC = dict(
- label=SpecField(
+SPEC = {
+ "label": SpecField(
type=FieldType.string,
required=True,
description=["This StackScript's unique label."],
),
- state=SpecField(
+ "state": SpecField(
type=FieldType.string,
choices=["present", "absent"],
required=True,
description=["The state of this StackScript."],
),
- description=SpecField(
+ "description": SpecField(
type=FieldType.string,
editable=True,
description=["A description for the StackScript."],
),
- images=SpecField(
+ "images": SpecField(
type=FieldType.list,
element_type=FieldType.string,
editable=True,
description=["Images that can be deployed using this StackScript."],
),
- is_public=SpecField(
+ "is_public": SpecField(
type=FieldType.bool,
editable=True,
description=[
"This determines whether other users can use your StackScript."
],
),
- rev_note=SpecField(
+ "rev_note": SpecField(
type=FieldType.string,
editable=True,
description=[
@@ -67,14 +66,14 @@
"the set of revisions made to this StackScript."
],
),
- script=SpecField(
+ "script": SpecField(
type=FieldType.string,
editable=True,
description=[
"The script to execute when provisioning a new Linode with this StackScript."
],
),
-)
+}
SPECDOC_META = SpecDocMeta(
description=["Manage a Linode StackScript."],
@@ -82,15 +81,15 @@
author=global_authors,
options=SPEC,
examples=docs.specdoc_examples,
- return_values=dict(
- stackscript=SpecReturnValue(
+ return_values={
+ "stackscript": SpecReturnValue(
description="The StackScript in JSON serialized form.",
docs_url="https://www.linode.com/docs/api/stackscripts/"
"#stackscript-create__response-samples",
type=FieldType.dict,
sample=docs.result_stackscript_samples,
)
- ),
+ },
)
MUTABLE_FIELDS = {"description", "images", "is_public", "rev_note", "script"}
@@ -102,11 +101,11 @@ class Module(LinodeModuleBase):
def __init__(self) -> None:
self.module_arg_spec = SPECDOC_META.ansible_spec
self.required_one_of = ["state", "label"]
- self.results = dict(
- changed=False,
- actions=[],
- stackscript=None,
- )
+ self.results = {
+ "changed": False,
+ "actions": [],
+ "stackscript": None,
+ }
super().__init__(
module_arg_spec=self.module_arg_spec,
diff --git a/plugins/modules/stackscript_info.py b/plugins/modules/stackscript_info.py
index ab13c7df..95e8ec9f 100644
--- a/plugins/modules/stackscript_info.py
+++ b/plugins/modules/stackscript_info.py
@@ -5,7 +5,6 @@
from __future__ import absolute_import, division, print_function
-# pylint: disable=unused-import
from typing import Any, Optional
from ansible_collections.linode.cloud.plugins.module_utils.doc_fragments import (
@@ -32,20 +31,20 @@
)
from linode_api4 import StackScript
-spec = dict(
+spec = {
# Disable the default values
- state=SpecField(type=FieldType.string, required=False, doc_hide=True),
- id=SpecField(
+ "state": SpecField(type=FieldType.string, required=False, doc_hide=True),
+ "id": SpecField(
type=FieldType.integer,
description=["The ID of the StackScript."],
conflicts_with=["label"],
),
- label=SpecField(
+ "label": SpecField(
type=FieldType.string,
description=["The label of the StackScript."],
conflicts_with=["id"],
),
-)
+}
SPECDOC_META = SpecDocMeta(
description=["Get info about a Linode StackScript."],
@@ -53,15 +52,15 @@
author=global_authors,
options=spec,
examples=docs.specdoc_examples,
- return_values=dict(
- stackscript=SpecReturnValue(
+ return_values={
+ "stackscript": SpecReturnValue(
description="The StackScript in JSON serialized form.",
docs_url="https://www.linode.com/docs/api/stackscripts/"
"#stackscript-view__response-samples",
type="dict",
sample=docs_parent.result_stackscript_samples,
)
- ),
+ },
)
diff --git a/plugins/modules/stackscript_list.py b/plugins/modules/stackscript_list.py
index a7746496..53c6524a 100644
--- a/plugins/modules/stackscript_list.py
+++ b/plugins/modules/stackscript_list.py
@@ -5,7 +5,6 @@
from __future__ import absolute_import, division, print_function
-# pylint: disable=unused-import
from typing import Any, Dict, Optional
import ansible_collections.linode.cloud.plugins.module_utils.doc_fragments.stackscript_list as docs
@@ -27,8 +26,8 @@
SpecReturnValue,
)
-spec_filter = dict(
- name=SpecField(
+spec_filter = {
+ "name": SpecField(
type=FieldType.string,
required=True,
description=[
@@ -38,7 +37,7 @@
"https://www.linode.com/docs/api/stackscripts/#stackscripts-list__response-samples",
],
),
- values=SpecField(
+ "values": SpecField(
type=FieldType.list,
element_type=FieldType.string,
required=True,
@@ -47,35 +46,35 @@
"Fields will pass this filter if at least one of these values matches.",
],
),
-)
+}
-spec = dict(
+spec = {
# Disable the default values
- state=SpecField(type=FieldType.string, required=False, doc_hide=True),
- label=SpecField(type=FieldType.string, required=False, doc_hide=True),
- order=SpecField(
+ "state": SpecField(type=FieldType.string, required=False, doc_hide=True),
+ "label": SpecField(type=FieldType.string, required=False, doc_hide=True),
+ "order": SpecField(
type=FieldType.string,
description=["The order to list events in."],
default="asc",
choices=["desc", "asc"],
),
- order_by=SpecField(
+ "order_by": SpecField(
type=FieldType.string, description=["The attribute to order events by."]
),
- filters=SpecField(
+ "filters": SpecField(
type=FieldType.list,
element_type=FieldType.dict,
suboptions=spec_filter,
description=["A list of filters to apply to the resulting events."],
),
- count=SpecField(
+ "count": SpecField(
type=FieldType.integer,
description=[
"The number of results to return.",
"If undefined, all results will be returned.",
],
),
-)
+}
SPECDOC_META = SpecDocMeta(
description=["List and filter on Linode stackscripts."],
@@ -83,8 +82,8 @@
author=global_authors,
options=spec,
examples=docs.specdoc_examples,
- return_values=dict(
- stackscripts=SpecReturnValue(
+ return_values={
+ "stackscripts": SpecReturnValue(
description="The returned stackscripts.",
# pylint: disable-next=line-too-long
docs_url="https://www.linode.com/docs/api/stackscripts/#stackscripts-list__response-samples",
@@ -92,7 +91,7 @@
elements=FieldType.dict,
sample=docs.result_stackscripts_samples,
)
- ),
+ },
)
diff --git a/plugins/modules/token.py b/plugins/modules/token.py
index 52d26bcb..63d6a5b7 100644
--- a/plugins/modules/token.py
+++ b/plugins/modules/token.py
@@ -5,7 +5,6 @@
from __future__ import absolute_import, division, print_function
-# pylint: disable=unused-import
from typing import Any, Optional
import ansible_collections.linode.cloud.plugins.module_utils.doc_fragments.token as docs
@@ -24,28 +23,28 @@
)
from linode_api4 import PersonalAccessToken
-SPEC = dict(
- label=SpecField(
+SPEC = {
+ "label": SpecField(
type=FieldType.string,
required=True,
description=["This token's unique label."],
),
- state=SpecField(
+ "state": SpecField(
type=FieldType.string,
choices=["present", "absent"],
required=True,
description=["The state of this token."],
),
- expiry=SpecField(
+ "expiry": SpecField(
type=FieldType.string,
default=None,
description=["When this token should be valid until."],
),
- scopes=SpecField(
+ "scopes": SpecField(
type=FieldType.string,
description=["The OAuth scopes to create the token with."],
),
-)
+}
SPECDOC_META = SpecDocMeta(
description=[
@@ -57,15 +56,15 @@
author=global_authors,
options=SPEC,
examples=docs.specdoc_examples,
- return_values=dict(
- token=SpecReturnValue(
+ return_values={
+ "token": SpecReturnValue(
description="The token in JSON serialized form.",
docs_url="https://www.linode.com/docs/api/profile/"
"#personal-access-token-create__responses",
type=FieldType.dict,
sample=docs.result_token_samples,
)
- ),
+ },
)
@@ -75,11 +74,7 @@ class Module(LinodeModuleBase):
def __init__(self) -> None:
self.module_arg_spec = SPECDOC_META.ansible_spec
self.required_one_of = ["state", "label"]
- self.results = dict(
- changed=False,
- actions=[],
- token=None,
- )
+ self.results = {"changed": False, "actions": [], "token": None}
super().__init__(
module_arg_spec=self.module_arg_spec,
diff --git a/plugins/modules/token_info.py b/plugins/modules/token_info.py
index ded6f54d..3f5f7d87 100644
--- a/plugins/modules/token_info.py
+++ b/plugins/modules/token_info.py
@@ -5,7 +5,6 @@
from __future__ import absolute_import, division, print_function
-# pylint: disable=unused-import
from typing import Any, Optional
import ansible_collections.linode.cloud.plugins.module_utils.doc_fragments.token as docs_parent
@@ -28,20 +27,20 @@
)
from linode_api4 import PersonalAccessToken
-spec = dict(
+spec = {
# Disable the default values
- state=SpecField(type=FieldType.string, required=False, doc_hide=True),
- id=SpecField(
+ "state": SpecField(type=FieldType.string, required=False, doc_hide=True),
+ "id": SpecField(
type=FieldType.integer,
description=["The ID of the token."],
conflicts_with=["label"],
),
- label=SpecField(
+ "label": SpecField(
type=FieldType.string,
description=["The label of the token."],
conflicts_with=["id"],
),
-)
+}
SPECDOC_META = SpecDocMeta(
description=["Get info about a Linode Personal Access Token."],
@@ -49,15 +48,15 @@
author=global_authors,
options=spec,
examples=docs.specdoc_examples,
- return_values=dict(
- token=SpecReturnValue(
+ return_values={
+ "token": SpecReturnValue(
description="The token in JSON serialized form.",
docs_url="https://www.linode.com/docs/api/profile/"
"#personal-access-token-create__response-samples",
type=FieldType.dict,
sample=docs_parent.result_token_samples,
)
- ),
+ },
)
diff --git a/plugins/modules/token_list.py b/plugins/modules/token_list.py
index ebd5cc0f..b9e4d7db 100644
--- a/plugins/modules/token_list.py
+++ b/plugins/modules/token_list.py
@@ -25,8 +25,8 @@
SpecReturnValue,
)
-spec_filter = dict(
- name=SpecField(
+spec_filter = {
+ "name": SpecField(
type=FieldType.string,
required=True,
description=[
@@ -36,7 +36,7 @@
"#personal-access-tokens-list__responses",
],
),
- values=SpecField(
+ "values": SpecField(
type=FieldType.list,
element_type=FieldType.string,
required=True,
@@ -45,36 +45,36 @@
"Fields will pass this filter if at least one of these values matches.",
],
),
-)
+}
-spec = dict(
+spec = {
# Disable the default values
- state=SpecField(type=FieldType.string, required=False, doc_hide=True),
- label=SpecField(type=FieldType.string, required=False, doc_hide=True),
- order=SpecField(
+ "state": SpecField(type=FieldType.string, required=False, doc_hide=True),
+ "label": SpecField(type=FieldType.string, required=False, doc_hide=True),
+ "order": SpecField(
type=FieldType.string,
description=["The order to list tokens in."],
default="asc",
choices=["desc", "asc"],
),
- order_by=SpecField(
+ "order_by": SpecField(
type=FieldType.string,
description=["The attribute to order tokens by."],
),
- filters=SpecField(
+ "filters": SpecField(
type=FieldType.list,
element_type=FieldType.dict,
suboptions=spec_filter,
description=["A list of filters to apply to the resulting tokens."],
),
- count=SpecField(
+ "count": SpecField(
type=FieldType.integer,
description=[
"The number of results to return.",
"If undefined, all results will be returned.",
],
),
-)
+}
SPECDOC_META = SpecDocMeta(
description=["List and filter on Linode Account tokens."],
@@ -82,16 +82,16 @@
author=global_authors,
options=spec,
examples=docs.specdoc_examples,
- return_values=dict(
- tokens=SpecReturnValue(
+ return_values={
+ "tokens": SpecReturnValue(
description="The returned tokens.",
docs_url="https://www.linode.com/docs/api/profile/"
"#personal-access-tokens-list__response-samples",
type=FieldType.list,
elements=FieldType.dict,
sample=docs.result_tokens_samples,
- )
- ),
+ ),
+ },
)
diff --git a/plugins/modules/type_list.py b/plugins/modules/type_list.py
index 44fba559..ae5f88de 100644
--- a/plugins/modules/type_list.py
+++ b/plugins/modules/type_list.py
@@ -5,7 +5,6 @@
from __future__ import absolute_import, division, print_function
-# pylint: disable=unused-import
from typing import Any, Dict, Optional
import ansible_collections.linode.cloud.plugins.module_utils.doc_fragments.type_list as docs
@@ -27,8 +26,8 @@
SpecReturnValue,
)
-spec_filter = dict(
- name=SpecField(
+spec_filter = {
+ "name": SpecField(
type=FieldType.string,
required=True,
description=[
@@ -37,7 +36,7 @@
"https://www.linode.com/docs/api/linode-types/#types-list__response-samples",
],
),
- values=SpecField(
+ "values": SpecField(
type=FieldType.list,
element_type=FieldType.string,
required=True,
@@ -46,23 +45,23 @@
"Fields will pass this filter if at least one of these values matches.",
],
),
-)
+}
-spec = dict(
+spec = {
# Disable the default values
- state=SpecField(type=FieldType.string, required=False, doc_hide=True),
- label=SpecField(type=FieldType.string, required=False, doc_hide=True),
- order=SpecField(
+ "state": SpecField(type=FieldType.string, required=False, doc_hide=True),
+ "label": SpecField(type=FieldType.string, required=False, doc_hide=True),
+ "order": SpecField(
type=FieldType.string,
description=["The order to list Instance Types in."],
default="asc",
choices=["desc", "asc"],
),
- order_by=SpecField(
+ "order_by": SpecField(
type=FieldType.string,
description=["The attribute to order Instance Types by."],
),
- filters=SpecField(
+ "filters": SpecField(
type=FieldType.list,
element_type=FieldType.dict,
suboptions=spec_filter,
@@ -70,14 +69,14 @@
"A list of filters to apply to the resulting Instance Types."
],
),
- count=SpecField(
+ "count": SpecField(
type=FieldType.integer,
description=[
"The number of results to return.",
"If undefined, all results will be returned.",
],
),
-)
+}
SPECDOC_META = SpecDocMeta(
description=["List and filter on Linode Instance Types."],
@@ -85,15 +84,15 @@
author=global_authors,
options=spec,
examples=docs.specdoc_examples,
- return_values=dict(
- types=SpecReturnValue(
+ return_values={
+ "types": SpecReturnValue(
description="The returned Instance Types.",
docs_url="https://www.linode.com/docs/api/linode-types/#types-list__response-samples",
type=FieldType.list,
elements=FieldType.dict,
sample=docs.result_type_samples,
)
- ),
+ },
)
diff --git a/plugins/modules/user.py b/plugins/modules/user.py
index 4dc856b4..e8853934 100644
--- a/plugins/modules/user.py
+++ b/plugins/modules/user.py
@@ -5,7 +5,6 @@
from __future__ import absolute_import, division, print_function
-# pylint: disable=unused-import
from typing import Any, Dict, List, Optional
import ansible_collections.linode.cloud.plugins.module_utils.doc_fragments.user as docs
@@ -213,21 +212,21 @@
author=global_authors,
options=SPEC,
examples=docs.specdoc_examples,
- return_values=dict(
- user=SpecReturnValue(
+ return_values={
+ "user": SpecReturnValue(
description="The user in JSON serialized form.",
docs_url="https://www.linode.com/docs/api/account/#user-view__response-samples",
type=FieldType.dict,
sample=docs.result_user_samples,
),
- grants=SpecReturnValue(
+ "grants": SpecReturnValue(
description="The grants info in JSON serialized form.",
docs_url="https://www.linode.com/docs/api/account/"
"#users-grants-view__response-samples",
type=FieldType.dict,
sample=docs.result_grants_samples,
),
- ),
+ },
)
MUTABLE_FIELDS = {"restricted"}
@@ -239,7 +238,12 @@ class Module(LinodeModuleBase):
def __init__(self) -> None:
self.module_arg_spec = SPECDOC_META.ansible_spec
self.required_one_of = ["state", "username"]
- self.results = dict(changed=False, actions=[], user=None, grants=None)
+ self.results = {
+ "changed": False,
+ "actions": [],
+ "user": None,
+ "grants": None,
+ }
super().__init__(
module_arg_spec=self.module_arg_spec,
diff --git a/plugins/modules/user_info.py b/plugins/modules/user_info.py
index 5af768d0..823cce93 100644
--- a/plugins/modules/user_info.py
+++ b/plugins/modules/user_info.py
@@ -5,7 +5,6 @@
from __future__ import absolute_import, division, print_function
-# pylint: disable=unused-import
from typing import Any, List, Optional
import ansible_collections.linode.cloud.plugins.module_utils.doc_fragments.user_info as docs
@@ -24,16 +23,16 @@
)
from linode_api4 import User
-spec = dict(
+spec = {
# Disable the default values
- label=SpecField(type=FieldType.string, required=False, doc_hide=True),
- state=SpecField(type=FieldType.string, required=False, doc_hide=True),
- username=SpecField(
+ "label": SpecField(type=FieldType.string, required=False, doc_hide=True),
+ "state": SpecField(type=FieldType.string, required=False, doc_hide=True),
+ "username": SpecField(
type=FieldType.string,
required=True,
description=["The username of the user."],
),
-)
+}
SPECDOC_META = SpecDocMeta(
description=["Get info about a Linode User."],
@@ -41,20 +40,20 @@
author=global_authors,
options=spec,
examples=docs.specdoc_examples,
- return_values=dict(
- user=SpecReturnValue(
+ return_values={
+ "user": SpecReturnValue(
description="The user info in JSON serialized form.",
docs_url="https://www.linode.com/docs/api/account/#user-view",
type=FieldType.dict,
sample=docs.result_user_samples,
),
- grants=SpecReturnValue(
+ "grants": SpecReturnValue(
description="The grants info in JSON serialized form.",
docs_url="https://www.linode.com/docs/api/account/#users-grants-view__response-samples",
type=FieldType.dict,
sample=docs.result_grants_samples,
),
- ),
+ },
)
@@ -63,9 +62,7 @@ class Module(LinodeModuleBase):
def __init__(self) -> None:
self.required_one_of: List[str] = []
- self.results = dict(
- user=None,
- )
+ self.results = {"user": None}
self.module_arg_spec = SPECDOC_META.ansible_spec
diff --git a/plugins/modules/user_list.py b/plugins/modules/user_list.py
index 564775fb..bcb444b5 100644
--- a/plugins/modules/user_list.py
+++ b/plugins/modules/user_list.py
@@ -24,24 +24,24 @@
SpecReturnValue,
)
-spec = dict(
+spec = {
# Disable the default values
- state=SpecField(type=FieldType.string, required=False, doc_hide=True),
- label=SpecField(type=FieldType.string, required=False, doc_hide=True),
- order=SpecField(
+ "state": SpecField(type=FieldType.string, required=False, doc_hide=True),
+ "label": SpecField(type=FieldType.string, required=False, doc_hide=True),
+ "order": SpecField(
type=FieldType.string,
description=["The order to list users in."],
default="asc",
choices=["desc", "asc"],
),
- count=SpecField(
+ "count": SpecField(
type=FieldType.integer,
description=[
"The number of results to return.",
"If undefined, all results will be returned.",
],
),
-)
+}
SPECDOC_META = SpecDocMeta(
description=["List Users."],
@@ -49,16 +49,18 @@
author=global_authors,
options=spec,
examples=docs.specdoc_examples,
- return_values=dict(
- users=SpecReturnValue(
+ return_values={
+ "users": SpecReturnValue(
description="The returned users.",
- docs_url="https://www.linode.com/docs/api/account/"
- "#users-list__response-samples",
+ docs_url=(
+ "https://www.linode.com/docs/api/account/"
+ "#users-list__response-samples"
+ ),
type=FieldType.list,
elements=FieldType.dict,
sample=docs.result_users_samples,
)
- ),
+ },
)
diff --git a/plugins/modules/vlan_info.py b/plugins/modules/vlan_info.py
index bd2f4120..825fd0ad 100644
--- a/plugins/modules/vlan_info.py
+++ b/plugins/modules/vlan_info.py
@@ -5,7 +5,6 @@
from __future__ import absolute_import, division, print_function
-# pylint: disable=unused-import
from typing import Any, List, Optional
import ansible_collections.linode.cloud.plugins.module_utils.doc_fragments.vlan_info as docs
@@ -24,13 +23,13 @@
)
from linode_api4 import VLAN
-linode_vlan_info_spec = dict(
+linode_vlan_info_spec = {
# We need to overwrite attributes to exclude them as requirements
- state=SpecField(type=FieldType.string, required=False, doc_hide=True),
- label=SpecField(
+ "state": SpecField(type=FieldType.string, required=False, doc_hide=True),
+ "label": SpecField(
type=FieldType.string, required=True, description=["The VLAN’s label."]
),
-)
+}
SPECDOC_META = SpecDocMeta(
description=["Get info about a Linode VLAN."],
@@ -38,14 +37,14 @@
author=global_authors,
options=linode_vlan_info_spec,
examples=docs.specdoc_examples,
- return_values=dict(
- vlan=SpecReturnValue(
+ return_values={
+ "vlan": SpecReturnValue(
description="The VLAN in JSON serialized form.",
docs_url="https://www.linode.com/docs/api/networking/#vlans-list__response-samples",
type=FieldType.dict,
sample=docs.result_vlan_samples,
)
- ),
+ },
)
@@ -55,9 +54,7 @@ class LinodeVLANInfo(LinodeModuleBase):
def __init__(self) -> None:
self.module_arg_spec = SPECDOC_META.ansible_spec
self.required_one_of: List[str] = []
- self.results = dict(
- vlan=None,
- )
+ self.results = {"vlan": None}
super().__init__(
module_arg_spec=self.module_arg_spec,
diff --git a/plugins/modules/vlan_list.py b/plugins/modules/vlan_list.py
index 71141269..795afc99 100644
--- a/plugins/modules/vlan_list.py
+++ b/plugins/modules/vlan_list.py
@@ -5,7 +5,6 @@
from __future__ import absolute_import, division, print_function
-# pylint: disable=unused-import
from typing import Any, Dict, Optional
import ansible_collections.linode.cloud.plugins.module_utils.doc_fragments.vlan_list as docs
@@ -27,8 +26,8 @@
SpecReturnValue,
)
-spec_filter = dict(
- name=SpecField(
+spec_filter = {
+ "name": SpecField(
type=FieldType.string,
required=True,
description=[
@@ -37,7 +36,7 @@
"https://www.linode.com/docs/api/networking/#vlans-list__response-samples",
],
),
- values=SpecField(
+ "values": SpecField(
type=FieldType.list,
element_type=FieldType.string,
required=True,
@@ -46,35 +45,35 @@
"Fields will pass this filter if at least one of these values matches.",
],
),
-)
+}
-spec = dict(
+spec = {
# Disable the default values
- state=SpecField(type=FieldType.string, required=False, doc_hide=True),
- label=SpecField(type=FieldType.string, required=False, doc_hide=True),
- order=SpecField(
+ "state": SpecField(type=FieldType.string, required=False, doc_hide=True),
+ "label": SpecField(type=FieldType.string, required=False, doc_hide=True),
+ "order": SpecField(
type=FieldType.string,
description=["The order to list VLANs in."],
default="asc",
choices=["desc", "asc"],
),
- order_by=SpecField(
+ "order_by": SpecField(
type=FieldType.string, description=["The attribute to order VLANs by."]
),
- filters=SpecField(
+ "filters": SpecField(
type=FieldType.list,
element_type=FieldType.dict,
suboptions=spec_filter,
description=["A list of filters to apply to the resulting VLANs."],
),
- count=SpecField(
+ "count": SpecField(
type=FieldType.integer,
description=[
"The number of results to return.",
"If undefined, all results will be returned.",
],
),
-)
+}
SPECDOC_META = SpecDocMeta(
description=["List and filter on Linode VLANs."],
@@ -82,15 +81,15 @@
author=global_authors,
options=spec,
examples=docs.specdoc_examples,
- return_values=dict(
- vlans=SpecReturnValue(
+ return_values={
+ "vlans": SpecReturnValue(
description="The returned VLANs.",
docs_url="https://www.linode.com/docs/api/networking/#vlans-list__response-samples",
type=FieldType.list,
elements=FieldType.dict,
sample=docs.result_vlan_samples,
)
- ),
+ },
)
diff --git a/plugins/modules/volume.py b/plugins/modules/volume.py
index 9668c6a2..2f0bbd92 100644
--- a/plugins/modules/volume.py
+++ b/plugins/modules/volume.py
@@ -5,7 +5,6 @@
from __future__ import absolute_import, division, print_function
-# pylint: disable=unused-import
from typing import Any, Optional, Set
import ansible_collections.linode.cloud.plugins.module_utils.doc_fragments.volume as docs
@@ -20,9 +19,6 @@
from ansible_collections.linode.cloud.plugins.module_utils.linode_event_poller import (
EventPoller,
)
-from ansible_collections.linode.cloud.plugins.module_utils.linode_helper import (
- request_retry,
-)
from ansible_specdoc.objects import (
FieldType,
SpecDocMeta,
@@ -31,15 +27,15 @@
)
from linode_api4 import Volume
-linode_volume_spec = dict(
- label=SpecField(
+linode_volume_spec = {
+ "label": SpecField(
type=FieldType.string,
description=[
"The Volume’s label, which is also used in the "
"filesystem_path of the resulting volume."
],
),
- config_id=SpecField(
+ "config_id": SpecField(
type=FieldType.integer,
default=None,
description=[
@@ -47,7 +43,7 @@
"to include the new Volume in."
],
),
- linode_id=SpecField(
+ "linode_id": SpecField(
type=FieldType.integer,
default=None,
editable=True,
@@ -56,14 +52,14 @@
"If not given, the volume will be created without an attachment.",
],
),
- region=SpecField(
+ "region": SpecField(
type=FieldType.string,
description=[
"The location to deploy the volume in.",
- "See U(https://api.linode.com/v4/regions)",
+ "See https://api.linode.com/v4/regions",
],
),
- size=SpecField(
+ "size": SpecField(
type=FieldType.integer,
default=None,
editable=True,
@@ -72,7 +68,7 @@
"Be aware that volumes may only be resized up after creation.",
],
),
- attached=SpecField(
+ "attached": SpecField(
type=FieldType.bool,
default=True,
editable=True,
@@ -81,7 +77,7 @@
"Otherwise, the volume will be detached."
],
),
- wait_timeout=SpecField(
+ "wait_timeout": SpecField(
type=FieldType.integer,
default=240,
description=[
@@ -89,23 +85,23 @@
"have the active status."
],
),
- state=SpecField(
+ "state": SpecField(
type=FieldType.string,
description=["The desired state of the target."],
choices=["present", "absent"],
required=True,
),
- source_volume_id=SpecField(
+ "source_volume_id": SpecField(
type=FieldType.integer,
required=False,
description=["The volume id of the desired volume to clone."],
),
- tags=SpecField(
+ "tags": SpecField(
type=FieldType.list,
required=False,
description=["The tags to be attached to the volume."],
),
-)
+}
SPECDOC_META = SpecDocMeta(
description=["Manage a Linode Volume."],
@@ -113,14 +109,14 @@
author=global_authors,
options=linode_volume_spec,
examples=docs.specdoc_examples,
- return_values=dict(
- volume=SpecReturnValue(
+ return_values={
+ "volume": SpecReturnValue(
description="The volume in JSON serialized form.",
docs_url="https://www.linode.com/docs/api/volumes/#volume-view__responses",
type=FieldType.dict,
sample=docs.result_volume_samples,
)
- ),
+ },
)
@@ -130,11 +126,11 @@ class LinodeVolume(LinodeModuleBase):
def __init__(self) -> None:
self.module_arg_spec = SPECDOC_META.ansible_spec
self.required_one_of = ["state", "label"]
- self.results = dict(
- changed=False,
- actions=[],
- volume=None,
- )
+ self.results = {
+ "changed": False,
+ "actions": [],
+ "volume": None,
+ }
self._volume: Optional[Volume] = None
@@ -216,11 +212,9 @@ def _clone_volume(self) -> Volume:
)
# Perform the clone operation
- vol = request_retry(
- lambda: self.client.post(
- "/volumes/{}/clone".format(source_id),
- data={"label": params.get("label")},
- )
+ vol = self.client.post(
+ "/volumes/{}/clone".format(source_id),
+ data={"label": params.get("label")},
)
cloned_volume = Volume(self.client, vol.get("id"))
diff --git a/plugins/modules/volume_info.py b/plugins/modules/volume_info.py
index a2b8b07a..ae53bd25 100644
--- a/plugins/modules/volume_info.py
+++ b/plugins/modules/volume_info.py
@@ -5,7 +5,6 @@
from __future__ import absolute_import, division, print_function
-# pylint: disable=unused-import
from typing import Any, List, Optional
import ansible_collections.linode.cloud.plugins.module_utils.doc_fragments.volume as docs_parent
@@ -28,10 +27,10 @@
)
from linode_api4 import Volume
-linode_volume_info_spec = dict(
+linode_volume_info_spec = {
# We need to overwrite attributes to exclude them as requirements
- state=SpecField(type=FieldType.string, required=False, doc_hide=True),
- id=SpecField(
+ "state": SpecField(type=FieldType.string, required=False, doc_hide=True),
+ "id": SpecField(
type=FieldType.integer,
required=False,
conflicts_with=["label"],
@@ -40,7 +39,7 @@
"Optional if `label` is defined.",
],
),
- label=SpecField(
+ "label": SpecField(
type=FieldType.string,
required=False,
conflicts_with=["id"],
@@ -49,7 +48,7 @@
"Optional if `id` is defined.",
],
),
-)
+}
SPECDOC_META = SpecDocMeta(
description=["Get info about a Linode Volume."],
@@ -57,14 +56,14 @@
author=global_authors,
options=linode_volume_info_spec,
examples=docs.specdoc_examples,
- return_values=dict(
- volume=SpecReturnValue(
+ return_values={
+ "volume": SpecReturnValue(
description="The volume in JSON serialized form.",
docs_url="https://www.linode.com/docs/api/volumes/#volume-view__responses",
type=FieldType.dict,
sample=docs_parent.result_volume_samples,
- )
- ),
+ ),
+ },
)
linode_volume_valid_filters = ["id", "label"]
@@ -76,9 +75,9 @@ class LinodeVolumeInfo(LinodeModuleBase):
def __init__(self) -> None:
self.module_arg_spec = SPECDOC_META.ansible_spec
self.required_one_of: List[str] = []
- self.results = dict(
- volume=None,
- )
+ self.results = {
+ "volume": None,
+ }
self._volume = None
diff --git a/plugins/modules/volume_list.py b/plugins/modules/volume_list.py
index 5eeff566..ff0340d2 100644
--- a/plugins/modules/volume_list.py
+++ b/plugins/modules/volume_list.py
@@ -25,8 +25,8 @@
SpecReturnValue,
)
-spec_filter = dict(
- name=SpecField(
+spec_filter = {
+ "name": SpecField(
type=FieldType.string,
required=True,
description=[
@@ -36,7 +36,7 @@
"#volumes-list__responses",
],
),
- values=SpecField(
+ "values": SpecField(
type=FieldType.list,
element_type=FieldType.string,
required=True,
@@ -45,36 +45,36 @@
"Fields will pass this filter if at least one of these values matches.",
],
),
-)
+}
-spec = dict(
+spec = {
# Disable the default values
- state=SpecField(type=FieldType.string, required=False, doc_hide=True),
- label=SpecField(type=FieldType.string, required=False, doc_hide=True),
- order=SpecField(
+ "state": SpecField(type=FieldType.string, required=False, doc_hide=True),
+ "label": SpecField(type=FieldType.string, required=False, doc_hide=True),
+ "order": SpecField(
type=FieldType.string,
description=["The order to list volumes in."],
default="asc",
choices=["desc", "asc"],
),
- order_by=SpecField(
+ "order_by": SpecField(
type=FieldType.string,
description=["The attribute to order volumes by."],
),
- filters=SpecField(
+ "filters": SpecField(
type=FieldType.list,
element_type=FieldType.dict,
suboptions=spec_filter,
description=["A list of filters to apply to the resulting volumes."],
),
- count=SpecField(
+ "count": SpecField(
type=FieldType.integer,
description=[
"The number of results to return.",
"If undefined, all results will be returned.",
],
),
-)
+}
SPECDOC_META = SpecDocMeta(
description=["List and filter on Linode Volumes."],
@@ -82,8 +82,8 @@
author=global_authors,
options=spec,
examples=docs.specdoc_examples,
- return_values=dict(
- volumes=SpecReturnValue(
+ return_values={
+ "volumes": SpecReturnValue(
description="The returned volumes.",
docs_url="https://www.linode.com/docs/api/volumes/"
"#volumes-list__response-samples",
@@ -91,7 +91,7 @@
elements=FieldType.dict,
sample=docs.result_volumes_samples,
)
- ),
+ },
)
diff --git a/pyproject.toml b/pyproject.toml
index 132a869f..3b583334 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -4,7 +4,13 @@ line_length = 80
[tool.black]
line-length = 80
-target-version = ["py37", "py38", "py39", "py310", "py311"]
+target-version = [
+ "py37",
+ "py38",
+ "py39",
+ "py310",
+ "py311",
+]
exclude = "plugins/module_utils/doc_fragments"
[tool.autoflake]
@@ -15,3 +21,38 @@ ignore-pass-after-docstring = true
in-place = true
recursive = true
remove-all-unused-imports = true
+
+[tool.pylint.main]
+disable = [
+ "raw-checker-failed",
+ "bad-inline-option",
+ "locally-disabled",
+ "file-ignored",
+ "suppressed-message",
+ "useless-suppression",
+ "deprecated-pragma",
+ "use-symbolic-message-instead",
+ "protected-access",
+ "broad-exception-caught",
+ "unused-argument",
+ "no-name-in-module",
+ "import-error",
+ "inconsistent-return-statements",
+ "assignment-from-no-return",
+ "too-many-arguments",
+ "too-few-public-methods",
+ "duplicate-code",
+ "too-many-lines",
+ "too-many-branches",
+ "anomalous-backslash-in-string",
+ "too-many-locals",
+ "consider-using-f-string",
+ "consider-using-dict-items",
+ "used-before-assignment",
+ "unused-variable",
+ "missing-timeout",
+ "use-sequence-for-iteration",
+ "broad-exception-raised",
+]
+py-version = "3.8"
+extension-pkg-whitelist = "math"
diff --git a/requirements-dev.txt b/requirements-dev.txt
index 0bf18691..7d3648ba 100644
--- a/requirements-dev.txt
+++ b/requirements-dev.txt
@@ -1,10 +1,10 @@
-boto3==1.17.23
-botocore==1.20.23
-pylint==2.15.5
+boto3>=1.26.0
+botocore>=1.29.0
+pylint>=2.15.5
ansible-doc-extractor==0.1.9
-mypy==1.3.0
-ansible==7.5.0
-Jinja2==3.0.1
+mypy>=1.3.0
+ansible>=7.5.0
+Jinja2>=3.0.1
black>=23.1.0
isort>=5.12.0
autoflake>=2.0.1
diff --git a/requirements.txt b/requirements.txt
index f72202e5..d9206e90 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,4 +1,4 @@
-linode-api4==5.3.0
-polling==0.3.2
-types-requests==2.30.0.0
-ansible-specdoc==0.0.13
\ No newline at end of file
+linode-api4>=5.5.1
+polling>=0.3.2
+types-requests==2.31.0.1
+ansible-specdoc>=0.0.13
diff --git a/tests/integration/targets/firewall_basic/tasks/main.yaml b/tests/integration/targets/firewall_basic/tasks/main.yaml
index fdb433eb..89e0c774 100644
--- a/tests/integration/targets/firewall_basic/tasks/main.yaml
+++ b/tests/integration/targets/firewall_basic/tasks/main.yaml
@@ -7,7 +7,7 @@
label: 'ansible-test-{{ r }}'
region: us-southeast
type: g6-standard-1
- image: linode/alpine3.13
+ image: linode/alpine3.17
state: present
register: create_instance
@@ -16,7 +16,7 @@
label: 'ansible-test-{{ r }}-2'
region: us-southeast
type: g6-standard-1
- image: linode/alpine3.13
+ image: linode/alpine3.17
state: present
register: create_instance_2
diff --git a/tests/integration/targets/firewall_device/tasks/main.yaml b/tests/integration/targets/firewall_device/tasks/main.yaml
index 77430384..da7445ec 100644
--- a/tests/integration/targets/firewall_device/tasks/main.yaml
+++ b/tests/integration/targets/firewall_device/tasks/main.yaml
@@ -8,7 +8,7 @@
label: 'ansible-test-{{ r }}'
region: us-southeast
type: g6-standard-1
- image: linode/alpine3.13
+ image: linode/alpine3.17
state: present
register: inst
diff --git a/tests/integration/targets/firewall_icmp/tasks/main.yaml b/tests/integration/targets/firewall_icmp/tasks/main.yaml
index fcdb09ed..214f8e28 100644
--- a/tests/integration/targets/firewall_icmp/tasks/main.yaml
+++ b/tests/integration/targets/firewall_icmp/tasks/main.yaml
@@ -7,7 +7,7 @@
label: 'ansible-test-{{ r }}'
region: us-southeast
type: g6-standard-1
- image: linode/alpine3.13
+ image: linode/alpine3.17
state: present
register: create_instance
diff --git a/tests/integration/targets/instance_config_disk/tasks/main.yaml b/tests/integration/targets/instance_config_disk/tasks/main.yaml
index 04d86452..bf46bb18 100644
--- a/tests/integration/targets/instance_config_disk/tasks/main.yaml
+++ b/tests/integration/targets/instance_config_disk/tasks/main.yaml
@@ -158,7 +158,7 @@
label: '{{ create.instance.label }}'
region: us-east
type: g6-standard-1
- image: linode/alpine3.13
+ image: linode/alpine3.17
booted: false
disks:
- label: test-disk
@@ -179,7 +179,7 @@
- label: boot-disk
size: 4096
- image: linode/alpine3.13
+ image: linode/alpine3.17
configs:
- label: boot-config
diff --git a/tests/integration/targets/instance_reboot/tasks/main.yaml b/tests/integration/targets/instance_reboot/tasks/main.yaml
new file mode 100644
index 00000000..81596c24
--- /dev/null
+++ b/tests/integration/targets/instance_reboot/tasks/main.yaml
@@ -0,0 +1,55 @@
+- name: instance_reboot
+ block:
+ - set_fact:
+ r: "{{ 1000000000 | random }}"
+
+ - name: Create a booted Linode instance
+ linode.cloud.instance:
+ label: 'ansible-test-{{ r }}'
+ region: us-southeast
+ type: g6-standard-1
+ image: linode/ubuntu20.04
+ root_pass: Fn$$oobar123
+ private_ip: true
+ rebooted: true
+ booted: true
+ state: present
+ register: create
+
+ - name: Assert instance created
+ assert:
+ that:
+ - create.changed
+ - create.instance.status == 'running'
+ - create.instance.ipv4|length > 1
+
+ - name: Reboot the instance
+ linode.cloud.instance:
+ label: '{{ create.instance.label }}'
+ rebooted: true
+ state: present
+ register: reboot
+
+ - name: Assert instance online
+ assert:
+ that:
+ - reboot.changed
+ - reboot.instance.status == 'running'
+ always:
+ - ignore_errors: yes
+ block:
+ - name: Delete a Linode instance
+ linode.cloud.instance:
+ label: '{{ create.instance.label }}'
+ state: absent
+ register: delete
+
+ - name: Assert instance delete succeeded
+ assert:
+ that:
+ - delete.changed
+ - delete.instance.id == create.instance.id
+
+ environment:
+ LINODE_UA_PREFIX: '{{ ua_prefix }}'
+ LINODE_API_TOKEN: '{{ api_token }}'
\ No newline at end of file