Skip to content
This repository has been archived by the owner on Mar 31, 2020. It is now read-only.

Commit

Permalink
error fix when portal does not return publishing servers
Browse files Browse the repository at this point in the history
bug fix in portalautomation.py
  • Loading branch information
MikeMillerGIS committed Jun 23, 2015
1 parent 2f58879 commit b2776aa
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 57 deletions.
115 changes: 58 additions & 57 deletions src/arcrest/manageorg/administration.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,63 +399,64 @@ def hostingServers(self, portalId=None):
urls = portal.urls
services = []
if urls != {}:
for https in portal.featureServers['https']:

if 'isPortal' in portal.portalProperties:
if portal.portalProperties['isPortal'] == True:
url = "%s/admin" % https
services.append(AGSAdministration(url=url,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port))
elif portal.portalProperties['isPortal'] == False:
url = "https://%s/%s/ArcGIS/rest/admin" % (https, portal.portalId)
services.append(Services(url=url,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port))
else:
url = "https://%s/%s/ArcGIS/rest/admin" % (https, portal.portalId)
services.append(Services(url=url,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port))
## elif self._securityHandler is not None:
##
##
##
## if isinstance(self._securityHandler, AGOLTokenSecurityHandler):
## url = "https://%s/%s/ArcGIS/rest/admin" % (https, portal.portalId)
## services.append(Services(url=url,
## securityHandler=self._securityHandler,
## proxy_url=self._proxy_url,
## proxy_port=self._proxy_port))
## elif isinstance(self._securityHandler, PortalTokenSecurityHandler):
## url = "%s/admin" % https
## services.append(AGSAdministration(url=url,
## securityHandler=self._securityHandler,
## proxy_url=self._proxy_url,
## proxy_port=self._proxy_port))
## elif isinstance(self._securityHandler, ArcGISTokenSecurityHandler):
## if 'isPortal' in portal.portalProperties:
## if portal.portalProperties['isPortal'] == True:
## url = "%s/admin" % https
## services.append(AGSAdministration(url=url,
## securityHandler=self._securityHandler,
## proxy_url=self._proxy_url,
## proxy_port=self._proxy_port))
## elif portal.portalProperties['isPortal'] == False:
## url = "https://%s/%s/ArcGIS/rest/admin" % (https, portal.portalId)
## services.append(Services(url=url,
## securityHandler=self._securityHandler,
## proxy_url=self._proxy_url,
## proxy_port=self._proxy_port))
## else:
## url = "https://%s/%s/ArcGIS/rest/admin" % (https, portal.portalId)
## services.append(Services(url=url,
## securityHandler=self._securityHandler,
## proxy_url=self._proxy_url,
## proxy_port=self._proxy_port))
if 'https' in portal.featureServers:
for https in portal.featureServers['https']:

if 'isPortal' in portal.portalProperties:
if portal.portalProperties['isPortal'] == True:
url = "%s/admin" % https
services.append(AGSAdministration(url=url,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port))
elif portal.portalProperties['isPortal'] == False:
url = "https://%s/%s/ArcGIS/rest/admin" % (https, portal.portalId)
services.append(Services(url=url,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port))
else:
url = "https://%s/%s/ArcGIS/rest/admin" % (https, portal.portalId)
services.append(Services(url=url,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port))
## elif self._securityHandler is not None:
##
##
##
## if isinstance(self._securityHandler, AGOLTokenSecurityHandler):
## url = "https://%s/%s/ArcGIS/rest/admin" % (https, portal.portalId)
## services.append(Services(url=url,
## securityHandler=self._securityHandler,
## proxy_url=self._proxy_url,
## proxy_port=self._proxy_port))
## elif isinstance(self._securityHandler, PortalTokenSecurityHandler):
## url = "%s/admin" % https
## services.append(AGSAdministration(url=url,
## securityHandler=self._securityHandler,
## proxy_url=self._proxy_url,
## proxy_port=self._proxy_port))
## elif isinstance(self._securityHandler, ArcGISTokenSecurityHandler):
## if 'isPortal' in portal.portalProperties:
## if portal.portalProperties['isPortal'] == True:
## url = "%s/admin" % https
## services.append(AGSAdministration(url=url,
## securityHandler=self._securityHandler,
## proxy_url=self._proxy_url,
## proxy_port=self._proxy_port))
## elif portal.portalProperties['isPortal'] == False:
## url = "https://%s/%s/ArcGIS/rest/admin" % (https, portal.portalId)
## services.append(Services(url=url,
## securityHandler=self._securityHandler,
## proxy_url=self._proxy_url,
## proxy_port=self._proxy_port))
## else:
## url = "https://%s/%s/ArcGIS/rest/admin" % (https, portal.portalId)
## services.append(Services(url=url,
## securityHandler=self._securityHandler,
## proxy_url=self._proxy_url,
## proxy_port=self._proxy_port))
else:
print "Security Handler is not set"
return services
Expand Down
5 changes: 5 additions & 0 deletions src/arcresthelper/portalautomation.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,11 @@ def publishfromconfig(configFiles,globalLoginInfo,combinedApp=None,log_file=None
print("with error message: %s" % e[0]['synerror'])
if 'arcpyError' in e[0]:
print("with arcpy message: %s" % e[0]['arcpyError'])
else:
line, filename, synerror = trace()
print("error on line: %s" % line)
print("error in file name: %s" % filename)
print("with error message: %s" % synerror)
else:
line, filename, synerror = trace()
print("error on line: %s" % line)
Expand Down

0 comments on commit b2776aa

Please sign in to comment.