44
55import click
66
7- from SoftLayer .API import employee_client
87from SoftLayer .CLI .command import SLCommand as SLCommand
98from SoftLayer .CLI import environment
109from SoftLayer import config
@@ -30,16 +29,15 @@ def cli(env):
3029 username = settings .get ('username' ) or os .environ .get ('SLCLI_USER' , None )
3130 password = os .environ .get ('SLCLI_PASSWORD' , '' )
3231 yubi = None
33- client = employee_client (config_file = env .config_file )
3432
3533 # Might already be logged in, try and refresh token
3634 if settings .get ('access_token' ) and settings .get ('userid' ):
37- client .authenticate_with_hash (settings .get ('userid' ), settings .get ('access_token' ))
35+ env . client .authenticate_with_hash (settings .get ('userid' ), settings .get ('access_token' ))
3836 try :
3937 emp_id = settings .get ('userid' )
40- client .call ('SoftLayer_User_Employee' , 'getObject' , id = emp_id , mask = "mask[id,username]" )
41- client .refresh_token (emp_id , settings .get ('access_token' ))
42- client .call ('SoftLayer_User_Employee' , 'refreshEncryptedToken' , settings .get ('access_token' ), id = emp_id )
38+ env . client .call ('SoftLayer_User_Employee' , 'getObject' , id = emp_id , mask = "mask[id,username]" )
39+ env . client .refresh_token (emp_id , settings .get ('access_token' ))
40+ env . client .call ('SoftLayer_User_Employee' , 'refreshEncryptedToken' , settings .get ('access_token' ), id = emp_id )
4341
4442 config_settings ['softlayer' ] = settings
4543 config .write_config (config_settings , env .config_file )
@@ -52,13 +50,12 @@ def cli(env):
5250 click .echo ("URL: {}" .format (url ))
5351 if username is None :
5452 username = input ("Username: " )
55- click .echo ("Username: {}" .format (username ))
5653 if not password :
57- password = env .getpass ("Password: " )
58- click .echo ("Password: {}" .format (censor_password (password )))
54+ password = env .getpass ("Password: " , default = "" )
5955 yubi = input ("Yubi: " )
56+
6057 try :
61- result = client .authenticate_with_internal (username , password , str (yubi ))
58+ result = env . client .authenticate_with_internal (username , password , str (yubi ))
6259 print (result )
6360 # pylint: disable=broad-exception-caught
6461 except Exception as e :
0 commit comments