File tree Expand file tree Collapse file tree 4 files changed +27
-28
lines changed Expand file tree Collapse file tree 4 files changed +27
-28
lines changed Original file line number Diff line number Diff line change @@ -77,3 +77,20 @@ def power_cycle(env, identifier):
7777 raise exceptions .CLIAbort ('Aborted.' )
7878
7979 env .client ['Hardware_Server' ].powerCycle (id = hw_id )
80+
81+
82+ @click .command ()
83+ @click .argument ('identifier' )
84+ @environment .pass_env
85+ def rescue (env , identifier ):
86+ """Reboot server into a rescue image."""
87+
88+ mgr = SoftLayer .HardwareManager (env .client )
89+ hw_id = helpers .resolve_id (mgr .resolve_ids , identifier , 'hardware' )
90+
91+ if not (env .skip_confirmations or
92+ formatting .confirm ("This action will reboot this server. Continue?" )):
93+
94+ raise exceptions .CLIAbort ('Aborted' )
95+
96+ env .client ['Hardware_Server' ].bootToRescueLayer (id = hw_id )
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 210210 ('hardware:reload' , 'SoftLayer.CLI.hardware.reload:cli' ),
211211 ('hardware:credentials' , 'SoftLayer.CLI.hardware.credentials:cli' ),
212212 ('hardware:update-firmware' , 'SoftLayer.CLI.hardware.update_firmware:cli' ),
213+ ('hardware:rescue' , 'SoftLayer.CLI.hardware.power:rescue' ),
213214
214215 ('securitygroup' , 'SoftLayer.CLI.securitygroup' ),
215216 ('securitygroup:list' , 'SoftLayer.CLI.securitygroup.list:cli' ),
Original file line number Diff line number Diff line change @@ -445,3 +445,12 @@ def test_edit(self):
445445 args = (100 ,),
446446 identifier = 100 ,
447447 )
448+
449+ @mock .patch ('SoftLayer.CLI.formatting.confirm' )
450+ def test_rescue (self , confirm_mock ):
451+ confirm_mock .return_value = True
452+ result = self .run_command (['server' , 'rescue' , '1000' ])
453+
454+ self .assert_no_fail (result )
455+ self .assertEqual (result .output , "" )
456+ self .assert_called_with ('SoftLayer_Hardware_Server' , 'bootToRescueLayer' , identifier = 1000 )
You can’t perform that action at this time.
0 commit comments