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

dev: remove workaround for deleting the member #173

Open
dec0dOS opened this issue Oct 8, 2023 · 4 comments
Open

dev: remove workaround for deleting the member #173

dec0dOS opened this issue Oct 8, 2023 · 4 comments
Labels
enhancement Enhancement of the code, not introducing new features.

Comments

@dec0dOS
Copy link
Owner

dec0dOS commented Oct 8, 2023

Deprecate workaround for this:
zerotier/ZeroTierOne#859
as It was fixed in
zerotier/ZeroTierOne@f8ea7fd

More info:

export async function deleteMemberAdditionalData(nwid, mid) {
// ZT controller bug
/* db.get("networks")
.find({ id: nwid })
.get("members")
.remove({ id: mid })
.write();
*/
await updateMemberAdditionalData(nwid, mid, {});
db.get("networks")
.filter({ id: nwid })
.map("members")
.first()
.filter({ id: mid })
.first()
.set("deleted", true)
.write();
}

@dec0dOS dec0dOS added the enhancement Enhancement of the code, not introducing new features. label Oct 8, 2023
@wongsyrone
Copy link
Contributor

How about this block

// Need this to fix ZT controller bug https://github.com/zerotier/ZeroTierOne/issues/859
const defaultConfig = {
authorized: false,
ipAssignments: [],
capabilities: [],
tags: [],
};
api
.post("controller/network/" + nwid + "/member/" + mid, defaultConfig)
.then(function (controllerRes) {
res.status(controllerRes.status).send("");
})
.catch(function (err) {
res.status(500).send({ error: err.message });
});

@dec0dOS
Copy link
Owner Author

dec0dOS commented Oct 11, 2023

@wongsyrone, thanks for pointing! This one is also affected.

@wongsyrone
Copy link
Contributor

Another quick thought, my db.json left many zt nodes with deleted set to true, it's better to clean up these leftovers on zero-ui startup. The proposed workflow is to do the member deletion but ignore controller response and delete additional member data and the member entry in db.json.

@dec0dOS
Copy link
Owner Author

dec0dOS commented Oct 11, 2023

Currently, I'm still thinking for the proper migrations solution for ZeroUI: #75

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement of the code, not introducing new features.
Projects
None yet
Development

No branches or pull requests

2 participants