Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes service fake publish success issue #974

Merged
merged 1 commit into from
Nov 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions Core/LAMBDA/viz_functions/viz_publish_service/lambda_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,18 @@ def lambda_handler(event, context):
s3.download_file(s3_bucket, sd_s3_path, local_sd_file)
print(f"---> Downloaded {sd_s3_path}")
# Publish the service
publish_server.services.publish_sd(sd_file=local_sd_file, folder=folder) # arcgis.gis.GIS publish_sd method
success = publish_server.services.publish_sd(sd_file=local_sd_file, folder=folder) # arcgis.gis.GIS publish_sd method
print(f"Publish success: {success}")
print(f"---> Published {sd_s3_path}")

matching_services = [service for service in publish_server.services.list(folder=folder) if 'serviceName' in service.properties and (service.properties['serviceName'] == service_name or service.properties['serviceName'] == service_name_publish)] # noqa: E501
if not matching_services:
print(f"Service not found, though supposedly published successfully. Removing SD file and recreating it...")
os.remove(local_sd_file)
s3.delete_object(Bucket=s3_bucket, Key=sd_s3_path)
continue
# Ensuring that the description for the service matches the iteminfo
matching_service = [service for service in publish_server.services.list(folder=folder) if 'serviceName' in service.properties and (service.properties['serviceName'] == service_name or service.properties['serviceName'] == service_name_publish)][0]
matching_service = matching_services[0]
if not matching_service.properties['description']:
print("Updating service property description to match iteminfo")
service_properties = matching_service.properties
Expand Down
Loading