Skip to content

Commit bdd628d

Browse files
authored
Spell check
Minor spelling errors fixed
1 parent 513e8cc commit bdd628d

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

security/security-design/shared-assets/bastion-py-script/files/bastionsession.py

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
1414
Minimum python version 3.7, asyncio.run
1515
16-
Script to create a session for a named bastion services, and
16+
Script to create a session for a named bastion service, and
1717
generates the ssh command for connection to the session
1818
1919
The Session have two formats:
@@ -33,7 +33,7 @@
3333
3434
3535
If File location is missing, the default config will be used.
36-
If profile_name is missing DEFAULt fill be used
36+
If profile_name is missing DEFAULT fill be used
3737
If the OCIconfigname parameter is missing in the session section,
3838
DEFAULT from DEFAULT location will be used.
3939
@@ -76,7 +76,7 @@
7676
# GenericError
7777
#
7878
# Extension of Exception class, thrown when any Exception is raised
79-
# and caught or any API error/Exception occurs
79+
# and caught, or any API error/Exception occurs
8080
#
8181
class GenericError(Exception):
8282
"""
@@ -116,14 +116,14 @@ def __init__(self, message="Value missing in configuration"):
116116
# get_validated_config_entry
117117
#
118118
# Iterate over JSON array (list) and return first JSON object (dict)
119-
# where JSON element with name search_key_name matches search_key_value
119+
# where JSON element with name search_key_name match search_key_value
120120
#
121121
# If a matching dict is found, iterate over it and verify existence of
122122
# all mandator values
123-
# Finally iterate over it and add any missing non mandatory values
123+
# Finally iterate over it and add any missing non-mandatory values
124124
#
125125
# Returns a complete dict with valid entry with all default values for
126-
# non mandatory values
126+
# non-mandatory values
127127
#
128128
# Raises MissingConfigError if no entry with search_key_value is found,
129129
# or mandatory field is missing
@@ -197,7 +197,7 @@ def get_validated_config_entry(
197197
+ " confguration"
198198
)
199199
#
200-
# Iterate and populate all non mandatory values with defaults
200+
# Iterate and populate all non-mandatory values with defaults
201201
if non_manadatory_key_values is not None:
202202
for key in non_manadatory_key_values:
203203
if key not in config_entry:
@@ -226,7 +226,7 @@ def get_validated_config_entry(
226226
# False if an error occurs
227227
# Exception:
228228
# GenericError, if sessionType is not legal or if bastion
229-
# public key can't be retreived
229+
# public key can't be retrieved
230230
#
231231
def valdate_config(config, config_type, int_list):
232232
"""Function sanity checks and validates some key config entries, converts
@@ -302,7 +302,7 @@ def valdate_config(config, config_type, int_list):
302302
#
303303
# creates a bastion session with the SDK (API)
304304
# Bastion session will normally take some time. If initial call is
305-
# successful the bastion state is "CREATING"
305+
# successful, the bastion state is "CREATING"
306306
# and when the creation is complete and successful,
307307
# it changes state to "ACTIVE"
308308
# The code loops and sleeps until max iterations is reached or
@@ -361,7 +361,7 @@ def create_single_session(session_config, bastion_client):
361361
#
362362
# Loop until max time and wait for session to be migrated
363363
# from CREATING to ACTIVE
364-
# The loops iterates maxWaitCount times and sleep waitRefresh
364+
# The loops iterate maxWaitCount times and sleep waitRefresh
365365
# seconds between each iteration
366366
#
367367
active_session = False
@@ -436,7 +436,7 @@ def get_command(bastion_session, session_config):
436436
print("Port managed start cmd")
437437
#
438438
# The bastion service might add a note to the end of the command.
439-
# Supress the note
439+
# Suppress the note
440440
#
441441
if session_cmd.find(" # ") > -1:
442442
session_cmd = session_cmd.split(" # ")[0]
@@ -453,7 +453,7 @@ def get_command(bastion_session, session_config):
453453
tunnel_cmd = tunnel_cmd.replace("<localPort>",
454454
str(session_config[const.LOCALPORT]))
455455
#
456-
# Setup the correct client comamnd for ssh or putty
456+
# Setup the correct client command for ssh or putty
457457
if session_config[const.SSHCOMMAND] == const.SSH:
458458
client_cmd = (
459459
"ssh -i "
@@ -482,7 +482,7 @@ def get_command(bastion_session, session_config):
482482
)
483483
cmd[const.CLIENTSIDE] = client_cmd
484484
#
485-
# Build serverside command
485+
# Build server-side command
486486
#
487487
if session_config[const.SSHCOMMAND] == const.SSH:
488488
cmd[const.SERVERSIDE] = tunnel_cmd
@@ -492,7 +492,7 @@ def get_command(bastion_session, session_config):
492492
return cmd
493493
else:
494494
#
495-
# Adjust serverside cmd for putty.exe
495+
# Adjust server-side command for putty.exe
496496
#
497497
cmd[const.SERVERSIDE] = (
498498
(tunnel_cmd.replace("ssh", "putty", 1))
@@ -657,7 +657,7 @@ def process_bastion_config(config, session_name):
657657
const.OCIREGION,
658658
]
659659

660-
# dict of non mandatory keys,in the sessions object from JSON,
660+
# dict of non-mandatory keys, in the sessions object from JSON,
661661
# with default values
662662
non_mandatory_session_keys = {
663663
const.BASTIONPRIVATEKEYFILE: "<bastion private key file>",
@@ -709,7 +709,7 @@ def process_bastion_config(config, session_name):
709709
raise MissingConfigError("Ociconfigurations key is missing in configuration")
710710
#
711711
# Verify configurations, verify all mandatory elements and add defaults
712-
# for non mandatory elements
712+
# for non-mandatory elements
713713
#
714714
# Verify Session
715715
#
@@ -883,9 +883,9 @@ def wait_for_session_deletion(session_id,
883883
#
884884
# create_sessions
885885
#
886-
# Creates one or more consecuive bastion sessions
886+
# Creates one or more consecutive bastion sessions
887887
# Create Bastion Session
888-
# if exec_ssh is true, A new session is created when the past expires
888+
# if exec_ssh is true, a new session is created when the past expires
889889
# Iterate until maxSessions is reached or session creation fail
890890
#
891891
# Input Parameters:
@@ -1010,7 +1010,7 @@ def create_sessions(config, exec_ssh):
10101010
# parse error. Underlying exceptions are passed on to caller
10111011
#
10121012
def main():
1013-
"""Main entry point, orkestrates all functions"""
1013+
"""Main entry point, orchestrates all functions"""
10141014
print("Bastion session manager " + __version__ + "\n")
10151015
#
10161016
# Get bastion config

0 commit comments

Comments
 (0)