@@ -84,19 +84,20 @@ def pxe(hostname, timeout=20):
84
84
85
85
salt-run drac.pxe example.com
86
86
'''
87
- _cmds = {1 : 'racadm config -g cfgServerInfo -o cfgServerFirstBootDevice pxe' ,
88
- 2 : 'racadm config -g cfgServerInfo -o cfgServerBootOnce 1' ,
89
- 3 : 'racadm serveraction powercycle' }
90
-
87
+ _cmds = [
88
+ 'racadm config -g cfgServerInfo -o cfgServerFirstBootDevice pxe' ,
89
+ 'racadm config -g cfgServerInfo -o cfgServerBootOnce 1' ,
90
+ 'racadm serveraction powercycle' ,
91
+ ]
91
92
_keywords = ['successful' , 'successfully' ]
92
93
93
94
client = __connect (hostname , timeout )
94
95
95
96
if isinstance (client , paramiko .SSHClient ):
96
- for cmd in sorted (_cmds . keys () ):
97
- log .info ('Executing command {0}' .format (cmd ))
97
+ for i , cmd in enumerate (_cmds , 1 ):
98
+ log .info ('Executing command {0}' .format (i ))
98
99
99
- (stdin , stdout , stderr ) = client .exec_command (_cmds [ cmd ] )
100
+ (stdin , stdout , stderr ) = client .exec_command (cmd )
100
101
101
102
if bool ([True for i in _keywords if i in stdout .readline ().rstrip ()]):
102
103
log .info ('Executing command: {0}' .format (cmd ))
0 commit comments