Open TB-DevAcc opened 2 years ago
This should probably already fix the issue: Changing this line
to
elif influxdb_admin.token != None:
This should probably already fix the issue: Changing this line
to
elif influxdb_admin.token != None:
Doesn't really fix it, the token stays empty. The question is how to set the token when the setup was run but the database does not contain the token?
The problem exists, because you already have InfluxDB set up. SHB cannot run the InfluxDB setup on an set up instance. To the best of my knowledge, there is no way to programmatically acquire the admin token from an already set-up InfluxDB instance. This means that you can a) reset InfluxDB (delete ~/.influxdbv2
and rerun SHB, which will then set InfluxDB up and add the admin token to influxdb
) or b) look up the admin token in the InfluxDB GUI and add it to the DB manually.
Regarding a): InfluxDB's Setup API allows passing a custom admin token. If not given, it returns an auto-generated token after successful setup. Currently, we do not set a token, so we use the auto-generated one.
When performing a fresh install (no DBs present), the problem should not come up. Also, it should not happen after reinstalling SHB, e.g., after an update, because then both DBs with all relevant data will be present. However, in the future we should probably implement a way to update the token (maybe also username/password) via SHBs GUI...
Yes it should not, but it did. I have not setup Influxdb myself, meaning that shbdeviceidentifier must have set up the database but failed somehow. If this happens for a user, requiring him to delete the influxdb directory manually does not seem to be the best solution.
Finding the influxdb data directory and remembering it might be important for the uninstaller anyway, so deleting it programmatically would then be a viable option.
Oh, ok. Would be interesting to find out why it fails.
Fixing the setup in case of failure would require something like (pseudo code)
def _fix_influxdb_setup():
if is_influxdb_set_up and is_token_in_sqlite_empty:
reset_influxdb()
reset_user_in_sqlite()
_run_influxdb_setup() # Already exists in db.py:132
Describe the bug When cloning the repo and setting up the project for development,
shbdeviceidentifier start
does create the sqlite tablesusers
andinfluxdb
but does not populate them with the necessary entries.To Reproduce Steps to reproduce the behavior:
Expected behavior SQLite db should contain at least one user
Desktop (please complete the following information):