@@ -17,7 +17,7 @@ def generate_keypair():
17
17
filename = f"{ os .sep } tmp{ os .sep } { DEFAULT_KEY_NAME } "
18
18
19
19
os .system (f'ssh-keygen -b 2048 -t rsa -f { filename } -q -N ""' )
20
- print (f" \n \n \033 [92mSSH key pair been generated\n " )
20
+ print (color_msg ( "SSH key pair been generated" , Color . LIGHTGREEN ) )
21
21
print (f"private key intermediate location: { os .path .abspath (filename )} " )
22
22
print (f"public key intermediate location: { os .path .abspath (filename )} .pub\033 [0m" )
23
23
with open (f"{ filename } .pub" , 'r' ) as file :
@@ -93,7 +93,7 @@ def register_ssh_key(ibm_vpc_client, config, auto=False):
93
93
print (color_msg ("Can't register an SSH key with the same fingerprint" ,Color .RED ))
94
94
exit (1 ) # can't continue the configuration process without a valid ssh key
95
95
96
- print (f" \033 [92mnew SSH key: '{ keyname } ' been registered in vpc\033 [0m" )
96
+ print (color_msg ( f"new SSH key '{ keyname } ' been registered in vpc\n " , Color . LIGHTGREEN ) )
97
97
98
98
result = response .get_result ()
99
99
return result ['name' ], result ['id' ], private_ssh_key_path
@@ -197,7 +197,7 @@ def is_pair(id, ssh_key_filename):
197
197
ssh_key_data = subprocess .getoutput ([f"ssh-keygen -y -f { self .defaults ['ssh_key_filename' ]} | cut -d' ' -f 2" ])
198
198
response = self .ibm_vpc_client .create_key (public_key = ssh_key_data , name = default_keyname , resource_group = {
199
199
"id" : resource_group_id }, type = 'rsa' )
200
- print (f" \033 [92mnew SSH key { default_keyname } been registered in vpc\033 [0m" )
200
+ print (color_msg ( f"new SSH key { default_keyname } been registered in vpc\n " , Color . LIGHTGREEN ) )
201
201
result = response .get_result ()
202
202
return result ['id' ], self .defaults ['ssh_key_filename' ], 'root'
203
203
else :
0 commit comments