Skip to content

Commit

Permalink
[feature] Consent mechanism for clean insights measurements #452
Browse files Browse the repository at this point in the history
Closes #452
  • Loading branch information
pandafy committed Dec 28, 2023
1 parent e85baef commit 7b409d1
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1073,6 +1073,10 @@ Below are listed all the variables you can customize (you may also want to take
openwisp2_extra_supervisor_restart:
- name: my_custom_service
when: my_custom_service_enabled
# Disable Clean Insights measurements collection.
# It is enabled by default. Read about it at
# https://github.com/openwisp/openwisp-utils#clean-insights-measurements
openwisp2_clean_insights_measurement_consent: false
# enable sentry example
openwisp2_sentry:
dsn: "https://7d2e3cd61acc32eca1fb2a390f7b55e1:[email protected]:443/12345"
Expand Down
1 change: 1 addition & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -212,3 +212,4 @@ openwisp2_django_cors:
allowed_origins_list: []
replace_https_referer: false
openwisp2_extra_supervisor_restart: []
openwisp2_clean_insights_measurement_consent: null
12 changes: 12 additions & 0 deletions molecule/resources/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,18 @@
file:
path: /.dockerenv
state: absent
# TODO: Remove before merging
tasks:
- name: Install openwisp-utils clean insights
pip:
name: "openwisp-utils @ https://github.com/openwisp/openwisp-utils/tarball/issues/360-clean-insights"
state: forcereinstall
virtualenv: "{{ virtualenv_path }}"
virtualenv_python: "{{ openwisp2_python }}"
environment:
SETUPTOOLS_USE_DISTUTILS: stdlib
notify: Reload application
tags: [extra_pip]

roles:
- role: openwisp.openwisp2
30 changes: 30 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,35 @@
---


- name: Show Clean Insights measurement collection disclaimer
debug:
msg: |
By continuing with the ongoing installation process,
you are giving your consent for the collection of the following
Clean Insights measurements:
- Installed OpenWISP Version
- Enabled OpenWISP modules: A list of the enabled OpenWISP modules
along with their respective versions
- OS details: Information on the operating system, including its version, kernel version, and platform
If you prefer not to participate, you can opt-out by configuring
"openwisp2_clean_insights_measurement_consent: false" in your playbook.
However, before making that decision, we encourage you to explore how this
information contributes to the enhancement of OpenWISP at the following link:
https://github.com/openwisp/openwisp-utils#clean-insights-measurements
Should you wish to support us through data collection but prefer to disable
this disclaimer, you can do so by setting
"openwisp2_clean_insights_measurement_consent: true" in your playbook.
when: "openwisp2_clean_insights_measurement_consent == None"
tags: [ci_consent]

- name: Ensure user
pause:
seconds: 30
when: "openwisp2_clean_insights_measurement_consent == None"
tags: [ci_consent]

- import_tasks: apt.yml
tags: [openwisp2, apt]

Expand Down
9 changes: 9 additions & 0 deletions templates/openwisp2/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@
# openwisp2 admin theme
# (must be loaded here)
'openwisp_utils.admin_theme',
{% if openwisp2_clean_insights_measurement_consent %}
'openwisp_utils.measurements',
{% endif %}
'admin_auto_filters',
# admin
'django.contrib.admin',
Expand Down Expand Up @@ -318,6 +321,12 @@
'relative': True,
},
{% endif %}
{% if openwisp2_clean_insights_measurement_consent %}
'send_clean_insights_measurements': {
'task': 'openwisp_utils.measurements.tasks.send_clean_insights_measurements',
'schedule': timedelta(days=7),
},
{% endif %}
{% endif %}
}

Expand Down

0 comments on commit 7b409d1

Please sign in to comment.