Skip to content
This repository has been archived by the owner on Jan 26, 2024. It is now read-only.

Commit

Permalink
Merge pull request #16 from awslabs/fix-type-compare
Browse files Browse the repository at this point in the history
Bump v0.1.10
  • Loading branch information
farhanangullia authored Oct 21, 2023
2 parents ef35af4 + ba618a1 commit bf6bde4
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 12 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@

## [Unreleased]

## [0.1.10][] - 2023-10-21
[0.1.10]: https://github.com/awslabs/aws-az-failure-chaostoolkit/tree/v0.1.10

### Changed
- Added support for AWS Profile
- Minor type compare changes

## [0.1.9][] - 2023-04-03
[0.1.9]: https://github.com/awslabs/aws-az-failure-chaostoolkit/tree/v0.1.9
Expand Down
6 changes: 2 additions & 4 deletions azchaosaws/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from logzero import logger

__all__ = ["discover", "__version__", "client"]
__version__ = "0.1.9"
__version__ = "0.1.10"


def discover(discover_system: bool = True) -> Discovery:
Expand Down Expand Up @@ -50,9 +50,7 @@ def client(resource_name: str, configuration: Configuration = None):
if boto3.DEFAULT_SESSION is None:
boto3.setup_default_session(profile_name=aws_profile_name, **params)
logger.debug(
"Client will be using profile '{}'".format(
aws_profile_name or "default"
)
"Client will be using profile '{}'".format(aws_profile_name or "default")
)
return boto3.client(resource_name, **params)

Expand Down
6 changes: 2 additions & 4 deletions azchaosaws/ec2/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,6 @@ def get_instance_lifecycle_by_ids(
def stop_instances_any_lifecycle(
client: boto3.client, instance_lifecycles: dict = None, force: bool = False
) -> List[Dict[str, Any]]:

results = []
if "normal" in instance_lifecycles:
logger.warning(
Expand Down Expand Up @@ -841,7 +840,6 @@ def network_failure(


def instance_state(client: boto3.client, state: str, instance_ids: List[str]) -> bool:

instances = client.describe_instances(InstanceIds=instance_ids)
logger.debug("[EC2] instances ({})".format(str(instances)))

Expand Down Expand Up @@ -888,7 +886,7 @@ def instance_failure(

for instance_response in stop_instances_response:
instance_state = {}
if type(instance_response) == str:
if isinstance(instance_response, str):
if instance_response in dry_run_keys:
for id in stop_instances_response[instance_response]:
instance_state = {
Expand All @@ -897,7 +895,7 @@ def instance_failure(
"After": {"State": str()},
}
results.append(instance_state)
elif type(instance_response) == dict:
elif isinstance(instance_response, dict):
for k in instance_response.keys():
if k in non_dry_run_keys:
for instance in instance_response[k]:
Expand Down
1 change: 0 additions & 1 deletion azchaosaws/elbv2/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,6 @@ def set_subnets(
subnet_ids: List[str],
dry_run: bool = False,
) -> None:

load_balancers = get_load_balancer_arns(elbv2_client, load_balancer_names)

if load_balancers.get("network", []):
Expand Down
1 change: 0 additions & 1 deletion azchaosaws/mq/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,6 @@ def get_brokers_by_tags_and_az(
if all(
response["Tags"].get(k, None) == v for t in tags for k, v in t.items()
):

broker_subnet_ids = mq_client.describe_broker(BrokerId=b["BrokerId"])[
"SubnetIds"
]
Expand Down
2 changes: 1 addition & 1 deletion azchaosaws/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
def args_fmt(fn):
@functools.wraps(fn)
def wrapper(**kwargs):
if type(kwargs["dry_run"]) == str:
if isinstance(kwargs["dry_run"], str):
kwargs["dry_run"] = (
kwargs["dry_run"].lower() == "true"
if (
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@

setup_params = dict(
name=name,
version="0.1.9",
version="0.1.10",
description=desc,
long_description=long_desc,
long_description_content_type="text/markdown",
Expand Down

0 comments on commit bf6bde4

Please sign in to comment.