Addition of a /ping/ endpoint to give basic HA info.

This commit is contained in:
Luke Sneeringer 2014-09-22 14:57:42 -05:00
parent 5d4444235a
commit f5b7d500a5
2 changed files with 22 additions and 0 deletions

View File

@ -194,6 +194,7 @@ activity_stream_urls = patterns('awx.api.views',
v1_urls = patterns('awx.api.views',
url(r'^$', 'api_v1_root_view'),
url(r'^ping/$', 'api_v1_ping_view'),
url(r'^config/$', 'api_v1_config_view'),
url(r'^authtoken/$', 'auth_token_view'),
url(r'^me/$', 'user_me_list'),

View File

@ -114,6 +114,27 @@ class ApiV1RootView(APIView):
data['activity_stream'] = reverse('api:activity_stream_list')
return Response(data)
class ApiV1PingView(APIView):
"""A simple view that reports very basic information about this Tower
instance, which is acceptable to be public information.
"""
permission_classes = (AllowAny,)
authentication_classes = ()
view_name = 'Ping'
def get(self, request, format=None):
"""Return some basic information about this Tower instance.
Everything returned here should be considered public / insecure, as
this requires no auth and is intended for use by the installer process.
"""
return Response({
'role': 'standalone', # FIXME: Make this dynamic.
'version': get_awx_version(),
})
class ApiV1ConfigView(APIView):
permission_classes = (IsAuthenticated,)