suppress certificate warning

399
1
09-22-2018 12:00 PM
forestknutsen1
MVP Regular Contributor

I have a python scrip that uploads a service definition file to a server. When I run the code I get the below message. 

Is there a way to suppress this? I would like to run the python script as a batch job with task manager... it looks like when it hits this it just hangs. I have a sever connection file that uses http.

import arcpy
import os

loc_path = r"\\xxx\CW_Composite.loc"
out_sddraft = r"\\xxx\cw_xsys_geocoder.sddraft"
service_name = "CW_Composite_xsys_py"
server_type = "FROM_CONNECTION_FILE"
connection_file_path = r"\\xxx\ceav456_admin.ags"
copy_data_to_server = True
folder_name = "Locators"
supported_operations = ["GEOCODE", "REVERSE_GEOCODE"]

out_sd = r"\\xxx\cw_xsys_geocoder.sd"


def delete_file(sd_file):
    if os.path.isfile(sd_file):
        os.remove(sd_file)


delete_file(out_sddraft)
delete_file(out_sd)

print "Create sddraft"
analyze_message = arcpy.CreateGeocodeSDDraft(loc_path=loc_path,
                                             out_sddraft=out_sddraft,
                                             service_name=service_name,
                                             server_type=server_type,
                                             connection_file_path=connection_file_path,
                                             copy_data_to_server=copy_data_to_server,
                                             supported_operations=supported_operations,
                                             folder_name=folder_name)

if analyze_message["errors"] == {}:
    print "Create sd file"
    arcpy.server.StageService(out_sddraft, out_sd)
    print "Upload service"
    arcpy.server.UploadServiceDefinition(out_sd, connection_file_path)

print "Done!"
0 Kudos
1 Reply
JonathanQuinn
Esri Frequent Contributor

Generate token requests must go through HTTPS, so that's why you still see certificate errors. To handle those warnings, you need to do one of two things:

1) Install the certificate used for the admin URL of your AGS connection file as a trusted root certificate authority

2) Use a certificate already trusted by your machine for the 6443 endpoint, (Configuring HTTPS using an existing certificate—ArcGIS Server Administration (Windows) | ArcGIS Ente...)

0 Kudos