Skip to content

Commit 6ff3676

Browse files
committed
Appeased supperLinter.
1 parent 13d408a commit 6ff3676

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

Management-Utilities/auto_create_sm_relationships/auto_create_sm_relationships.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ def protectFlexGroup(fsxId, svmName, volumeName):
216216

217217
global logger, http, numSnapMirrorRelationships
218218

219-
logger.warning(f'Unfortunately, creating snapmirror relationships for FlexGroups is currently not supported.')
219+
logger.warning('Unfortunately, creating snapmirror relationships for FlexGroups is currently not supported.')
220220
return
221221

222222
################################################################################
@@ -265,9 +265,7 @@ def protectVolume(fsxId, svmName, volumeName):
265265
#
266266
# To be safe, check that the variable exist, since it might have been
267267
# commented out above.
268-
try:
269-
nop = scheduleName
270-
except NameError:
268+
if not 'scheduleName' in globals():
271269
scheduleName = ""
272270

273271
if scheduleName != "":
@@ -282,7 +280,7 @@ def protectVolume(fsxId, svmName, volumeName):
282280
logger.info(f'Path {fsxId}::{svmName}:{volumeName} is being SnapMirrored to {partnerIp}::{partnerSvmName}:{volumeName}{destinationVolumeSuffix}.')
283281
else:
284282
logger.info(f'Path {fsxId}::{svmName}:{volumeName} would have been SnapMirrored to {partnerIp}::{partnerSvmName}:{volumeName}{destinationVolumeSuffix}.')
285-
numSnapMirrorRelationships += 1
283+
numSnapMirrorRelationships += 1 # pylint: disable=E0602
286284
except Exception as err:
287285
logger.critical(f'API against {partnerIp} failed. Volume not protected. The error returned: "{err}".')
288286
return
@@ -352,23 +350,25 @@ def lambda_handler(event, context):
352350
session = boto3.session.Session()
353351
secretsManagerClient = session.client(service_name='secretsmanager', region_name=secretsManagerRegion)
354352
#
355-
# Read in the secretTable
356-
dynamodbClient = boto3.resource("dynamodb", region_name=dynamodbRegion)
353+
# Read in the secretTable if it is not already defined.
354+
if 'dynamodbRegion' in globals():
355+
dynamodbClient = boto3.resource("dynamodb", region_name=dynamodbRegion) # pylint: disable=E0602
356+
357357
if 'secretsTable' not in globals():
358358
if 'dynamodbRegion' not in globals() or 'dynamodbSecretsTableName' not in globals():
359359
raise Exception('Error, you must either define the secretsTable array at the top of this script, or define dynamodbRegion and dynamodbSecretsTableName')
360360

361-
table = dynamodbClient.Table(dynamodbSecretsTableName)
361+
table = dynamodbClient.Table(dynamodbSecretsTableName) # pylint: disable=E0602
362362

363363
response = table.scan()
364364
secretsTable = response["Items"]
365365
#
366-
# Read in the partnersTable
366+
# Read in the partnersTable if it is not already defined.
367367
if 'partnersTable' not in globals():
368368
if 'dynamodbRegion' not in globals() or 'dynamodbPartnersTableName' not in globals():
369369
raise Exception('Error, you must either define the partnersTable array at the top of this script, or define dynamodbRegion and dynamodbPartnersTableName')
370370

371-
table = dynamodbClient.Table(dynamodbPartnersTableName)
371+
table = dynamodbClient.Table(dynamodbPartnersTableName) # pylint: disable=E0602
372372

373373
response = table.scan()
374374
items = response["Items"]

0 commit comments

Comments
 (0)