99
1010@click .command (cls = SoftLayer .CLI .command .SLCommand , )
1111@click .argument ('identifier' )
12- @click .option ('--hardware' , '-h' ,
13- help = "Display hardware this user has access to." )
14- @click .option ('--virtual' , '-v' ,
15- help = "Display virtual guests this user has access to." )
16- @click .option ('--dedicated' , '-l' ,
17- help = "dedicated host ID " )
12+ @click .option ('--hardware' , help = "Hardware ID" )
13+ @click .option ('--virtual' , help = "Virtual Guest ID" )
14+ @click .option ('--dedicated' , help = "Dedicated host ID " )
1815@environment .pass_env
1916def cli (env , identifier , hardware , virtual , dedicated ):
2017 """Remove access from a user to an specific device.
@@ -23,24 +20,24 @@ def cli(env, identifier, hardware, virtual, dedicated):
2320 """
2421
2522 mgr = SoftLayer .UserManager (env .client )
26- device = ''
2723 result = False
2824 if hardware :
29- device = hardware
3025 result = mgr .remove_hardware_access (identifier , hardware )
26+ if result :
27+ click .secho ("Remove to access to hardware: %s" % hardware , fg = 'green' )
3128
3229 if virtual :
33- device = virtual
3430 result = mgr .remove_virtual_access (identifier , virtual )
31+ if result :
32+ click .secho ("Remove to access to virtual guest: %s" % virtual , fg = 'green' )
3533
3634 if dedicated :
37- device = dedicated
3835 result = mgr .remove_dedicated_access (identifier , dedicated )
36+ if result :
37+ click .secho ("Remove to access to dedicated host: %s" % dedicated , fg = 'green' )
3938
40- if result :
41- click .secho ("Remove to access to device: %s" % device , fg = 'green' )
42- else :
39+ if not result :
4340 raise SoftLayer .exceptions .SoftLayerError ('You need argument a hardware, virtual or dedicated identifier.\n '
44- 'E.g slcli user 123456 --hardware 91803794\n '
45- ' slcli user 123456 --dedicated 91803793\n '
46- ' slcli user 123456 --virtual 91803792' )
41+ 'E.g slcli user remove-access 123456 --hardware 91803794\n '
42+ ' slcli user remove-access 123456 --dedicated 91803793\n '
43+ ' slcli user remove-access 123456 --virtual 91803792' )
0 commit comments