Hello,
I created a simple python script that will just Stop a service, as in the future I want to build upon this script.
This python script works when I run it from an IDE, it works in ArcPro as a direct python script, and it works as a Toolbox's Script tool.
It will even print out all my print statements as it goes through the process.
However, when I publish the tool to our Enterprise, it will run successfully, but do nothing. It won't print anything, it won't do anything. Any help? Here is the script below.
import arcpy
from arcgis.gis import GIS
import arcgis.gis.admin
gis = GIS("https://gis.domain.com/portal", "admin", "password", verify_cert=False)
gis_servers = gis.admin.servers.get(role="HOSTING_SERVER")
target_folder = "Tyler"
target_service = "TylerDataMap_WM_TRAIN"
for server in gis_servers:
for service in server.services.list(folder=target_folder):
arcpy.AddMessage(service.properties.serviceName)
if service.properties.serviceName == target_service:
arcpy.AddMessage(f"Stopping {target_service}...")
service.stop()
arcpy.AddMessage(f"{target_service} has been stopped.")
breakAny idea why it 'runs successfully' but actually does nothing?