4
4
5
5
import click
6
6
7
- from SoftLayer .API import employee_client
8
7
from SoftLayer .CLI .command import SLCommand as SLCommand
9
8
from SoftLayer .CLI import environment
10
9
from SoftLayer import config
@@ -30,16 +29,15 @@ def cli(env):
30
29
username = settings .get ('username' ) or os .environ .get ('SLCLI_USER' , None )
31
30
password = os .environ .get ('SLCLI_PASSWORD' , '' )
32
31
yubi = None
33
- client = employee_client (config_file = env .config_file )
34
32
35
33
# Might already be logged in, try and refresh token
36
34
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' ))
38
36
try :
39
37
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 )
43
41
44
42
config_settings ['softlayer' ] = settings
45
43
config .write_config (config_settings , env .config_file )
@@ -52,13 +50,12 @@ def cli(env):
52
50
click .echo ("URL: {}" .format (url ))
53
51
if username is None :
54
52
username = input ("Username: " )
55
- click .echo ("Username: {}" .format (username ))
56
53
if not password :
57
- password = env .getpass ("Password: " )
58
- click .echo ("Password: {}" .format (censor_password (password )))
54
+ password = env .getpass ("Password: " , default = "" )
59
55
yubi = input ("Yubi: " )
56
+
60
57
try :
61
- result = client .authenticate_with_internal (username , password , str (yubi ))
58
+ result = env . client .authenticate_with_internal (username , password , str (yubi ))
62
59
print (result )
63
60
# pylint: disable=broad-exception-caught
64
61
except Exception as e :
0 commit comments