From 2ad5986e3f7117cdab4e3a3fb86f76f3930ad5a8 Mon Sep 17 00:00:00 2001 From: Ye Chen Date: Mon, 22 Jul 2024 14:55:38 -0400 Subject: [PATCH] rename --- docs/modules/image.md | 2 +- plugins/modules/image.py | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/docs/modules/image.md b/docs/modules/image.md index f4cc2e10..d32a8211 100644 --- a/docs/modules/image.md +++ b/docs/modules/image.md @@ -73,7 +73,7 @@ Manage a Linode Image. | `wait` |
`bool`
|
Optional
| Wait for the image to have status `available` before returning. **(Default: `True`)** | | `wait_timeout` |
`int`
|
Optional
| The amount of time, in seconds, to wait for an image to have status `available`. **(Default: `600`)** | | `tags` |
`list`
|
Optional
| A list of customized tags of this new Image. **(Updatable)** | -| `regions_to_replicate` |
`list`
|
Optional
| A list of regions that customer wants to replicate this image in. At least one valid region is required and only core regions allowed. Existing images in the regions not passed will be removed. NOTE: Image replication may not currently be available to all users. **(Updatable)** | +| `replica_regions` |
`list`
|
Optional
| A list of regions that customer wants to replicate this image in. At least one valid region is required and only core regions allowed. Existing images in the regions not passed will be removed. NOTE: Image replication may not currently be available to all users. **(Updatable)** | ## Return Values diff --git a/plugins/modules/image.py b/plugins/modules/image.py index cc8bf26f..22b698da 100644 --- a/plugins/modules/image.py +++ b/plugins/modules/image.py @@ -95,7 +95,8 @@ editable=True, description=["A list of customized tags of this new Image."], ), - "regions_to_replicate": SpecField( + # `regions` send to API for image replication + "replica_regions": SpecField( type=FieldType.list, element_type=FieldType.string, editable=True, @@ -285,17 +286,15 @@ def _handle_present(self) -> None: self._update_image(image) - regions_to_replicate = params.get("regions_to_replicate") - new_regions: list = ( - [] if regions_to_replicate is None else regions_to_replicate - ) + replica_regions = params.get("replica_regions") + new_regions: list = [] if replica_regions is None else replica_regions old_regions = [r.region for r in image.regions] # Replicate image in new regions if new_regions != old_regions: if new_regions is None or len(new_regions) == 0: return self.fail( - msg="failed to replicate image {0}: regions_to_replicate value {1} is invalid. " + msg="failed to replicate image {0}: replica_regions value {1} is invalid. " "At least one valid region is required.".format( label, new_regions )