mirror of
https://github.com/ansible/awx.git
synced 2026-01-14 03:10:42 -03:30
HostMetricSummaryMonthly API commented out
This commit is contained in:
parent
382f98ceed
commit
8ec6e556a1
@ -1,12 +0,0 @@
|
||||
# Intended Use Case
|
||||
|
||||
To get summaries from a certain day or earlier, you can filter this
|
||||
endpoint in the following way.
|
||||
|
||||
?date__gte=2023-01-01
|
||||
|
||||
This will return summaries that were produced on that date or later.
|
||||
These host metric monthly summaries should be automatically produced
|
||||
by a background task that runs once each month.
|
||||
|
||||
{% include "api/list_api_view.md" %}
|
||||
@ -30,7 +30,7 @@ from awx.api.views import (
|
||||
OAuth2TokenList,
|
||||
ApplicationOAuth2TokenList,
|
||||
OAuth2ApplicationDetail,
|
||||
HostMetricSummaryMonthlyList,
|
||||
# HostMetricSummaryMonthlyList, # It will be enabled in future version of the AWX
|
||||
)
|
||||
|
||||
from awx.api.views.bulk import (
|
||||
@ -121,7 +121,8 @@ v2_urls = [
|
||||
re_path(r'^inventories/', include(inventory_urls)),
|
||||
re_path(r'^hosts/', include(host_urls)),
|
||||
re_path(r'^host_metrics/', include(host_metric_urls)),
|
||||
re_path(r'^host_metric_summary_monthly/$', HostMetricSummaryMonthlyList.as_view(), name='host_metric_summary_monthly_list'),
|
||||
# It will be enabled in future version of the AWX
|
||||
# re_path(r'^host_metric_summary_monthly/$', HostMetricSummaryMonthlyList.as_view(), name='host_metric_summary_monthly_list'),
|
||||
re_path(r'^groups/', include(group_urls)),
|
||||
re_path(r'^inventory_sources/', include(inventory_source_urls)),
|
||||
re_path(r'^inventory_updates/', include(inventory_update_urls)),
|
||||
|
||||
@ -1570,15 +1570,16 @@ class HostMetricDetail(RetrieveDestroyAPIView):
|
||||
return Response(status=status.HTTP_204_NO_CONTENT)
|
||||
|
||||
|
||||
class HostMetricSummaryMonthlyList(ListAPIView):
|
||||
name = _("Host Metrics Summary Monthly")
|
||||
model = models.HostMetricSummaryMonthly
|
||||
serializer_class = serializers.HostMetricSummaryMonthlySerializer
|
||||
permission_classes = (IsSystemAdminOrAuditor,)
|
||||
search_fields = ('date',)
|
||||
|
||||
def get_queryset(self):
|
||||
return self.model.objects.all()
|
||||
# It will be enabled in future version of the AWX
|
||||
# class HostMetricSummaryMonthlyList(ListAPIView):
|
||||
# name = _("Host Metrics Summary Monthly")
|
||||
# model = models.HostMetricSummaryMonthly
|
||||
# serializer_class = serializers.HostMetricSummaryMonthlySerializer
|
||||
# permission_classes = (IsSystemAdminOrAuditor,)
|
||||
# search_fields = ('date',)
|
||||
#
|
||||
# def get_queryset(self):
|
||||
# return self.model.objects.all()
|
||||
|
||||
|
||||
class HostList(HostRelatedSearchMixin, ListCreateAPIView):
|
||||
|
||||
@ -103,7 +103,8 @@ class ApiVersionRootView(APIView):
|
||||
data['groups'] = reverse('api:group_list', request=request)
|
||||
data['hosts'] = reverse('api:host_list', request=request)
|
||||
data['host_metrics'] = reverse('api:host_metric_list', request=request)
|
||||
data['host_metric_summary_monthly'] = reverse('api:host_metric_summary_monthly_list', request=request)
|
||||
# It will be enabled in future version of the AWX
|
||||
# data['host_metric_summary_monthly'] = reverse('api:host_metric_summary_monthly_list', request=request)
|
||||
data['job_templates'] = reverse('api:job_template_list', request=request)
|
||||
data['jobs'] = reverse('api:job_list', request=request)
|
||||
data['ad_hoc_commands'] = reverse('api:ad_hoc_command_list', request=request)
|
||||
|
||||
@ -809,7 +809,7 @@ register(
|
||||
'SUBSCRIPTION_USAGE_MODEL',
|
||||
field_class=fields.ChoiceField,
|
||||
choices=[
|
||||
('', _('Default model for AWX - no subscription')),
|
||||
('', _('Default model for AWX - no subscription. Deletion of host_metrics will not be considered for purposes of managed host counting')),
|
||||
(
|
||||
SUBSCRIPTION_USAGE_MODEL_UNIQUE_HOSTS,
|
||||
_('Usage based on unique managed nodes in a large historical time frame and delete functionality for no longer used managed nodes'),
|
||||
|
||||
@ -227,7 +227,7 @@ class Command(BaseCommand):
|
||||
|
||||
# --json flag is not set, output in plain text
|
||||
else:
|
||||
print(f"Printing up to {BATCHED_FETCH_COUNT } automated hosts:")
|
||||
print(f"Printing up to {BATCHED_FETCH_COUNT} automated hosts:")
|
||||
result = HostMetric.objects.filter(**filter_kwargs)
|
||||
list_of_queryset = self.host_metric_queryset(result, 0, BATCHED_FETCH_COUNT)
|
||||
for item in list_of_queryset:
|
||||
|
||||
@ -384,8 +384,8 @@ class Licenser(object):
|
||||
current_instances = Host.objects.active_count()
|
||||
license_date = int(attrs.get('license_date', 0) or 0)
|
||||
|
||||
model = getattr(settings, 'SUBSCRIPTION_USAGE_MODEL', '')
|
||||
if model == SUBSCRIPTION_USAGE_MODEL_UNIQUE_HOSTS:
|
||||
subscription_model = getattr(settings, 'SUBSCRIPTION_USAGE_MODEL', '')
|
||||
if subscription_model == SUBSCRIPTION_USAGE_MODEL_UNIQUE_HOSTS:
|
||||
automated_instances = HostMetric.active_objects.count()
|
||||
first_host = HostMetric.active_objects.only('first_automation').order_by('first_automation').first()
|
||||
else:
|
||||
|
||||
@ -1032,5 +1032,4 @@ UI_NEXT = True
|
||||
# License compliance for total host count. Possible values:
|
||||
# - '': No model - Subscription not counted from Host Metrics
|
||||
# - 'unique_managed_hosts': Compliant = automated - deleted hosts (using /api/v2/host_metrics/)
|
||||
# - 'unique_managed_hosts_monthly': TBD: AoC on Azure (now equal to '')
|
||||
SUBSCRIPTION_USAGE_MODEL = ''
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user