Skip to content

Commit 9075c49

Browse files
committed
Merge pull request saltstack#18698 from hulu/drac-list
drac runner: use list instead of dict for command sequence
2 parents 523c6ab + 36151b9 commit 9075c49

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

salt/runners/drac.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,19 +84,20 @@ def pxe(hostname, timeout=20):
8484
8585
salt-run drac.pxe example.com
8686
'''
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+
]
9192
_keywords = ['successful', 'successfully']
9293

9394
client = __connect(hostname, timeout)
9495

9596
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))
9899

99-
(stdin, stdout, stderr) = client.exec_command(_cmds[cmd])
100+
(stdin, stdout, stderr) = client.exec_command(cmd)
100101

101102
if bool([True for i in _keywords if i in stdout.readline().rstrip()]):
102103
log.info('Executing command: {0}'.format(cmd))

0 commit comments

Comments
 (0)