Skip to content

Commit 8288bca

Browse files
committed
fix set_tags so it doesn't return anything
Signed-off-by: Sylvain Hellegouarch <sh@defuze.org>
1 parent c3974b1 commit 8288bca

File tree

3 files changed

+16
-8
lines changed

3 files changed

+16
-8
lines changed

CHANGELOG.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,16 @@
22

33
## [Unreleased][]
44

5-
[Unreleased]: https://github.com/chaostoolkit-incubator/chaostoolkit-google-cloud-platform/compare/0.36.0...HEAD
5+
[Unreleased]: https://github.com/chaostoolkit-incubator/chaostoolkit-google-cloud-platform/compare/0.36.1...HEAD
6+
7+
## [0.36.1][] - 2024-07-02
8+
9+
[0.36.0]: https://github.com/chaostoolkit-incubator/chaostoolkit-google-cloud-platform/compare/0.36.0...0.36.1
10+
11+
### Fixed
12+
13+
- Remove the return statement from `set_tags` since the extended operation
14+
payload is set to nothing anyway
615

716
## [0.36.0][] - 2024-07-01
817

chaosgcp/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,8 @@ def wait_on_operation(
130130
def wait_on_extended_operation(
131131
operation: ExtendedOperation, frequency: int = 1, timeout: int = 60
132132
) -> None:
133+
# note that extended operations return nothing and set theyr result payload
134+
# to None
133135
start = time.time()
134136

135137
while True:

chaosgcp/compute/actions.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
from google.cloud import compute_v1
2020
from google.cloud.compute_v1.types import Tags
2121

22-
from chaosgcp import load_credentials, wait_on_extended_operation, to_dict
22+
from chaosgcp import load_credentials, wait_on_extended_operation
2323

2424
__all__ = ["set_instance_tags"]
2525
logger = logging.getLogger("chaostoolkit")
@@ -32,14 +32,14 @@ def set_instance_tags(
3232
tags_list: list,
3333
configuration: Configuration = None,
3434
secrets: Secrets = None,
35-
) -> Dict[str, Any]:
35+
) -> None:
3636
"""Set a Network Tags to a GCE VM instance
3737
3838
:param project_id : the project ID in which the DNS record is present
3939
:param ip_address: the IP address for the A record that needs to be changed
4040
:param zone: the name of the zone where the GCE VM is provisioned
4141
:param tags_list : list of network tags to be set to the GCE VM instance
42-
:return JSON Response which is in form of dictionary
42+
:return nothing
4343
"""
4444
credentials = load_credentials(secrets)
4545

@@ -69,12 +69,9 @@ def set_instance_tags(
6969
operation = client.set_tags(request=request)
7070

7171
# Handle the response
72+
# do not return anything as extended operations do not carry a payload
7273
wait_on_extended_operation(operation)
7374

74-
response = operation.result()
75-
76-
return to_dict(response)
77-
7875

7976
def suspend_vm_instance(
8077
project_id: str, zone: str, instance_name: str, secrets: Secrets = None

0 commit comments

Comments
 (0)