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

_register_extension() method attached to incorrect Class - Service, not ServiceManager #1827

Open
longdinhgis opened this issue May 18, 2024 · 2 comments

Comments

@longdinhgis
Copy link

Describe the bug
I was searching for a method on the API to register a Server Object Extension to an ArcGIS Enterprise Server via the /admin/services/types/extensions/register endpoint and noticed that the _register_extension() method is incorrectly attached to the Service class (arcgis.gis.server.admin._services.Service) and not the ServiceManager (arcgis.gis.server.admin._services.ServiceManager) class.

The _register_extension() method calls the /types/extensions/register endpoint from the Service object's _url which does not exist. It should be from the ServiceManager class's _url property instead.

To Reproduce
Steps to reproduce the behavior:

from arcgis import GIS
from uuid import uuid4

gis = GIS(profile='MyProfile')

# Assuming I have atleast one server
server = gis.admin.servers.list()[0]

# Use default sample service as example
service = server.services.list()
# Create dummy item_id
item_id = str(uuid4())
service._register_extension(item_id)

The method should be attached to arcgis.gis.server.admin._services.ServiceManager()

from arcgis import GIS
gis = GIS(profile='MyProfile')

# Assuming I have atleast one server
server = gis.admin.servers.list()[0]

# The url should be valid
register_url = server.services._url + "/types/extensions/register"
resp = gis._con.get(register_url)
print (resp)
# returns error with POST only method message

resp = gis._con.post(register_url)
print (resp)
# returns 500 error with Required parameter id

error:
The Python json response is below after calling _register_extension

{'status': 'error',
 'messages': ["Could not find resource or operation 'types' on the system."],
 'code': 404}

Screenshots
image

image

image

Expected behavior
I wanted to register/update a Server Object Extension via the API. I was expecting there was a method in the ServiceManager class to register extensions on the server. Instead, I found _unregister_extension and _update_extension but the _register_extension method was attached to Service incorrectly.

Platform (please complete the following information):

  • OS: Windows 10
  • ArcGIS Enterprise 11.1
  • Python API Version: 2.1.0.2

Additional context
Screenshots are from my IPython session. Inputs are made up - dummy.

@longdinhgis
Copy link
Author

Also, the _extensions property is incorrectly attached to the Service() class but should be on the ServiceManager() class

@nanaeaubry
Copy link
Contributor

@longdinhgis Thanks for opening this issue but these are private properties and methods and thus are not documented or guaranteed to work as you would expect since these are more likely for internal use.

We recommend you use documented methods and properties for your workflow. If you have a question about this feel free to ask!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants