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

[fix] Fixed usage metric collection consent import in tasks/main.yml #452 #464

Merged
merged 13 commits into from
Apr 4, 2024
Merged
1 change: 1 addition & 0 deletions molecule/resources/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
openwisp2_controller_subnet_division: true
openwisp2_uwsgi_extra_conf: |
single-interpreter=True
openwisp2_usage_metric_collection_consent: false

pre_tasks:
- name: Update apt cache
Expand Down
4 changes: 2 additions & 2 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---

- import_tasks: apt.yml
tags: [openwisp2, ci_consent]
- import_tasks: consent.yml
tags: [openwisp2, usage_collection]

- import_tasks: apt.yml
tags: [openwisp2, apt]
Expand Down
55 changes: 27 additions & 28 deletions templates/openwisp2/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
# openwisp2 admin theme
# (must be loaded here)
'openwisp_utils.admin_theme',
{% if openwisp2_usage_metric_collection_consent %}
{% if openwisp2_usage_metric_collection_consent is not false %}
'openwisp_utils.measurements',
{% endif %}
'admin_auto_filters',
Expand Down Expand Up @@ -266,14 +266,12 @@
'args': ({{ openwisp2_notifications_delete_old_notifications }},),
},
{% if openwisp2_monitoring %}

'run_checks': {
'task': 'openwisp_monitoring.check.tasks.run_checks',
'schedule': timedelta(minutes=5),
},
{% endif %}
{% if openwisp2_radius %}

'deactivate_expired_users': {
'task': 'openwisp_radius.tasks.deactivate_expired_users',
'schedule': crontab(**{ {{ cron_deactivate_expired_users }} }),
Expand All @@ -298,36 +296,35 @@
'args': [{{ openwisp2_radius_delete_old_postauth }}],
'relative': True,
},

{% if openwisp2_radius_delete_old_radacct %}
'delete_old_radacct': {
'task': 'openwisp_radius.tasks.delete_old_radacct',
'schedule': crontab(**{ {{ cron_delete_old_radacct }} }),
'args': [{{ openwisp2_radius_delete_old_radacct }}],
'relative': True,
},
{% endif %}
{% if openwisp2_radius_unverify_inactive_users %}
'unverify_inactive_users': {
'task': 'openwisp_radius.tasks.unverify_inactive_users',
'schedule': crontab(**{ {{ cron_unverify_inactive_users }} }),
'relative': True,
},
{% endif %}
{% if openwisp2_radius_delete_inactive_users %}
'delete_inactive_users': {
'task': 'openwisp_radius.tasks.delete_inactive_users',
'schedule': crontab(**{ {{ cron_delete_inactive_users }} }),
'relative': True,
},
{% if openwisp2_radius_delete_old_radacct %}
'delete_old_radacct': {
'task': 'openwisp_radius.tasks.delete_old_radacct',
'schedule': crontab(**{ {{ cron_delete_old_radacct }} }),
'args': [{{ openwisp2_radius_delete_old_radacct }}],
'relative': True,
},
{% endif %}
{% if openwisp2_radius_unverify_inactive_users %}
'unverify_inactive_users': {
'task': 'openwisp_radius.tasks.unverify_inactive_users',
'schedule': crontab(**{ {{ cron_unverify_inactive_users }} }),
'relative': True,
},
{% endif %}
{% if openwisp2_radius_delete_inactive_users %}
'delete_inactive_users': {
'task': 'openwisp_radius.tasks.delete_inactive_users',
'schedule': crontab(**{ {{ cron_delete_inactive_users }} }),
'relative': True,
},
{% endif %}
{% endif %}
{% if openwisp2_usage_metric_collection_consent %}
{% if openwisp2_usage_metric_collection_consent is not false %}
'send_usage_metrics': {
'task': 'openwisp_utils.measurements.tasks.send_usage_metrics',
'schedule': timedelta(days=7),
'schedule': timedelta(days=1),
},
{% endif %}
{% endif %}
}

{% if openwisp2_celery_task_routes_defaults %}
Expand Down Expand Up @@ -567,3 +564,5 @@
{% endif %}
CORS_ALLOWED_ORIGINS = {{ openwisp2_django_cors.get('allowed_origins_list', []) }}
{% endif %}

TEST_RUNNER = 'openwisp_utils.measurements.tests.runner.MockRequestPostRunner'
Loading