Skip to content

Commit cfbda2f

Browse files
committed
Made the comments more clears as to how to create the secretsTable.
1 parent d742404 commit cfbda2f

File tree

1 file changed

+14
-15
lines changed

1 file changed

+14
-15
lines changed

Management-Utilities/auto_create_sm_relationships/auto_create_sm_relationships.py

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -35,21 +35,21 @@
3535
# case an "alias" is has to be created when you peer the SVMs (a.k.a. vservers).
3636
partnerTable = [
3737
{
38-
'fsxId': 'fs-0e8d9172fa545ef3b',
38+
'fsxId': 'fs-0e8d9172XXXXXXXXX',
3939
'svmName': 'fsx',
4040
'partnerFsxnIp': '198.19.253.210',
4141
'partnerSvmName': 'fsx',
4242
'partnerSvmSourceName': 'fsx_source'
4343
},
4444
{
45-
'fsxId': 'fs-0e8d9172fa545ef3b',
45+
'fsxId': 'fs-0e8d9172XXXXXXXXX',
4646
'svmName': 'fsx_smb',
4747
'partnerFsxnIp': '198.19.253.210',
4848
'partnerSvmName': 'fsx',
4949
'partnerSvmSourceName': 'fsx_smb'
5050
},
5151
{
52-
'fsxId': 'fs-020de2687bd98ccf7',
52+
'fsxId': 'fs-020de268XXXXXXXXX',
5353
'svmName': 'fsx',
5454
'partnerFsxnIp': '198.19.255.162',
5555
'partnerSvmName': 'fsx',
@@ -67,15 +67,15 @@
6767
# passwordKey - The name of the key that holds the password to use.
6868
#
6969
#secretsTable = [
70-
# {"id": "fs-0e8d9172fa545ef3b", "secretName": "mon-fsxn-credentials", "usernameKey": "mon-fsxn-username", "passwordKey": "mon-fsxn-password"},
71-
# {"id": "fs-020de2687bd98ccf7", "secretName": "mon-fsxn-credentials", "usernameKey": "mon-fsxn-username", "passwordKey": "mon-fsxn-password"},
72-
# {"id": "fs-07bcb7ad84ac75e43", "secretName": "mon-fsxn-credentials", "usernameKey": "mon-fsxn-username", "passwordKey": "mon-fsxn-password"},
73-
# {"id": "fs-077b5ff41951c57b2", "secretName": "mon-fsxn-credentials", "usernameKey": "mon-fsxn-username", "passwordKey": "mon-fsxn-password"}
70+
# {"id": "fs-0e8d9172XXXXXXXXX", "secretName": "fsxn-credentials", "usernameKey": "fsxn-username", "passwordKey": "fsxn-password"},
71+
# {"id": "fs-020de268XXXXXXXXX", "secretName": "fsxn-credentials", "usernameKey": "fsxn-username", "passwordKey": "fsxn-password"},
72+
# {"id": "fs-07bcb7adXXXXXXXXX", "secretName": "fsxn-credentials", "usernameKey": "fsxn-username", "passwordKey": "fsxn-password"},
73+
# {"id": "fs-077b5ff4XXXXXXXXX", "secretName": "fsxn-credentials", "usernameKey": "fsxn-username", "passwordKey": "fsxn-password"}
7474
# ]
7575
#
7676
# NOTE: If both the secretsTable, and dynamodbTableName are defined, the secretsTable will be used.
7777
#
78-
dynamodbTableName="keith_secrets"
78+
dynamodbTableName="fsxn_secrets"
7979
dynamodbRegion="us-west-2"
8080
#
8181
# Provide the region the secrets manager resides in:
@@ -118,7 +118,6 @@
118118
import urllib3
119119
from urllib3.util import Retry
120120
import logging
121-
import botocore
122121
import boto3
123122
#
124123
# Define a custom exception so we can gracefully exit the program if too many
@@ -133,6 +132,7 @@ def __init__(self, value):
133132
def __str__(self):
134133
return(repr(self.value))
135134

135+
136136
################################################################################
137137
# This function returns the value assigned to the "protect_volume" tag
138138
# associated with the ARN passed in. If none is found, it returns an empty
@@ -282,7 +282,7 @@ def protectFlexGroup(fsxId, svmName, volumeName):
282282
data = json.loads(response.data)
283283
jobUUID = data['job']['uuid']
284284
if waitForJobToComplete(partnerIp, headers, jobUUID):
285-
logger.error(f'Failed to create destination flexgroup volume {partnerIp}::{partnerSvm}:{volumeName}{destinationVolumeSuffix}.')
285+
logger.error(f'Failed to create destination flexgroup volume {partnerIp}::{partnerSvmName}:{volumeName}{destinationVolumeSuffix}.')
286286
return
287287
else:
288288
logger.error(f'API call to {endpoint} failed. HTTP status code: {response.status}.')
@@ -333,7 +333,7 @@ def protectFlexGroup(fsxId, svmName, volumeName):
333333
logger.info(f'Path {fsxId}::{svmName}:{volumeName} is being SnapMirrored to {partnerIp}::{partnerSvmName}:{volumeName}{destinationVolumeSuffix}')
334334
else:
335335
logger.info(f'Path {fsxId}::{svmName}:{volumeName} would have been SnapMirrored to {partnerIp}::{partnerSvmName}:{volumeName}{destinationVolumeSuffix}')
336-
numSnapMirrorRelationships += 1
336+
numSnapMirrorRelationships += 1 # pylint: disable=E0602
337337
except Exception as err:
338338
logger.critical(f'Failed to issue API against {partnerIp}. Cluster could be down. The error messages received: "{err}".')
339339
return
@@ -457,12 +457,11 @@ def lambda_handler(event, context):
457457
# Set up "logging" to appropriately display messages. It can be set it up
458458
# to send messages to a syslog server.
459459
logging.basicConfig(datefmt='%Y-%m-%d_%H:%M:%S', format='%(asctime)s:%(name)s:%(levelname)s:%(message)s', encoding='utf-8')
460-
logger = logging.getLogger("scan_create_sm_relationships")
461-
logger.setLevel(logging.DEBUG)
462-
# logger.setLevel(logging.INFO)
460+
logger = logging.getLogger("auto_create_sm_relationships")
461+
# logger.setLevel(logging.DEBUG)
462+
logger.setLevel(logging.INFO)
463463
#
464464
# Ensure the logging level on higher for these noisy modules to mute thier messages.
465-
logging.getLogger("botocore").setLevel(logging.WARNING)
466465
logging.getLogger("boto3").setLevel(logging.WARNING)
467466
logging.getLogger("urllib3").setLevel(logging.WARNING)
468467
#

0 commit comments

Comments
 (0)