When using a derivative of the template map service publishing examples given in many places throughout ESRI documentation, I have the following working (I've stripped this down significantly)...
<SPAN class="comment token"># set up a number of parameter for SD Draft generation</SPAN>
<SPAN class="comment token"># shortened for illustration</SPAN>
sharing_draft <SPAN class="operator token">=</SPAN> m<SPAN class="punctuation token">.</SPAN>getWebLayerSharingDraft<SPAN class="punctuation token">(</SPAN><SPAN class="string token">"FEDERATED_SERVER"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"MAP_IMAGE"</SPAN><SPAN class="punctuation token">,</SPAN> service<SPAN class="punctuation token">)</SPAN>
sharing_draft<SPAN class="punctuation token">.</SPAN>federatedServerUrl <SPAN class="operator token">=</SPAN> <SPAN class="operator token"><</SPAN>federatedServerUrl<SPAN class="operator token">></SPAN>
<SPAN class="punctuation token">.</SPAN><SPAN class="punctuation token">.</SPAN><SPAN class="punctuation token">.</SPAN>
<SPAN class="comment token"># Create SD Draft files</SPAN>
sharing_draft<SPAN class="punctuation token">.</SPAN>exportToSDDraft<SPAN class="punctuation token">(</SPAN>sddraft_output_filename<SPAN class="punctuation token">)</SPAN>
<SPAN class="punctuation token">.</SPAN><SPAN class="punctuation token">.</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>StageService_server<SPAN class="punctuation token">(</SPAN>sddraft_output_filename<SPAN class="punctuation token">,</SPAN> sd_output_filename<SPAN class="punctuation token">)</SPAN>
<SPAN class="punctuation token">.</SPAN><SPAN class="punctuation token">.</SPAN><SPAN class="punctuation token">.</SPAN>
<SPAN class="comment token"># set up a number of parameter for SD Draft</SPAN>
<SPAN class="comment token"># shortened for illustration</SPAN>
inSdFile <SPAN class="operator token">=</SPAN> sd_output_filename
inServer <SPAN class="operator token">=</SPAN> <SPAN class="operator token"><</SPAN>serverUrl<SPAN class="operator token">></SPAN>
inServiceName <SPAN class="operator token">=</SPAN> <SPAN class="operator token"><</SPAN>service name<SPAN class="operator token">></SPAN>
<SPAN class="punctuation token">.</SPAN><SPAN class="punctuation token">.</SPAN><SPAN class="punctuation token">.</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>UploadServiceDefinition_server<SPAN class="punctuation token">(</SPAN>inSdFile<SPAN class="punctuation token">,</SPAN> inServer<SPAN class="punctuation token">,</SPAN> inServiceName<SPAN class="punctuation token">,</SPAN> <SPAN class="punctuation token">.</SPAN><SPAN class="punctuation token">.</SPAN><SPAN class="punctuation token">.</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
What exactly is the difference - if any - between what I am referring to here as >federatedServerUrl. and <serverUrl>? And what exactly is the format of the URL expected here? I have it working in one environment and am using the exact same string (URL) for both variables. In another environment, the same code fails with
ExecuteError: ERROR 999999: Something unexpected caused the tool to fail.
Please refer to the error help for potential solutions, or contact Esri
Technical Support http://esriurl.com/support.
Failed to execute (StageService).<SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
The only difference is that I'm using a different URL but the same one in both places. It's a valid URL that mimics the first environment's URL and includes the webadaptor name. It successfully created the SD Draft file. So the URL seems to work fine for that steps.
Very frustrating. I have used this a bunch of times in both environments and now it fails.