Stage Service tool for mxd with UNC path fails

215
1
08-09-2019 01:20 AM
ThibautDelaere1
Occasional Contributor

Hi,

I created a custom Python toolbox that has a tool that publishes mxd's on a certain ArcGIS Server. Both Desktop and Server are 10.4.1.

Manually using the wizard in ArcMap I can publish all mxd, but when trying to publish a mxd that has a source referenced using an UNC path, the stage service tool fails. It says the source of the items referenced using UNC paths cannot be found (= code 3). Odd, as I can publish using the wizard and get no errors when analyzing. The source location is added to the data store.

Traceback (most recent call last):
  File "C:\projects\python_library_gis-toolset\migratieTools\migratieTools\migratieTools.py", line 1039, in publishMxd
    arcpy.StageService_server(out_sddraft_edit,out_sd)
  File "c:\program files (x86)\arcgis\desktop10.4\arcpy\arcpy\server.py", line 1332, in StageService
    raise e
ExecuteError: ERROR 001272: Analyzer errors were encountered (codes = 3).
Failed to execute (StageService).

As I can manually publish using the wizard in ArcMap, I assume all configuration is OK. I doublechecked and all seems indeed OK.

I do analyze the sddraft and it gives no errors, not in ArcMap, not in Python. Off course I get the warnings about the UNC paths.

So I created a sddraft using the wizard in ArcMap (to be sure both in Python and ArcMap use the same sddraft file) and used this as an input for the stage service tool. Again, it fails (code 3). So I assume the sddraft is ok, but the issue is in the stage service tool, which is somehow working differently than staging a service using the wizard.

What bothers me most is why can I publish using the wizard and not using the tool? Shouldn't these work the same way?

What do I miss?

0 Kudos
1 Reply
ThibautDelaere1
Occasional Contributor

An addition to this issue, I stumbled upon the following issue, which might be related:

I checked if the 'store relative paths' option was active in the mxd, but it wasn't. Now, when I activate it, save the mxd and reopen it, the data connections are broken. The paths are altered to an incorrect UNC path. Even while the documentation states that UNC paths are not affected by the 'store relative path' option.

Mxd is stored on: \\stadgent\junction\services\mxd_toPublish

Data is on: \\stadgent\appdata\gisconfig\filegeodatabases

After saving, closing and reopening with the store relative path option on the source path changes into:

\\stadgent\junction\appdata\gisconfig\filegeodatabases

0 Kudos