Tuesday
There is a python task in Site Engine called "Restart Device". It works well and I have it schedules for 2am on Sundays when no one is here.
But it only reboots the x465 and none of the x400 slots (port extenders). The cli command to make all the devices reboot is "reboot all". How can I modify the Python script to do "reboot all"?
I have tried to create a CLI task, and that task works, but I cannot seem to schedule saved CLI tasks to run at a certain day and time.
yesterday
@Joshua_Beddingf wrote:There is a python task in Site Engine called "Restart Device". It works well and I have it schedules for 2am on Sundays when no one is here.
But it only reboots the x465 and none of the x400 slots (port extenders). The cli command to make all the devices reboot is "reboot all". How can I modify the Python script to do "reboot all"?
I have tried to create a CLI task, and that task works, but I cannot seem to schedule saved CLI tasks to run at a certain day and time.
The api.reboot() call itself is likely correct, but the script needs to specify which device to reboot. Consult the API documentation for device selection methods (e.g., api.select_device(), api.get_devices()). If rebooting multiple devices, iterate through the device list and call api.reboot() for each one after selecting it. The errors you're seeing are due to the lack of device selection, not the reboot() method itself.
8 hours ago
The device selection is done in Site Engine. It sends the api call to each device I select. The problem is the port extender topology of the x465 / v400 system needs a different command then "reboot". To reboot the system you have to send "reboot all". The v400 port extender switches are not indinivually addressable. They are controlled by the master switch - the x465.
yesterday
The problem is it seems to be doing an API call. This is the Python script in SIte Engine. It looks like it is using "cli_result = api.reboot()" Changing that to be api.reboot all() gets an error. Trying api.reboot(all) gets an error. So it seems the Python script is not running an embedded CLI command - it is calling an api.
# @METADATASTART
#@DetailDescriptionStart
################################################################
# System Script
#
# Script : Resets the target device
# Revision : 1.0
# Last updated : 4/24/2018
# Purpose : To reset the target device
#
################################################################
#@DetailDescriptionEnd
################################################################################
# Default Command Timeout
################################################################################
# @VariableFieldLabel (description = "Command Timeout in seconds",
# name = commandTimeout,
# type = String,
# scope = global,
# required = no
# )
# @SectionEnd
# @MetaDataEnd
from xmclib import emc_vars
from xmclib import logger
from xmclib import cli
from device import api
try:
cli_result = api.reboot()
cli.process_result(cli_result, emc_results)
except Exception as e:
cli.process_exception(e, emc_results)
Tuesday
Modify your Python task to send the "reboot all" command instead of just rebooting the x465. Locate the part of the script that executes the reboot command and replace it with or the equivalent function in your script. Ensure the script waits for confirmation if required. If scheduling CLI tasks isn't possible, embedding the command in Python is the best approach.