Skip to content

Commit

Permalink
Merge branch 'master' into linode/fix-salt-cloud-get-config-value
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Phipps authored Jan 9, 2024
2 parents eb0fe9b + 2e3b133 commit eb4e9bb
Show file tree
Hide file tree
Showing 68 changed files with 1,206 additions and 878 deletions.
78 changes: 38 additions & 40 deletions salt/modules/boto3_elasticache.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@
except ImportError:
HAS_BOTO3 = False

__deprecated__ = (
3009,
"boto",
"https://github.com/salt-extensions/saltext-boto",
)


def __virtual__():
"""
Expand Down Expand Up @@ -107,17 +113,15 @@ def _describe_resource(
key=None,
keyid=None,
profile=None,
**args
**args,
):
if conn is None:
conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
try:
func = "describe_" + res_type + "s"
f = getattr(conn, func)
except (AttributeError, KeyError) as e:
raise SaltInvocationError(
"No function '{}()' found: {}".format(func, e.message)
)
raise SaltInvocationError(f"No function '{func}()' found: {e.message}")
# Undocumented, but you can't pass 'Marker' if searching for a specific resource...
args.update({name_param: name} if name else {"Marker": ""})
args = {k: v for k, v in args.items() if not k.startswith("_")}
Expand All @@ -140,7 +144,7 @@ def _delete_resource(
key=None,
keyid=None,
profile=None,
**args
**args,
):
"""
Delete a generic Elasticache resource.
Expand Down Expand Up @@ -171,9 +175,7 @@ def _delete_resource(
func = "describe_" + res_type + "s"
s = globals()[func]
except (AttributeError, KeyError) as e:
raise SaltInvocationError(
"No function '{}()' found: {}".format(func, e.message)
)
raise SaltInvocationError(f"No function '{func}()' found: {e.message}")
try:

f(**args)
Expand Down Expand Up @@ -211,7 +213,7 @@ def _create_resource(
key=None,
keyid=None,
profile=None,
**args
**args,
):
try:
wait = int(wait)
Expand Down Expand Up @@ -239,9 +241,7 @@ def _create_resource(
func = "describe_" + res_type + "s"
s = globals()[func]
except (AttributeError, KeyError) as e:
raise SaltInvocationError(
"No function '{}()' found: {}".format(func, e.message)
)
raise SaltInvocationError(f"No function '{func}()' found: {e.message}")
try:
f(**args)
if not wait:
Expand Down Expand Up @@ -270,7 +270,7 @@ def _create_resource(
)
return False
except botocore.exceptions.ClientError as e:
msg = "Failed to create {} {}: {}".format(desc, name, e)
msg = f"Failed to create {desc} {name}: {e}"
log.error(msg)
return False

Expand All @@ -287,7 +287,7 @@ def _modify_resource(
key=None,
keyid=None,
profile=None,
**args
**args,
):
try:
wait = int(wait)
Expand Down Expand Up @@ -315,9 +315,7 @@ def _modify_resource(
func = "describe_" + res_type + "s"
s = globals()[func]
except (AttributeError, KeyError) as e:
raise SaltInvocationError(
"No function '{}()' found: {}".format(func, e.message)
)
raise SaltInvocationError(f"No function '{func}()' found: {e.message}")
try:
f(**args)
if not wait:
Expand Down Expand Up @@ -346,7 +344,7 @@ def _modify_resource(
)
return False
except botocore.exceptions.ClientError as e:
msg = "Failed to modify {} {}: {}".format(desc, name, e)
msg = f"Failed to modify {desc} {name}: {e}"
log.error(msg)
return False

Expand Down Expand Up @@ -374,7 +372,7 @@ def describe_cache_clusters(
key=key,
keyid=keyid,
profile=profile,
**args
**args,
)


Expand Down Expand Up @@ -405,7 +403,7 @@ def create_cache_cluster(
key=None,
keyid=None,
profile=None,
**args
**args,
):
"""
Create a cache cluster.
Expand Down Expand Up @@ -442,7 +440,7 @@ def create_cache_cluster(
key=key,
keyid=keyid,
profile=profile,
**args
**args,
)


Expand All @@ -454,7 +452,7 @@ def modify_cache_cluster(
key=None,
keyid=None,
profile=None,
**args
**args,
):
"""
Update a cache cluster in place.
Expand Down Expand Up @@ -496,7 +494,7 @@ def modify_cache_cluster(
key=key,
keyid=keyid,
profile=profile,
**args
**args,
)


Expand All @@ -523,7 +521,7 @@ def delete_cache_cluster(
key=key,
keyid=keyid,
profile=profile,
**args
**args,
)


Expand Down Expand Up @@ -578,7 +576,7 @@ def create_replication_group(
key=None,
keyid=None,
profile=None,
**args
**args,
):
"""
Create a replication group.
Expand Down Expand Up @@ -615,7 +613,7 @@ def create_replication_group(
key=key,
keyid=keyid,
profile=profile,
**args
**args,
)


Expand All @@ -627,7 +625,7 @@ def modify_replication_group(
key=None,
keyid=None,
profile=None,
**args
**args,
):
"""
Modify a replication group.
Expand Down Expand Up @@ -661,7 +659,7 @@ def modify_replication_group(
key=key,
keyid=keyid,
profile=profile,
**args
**args,
)


Expand All @@ -688,7 +686,7 @@ def delete_replication_group(
key=key,
keyid=keyid,
profile=profile,
**args
**args,
)


Expand Down Expand Up @@ -783,13 +781,13 @@ def create_cache_subnet_group(
).get("subnets")
if not sn:
raise SaltInvocationError(
"Could not resolve Subnet Name {} to an ID.".format(subnet)
f"Could not resolve Subnet Name {subnet} to an ID."
)
if len(sn) == 1:
args["SubnetIds"] += [sn[0]["id"]]
elif len(sn) > 1:
raise CommandExecutionError(
"Subnet Name {} returned more than one ID.".format(subnet)
f"Subnet Name {subnet} returned more than one ID."
)
args = {k: v for k, v in args.items() if not k.startswith("_")}
return _create_resource(
Expand All @@ -801,7 +799,7 @@ def create_cache_subnet_group(
key=key,
keyid=keyid,
profile=profile,
**args
**args,
)


Expand Down Expand Up @@ -836,14 +834,14 @@ def modify_cache_subnet_group(
args["SubnetIds"] += [sn[0]["id"]]
elif len(sn) > 1:
raise CommandExecutionError(
"Subnet Name {} returned more than one ID.".format(subnet)
f"Subnet Name {subnet} returned more than one ID."
)
elif subnet.startswith("subnet-"):
# Moderately safe assumption... :) Will be caught later if incorrect.
args["SubnetIds"] += [subnet]
else:
raise SaltInvocationError(
"Could not resolve Subnet Name {} to an ID.".format(subnet)
f"Could not resolve Subnet Name {subnet} to an ID."
)
args = {k: v for k, v in args.items() if not k.startswith("_")}
return _modify_resource(
Expand All @@ -855,7 +853,7 @@ def modify_cache_subnet_group(
key=key,
keyid=keyid,
profile=profile,
**args
**args,
)


Expand All @@ -880,7 +878,7 @@ def delete_cache_subnet_group(
key=key,
keyid=keyid,
profile=profile,
**args
**args,
)


Expand Down Expand Up @@ -948,7 +946,7 @@ def create_cache_security_group(
key=key,
keyid=keyid,
profile=profile,
**args
**args,
)


Expand All @@ -973,7 +971,7 @@ def delete_cache_security_group(
key=key,
keyid=keyid,
profile=profile,
**args
**args,
)


Expand Down Expand Up @@ -1264,7 +1262,7 @@ def create_cache_parameter_group(
key=key,
keyid=keyid,
profile=profile,
**args
**args,
)


Expand All @@ -1289,5 +1287,5 @@ def delete_cache_parameter_group(
key=key,
keyid=keyid,
profile=profile,
**args
**args,
)
6 changes: 6 additions & 0 deletions salt/modules/boto3_elasticsearch.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,12 @@

log = logging.getLogger(__name__)

__deprecated__ = (
3009,
"boto",
"https://github.com/salt-extensions/saltext-boto",
)


def __virtual__():
"""
Expand Down
6 changes: 6 additions & 0 deletions salt/modules/boto3_route53.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@
except ImportError:
HAS_BOTO3 = False

__deprecated__ = (
3009,
"boto",
"https://github.com/salt-extensions/saltext-boto",
)


def __virtual__():
"""
Expand Down
6 changes: 6 additions & 0 deletions salt/modules/boto3_sns.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@
HAS_BOTO = False
# pylint: enable=unused-import

__deprecated__ = (
3009,
"boto",
"https://github.com/salt-extensions/saltext-boto",
)


def __virtual__():
"""
Expand Down
Loading

0 comments on commit eb4e9bb

Please sign in to comment.