-
Notifications
You must be signed in to change notification settings - Fork 104
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
FYI - group management sync will not fully work due to current schema #26
Comments
quick update - manually creating the groups on all 'slave' piholes does appear to work as a quick fix however they need to be created / displayed in the same order as on the master. |
so I have a workaround fix for exporting group in pushes, just enclose the table name so its 'group' (thanks discourse) |
So the feature request didnt get anywhere. $SUDO sqlite3 $gravity_db "DROP TABLE 'group';" This is required because .import produces syntax errors when working with group or group enclosed in '' "" `` etc. I couldnt get any to work. Its messy but at least the import and rename works. |
going around in circles with this - I let this run through a push/pull cycle and it failed on one machine but worked on another. The fail was during the pull process with sqlite3 being unable to rename the group_tmp table due to conflicts (apparently) within the views. sqlite> ALTER TABLE group_tmp RENAME TO 'group'; I'll play some more but I've seen this previously and have no idea what's going on. This only ever appears with the 'group' table so I'm pretty sure its the name of the table forcing extra steps that is the issue but there's not a lot I can do about that. From reading some documentation it appears that renaming tables in sqlite can be problematic due to the way sqlite stores the schema compared to say full sql. The only main difference I can find between the systems is sqlite version. On the push and failing pull machine its On the working pull machine its So at the moment I am back to manually syncing groups on the various pihole before attempting to pull and have disabled the above drop/import/rename code within my testing. At least (for me) the groups rarely change |
Firstly thank you very much for this code. I love how it works and how easy it makes syncing my piholes. I now have working code for group and client sync thanks to various info's and help from the pihole discourse. I am happy to share what I have, it appears to fully work with group and client sync for all the push/pull functions. Client sync is optional via changing a variable within the script. I didnt want to just paste it here as its not my underlying code. Let me know and I will post it here or do a pull request, though I did end up making quite a few changes. Key things I had to change
Other things
|
Hi @dispo2 , do you think it's possible to share your awesome work ? |
This is my modified script which I haven't updated it since Feb 2021, it's pretty solid but use at your own risk. I use this across three pihole, two on the same LAN which sync clients, the third is in the cloud which does not. All credit to @stevejenkins for the original code, I have made various changes to enable group and client sync, which are enabled by default but can be individually disabled as required by editing variables at the top of the scipt. This post will of course be deleted if requested by steve as this is not my code. The use / syntax of the code is unchanged so use --initpush / push, --initpull / pull as normal. If for some reason a pull messes up or clients / groups get out of sync on a 'slave' then a delete of groups / clients and an initpull / pull usually fixes it. There is no risk to the 'master' as the only change is that additional tables are pushed to github. Delete the .txt extension to use. |
I have raised a 'feature request' on the pihole discourse for this but just FYI the future group sync feature (which I have been looking at coding) will not fully work due to the use of the group keyword for the table name (only this table is affected).
The use of a keyword results in a syntax error when trying to export the table to CSV.
A workaround is to manually create the groups to match but I'm not sure if this will cause issues as internally the DB's will be different.
Coding wise the change is very easy with additional commands for the 3 group tables and 2 client tables but the client side would raise issues if the piholes are in different locations and therefore see different clients. This might require the client sync aspect to be optional via command line flag ??
The text was updated successfully, but these errors were encountered: