Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions library/juniper_junos_software.py
Original file line number Diff line number Diff line change
Expand Up @@ -680,7 +680,10 @@ def main():
"to 5 seconds.")
junos_module.dev.timeout = 5
junos_module.logger.debug('Initiating reboot.')
rpc = junos_module.etree.Element('request-reboot')
if junos_module.dev.facts['_is_linux']:
rpc = junos_module.etree.Element('request-shutdown-reboot')
else:
rpc = junos_module.etree.Element('request-reboot')
xpath_list = ['.//request-reboot-status']
if all_re is True:
if (junos_module.sw._multi_RE is True and
Expand All @@ -699,7 +702,10 @@ def main():
junos_module.logger.debug("Reboot RPC executed cleanly.")
if len(xpath_list) > 0:
for xpath in xpath_list:
got = resp.findtext(xpath)
if junos_module.dev.facts['_is_linux']:
got = resp.text
else:
got = resp.findtext(xpath)
if got is not None:
results['msg'] += ' Reboot successfully initiated.'
break
Expand Down
20 changes: 16 additions & 4 deletions library/juniper_junos_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,13 +343,22 @@ def main():
rpc = None
xpath_list = []
if action == 'reboot':
rpc = junos_module.etree.Element('request-reboot')
if junos_module.dev.facts['_is_linux']:
rpc = junos_module.etree.Element('request-shutdown-reboot')
else:
rpc = junos_module.etree.Element('request-reboot')
xpath_list.append('.//request-reboot-status')
elif action == 'shutdown':
rpc = junos_module.etree.Element('request-power-off')
if junos_module.dev.facts['_is_linux']:
rpc = junos_module.etree.Element('request-shutdown-power-off')
else:
rpc = junos_module.etree.Element('request-power-off')
xpath_list.append('.//request-reboot-status')
elif action == 'halt':
rpc = junos_module.etree.Element('request-halt')
if junos_module.dev.facts['_is_linux']:
rpc = junos_module.etree.Element('request-shutdown-halt')
else:
rpc = junos_module.etree.Element('request-halt')
xpath_list.append('.//request-reboot-status')
elif action == 'zeroize':
rpc = junos_module.etree.Element('request-system-zeroize')
Expand Down Expand Up @@ -420,7 +429,10 @@ def main():
junos_module.logger.debug("RPC executed cleanly.")
if len(xpath_list) > 0:
for xpath in xpath_list:
got = resp.findtext(xpath)
if junos_module.dev.facts['_is_linux']:
got = resp.text
else:
got = resp.findtext(xpath)
if got is not None:
results['msg'] = '%s successfully initiated.' % \
(action)
Expand Down