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

Impossible to edit mirror when name is subset of other mirror #19

Closed
kib opened this issue Aug 1, 2015 · 9 comments
Closed

Impossible to edit mirror when name is subset of other mirror #19

kib opened this issue Aug 1, 2015 · 9 comments
Labels

Comments

@kib
Copy link
Contributor

kib commented Aug 1, 2015

When there are two mirrors with very similar names the show command will fuzzy logic list both mirrors, in my opinion this is a good thing.

The issue however is threefold:

  • The edit command will do the same, and does not use strict checking
  • There is no way (I found) to change the descriptive name of a mirror
  • (SOLVED) It is impossible to add a mirror with the same name as one that was previously removed.

Example:

First I add a few mirrors called test.example.com and secondtest.example.com

$ mirrorbits add -http="http://test.example.com" test.example.com 
Warning: unable to guess the geographic location of test.example.com
Mirror added successfull
$ mirrorbits add -http="http://secondtest.example.com" secondtest.example.com
Warning: unable to guess the geographic location of test.example.com
Mirror added successfull

It is clear this worked from the output of the show command

$ mirrorbits show example
secondtest.example.com
test.example.com

But I can't edit test.example.com

$ mirrorbits edit test.example.com
secondtest.example.com
test.example.com

I proceed to remove secondtest.example.com so i can edit test.example.com

$ mirrorbits remove secondtest.example.com
Mirror removed successfully
$ mirrorbits edit test.example.com

I then find out I can't edit the displayname of this mirror.
I end up removing it completely and recreating it with the new displayname

When I tried this previously I also was not able to recreate the same mirrorname, it complains the mirror already exists:

$ mirrorbits add <lots of info> z.os6.org
Mirror z.os6.org already exists!
$ mirrorbits edit z.os6.org
No match for z.os6.org
@kib
Copy link
Contributor Author

kib commented Aug 1, 2015

Edit on the last issue, this seems to be created with a previous version of mirrorbits, there was a MIRROR_z.os6.org key left in the redis database with no other keys / keydata with it. I've manually removed the offending key and was able to reuse the name.

@kib
Copy link
Contributor Author

kib commented Aug 1, 2015

The naming issue also affects removing mirrors:

$ mirrorbits remove test.example.com
secondtest.example.com
test.example.com
$ mirrorbits remove secondtest.example.com
Mirror removed successfully

@etix etix added the bug label Aug 1, 2015
@etix etix closed this as completed in eb7310a Aug 1, 2015
@etix
Copy link
Owner

etix commented Aug 1, 2015

Nice catch! Thanks a lot :)

@kib
Copy link
Contributor Author

kib commented Aug 1, 2015

just 'lucky' we had two similar names I guess. Thanks for the quick fix 👍

@kib
Copy link
Contributor Author

kib commented Aug 1, 2015

Any chance you could make it possible to change the descriptive name of the mirror ?

@etix
Copy link
Owner

etix commented Aug 1, 2015

Renaming a mirror is quite difficult currently since the mirror identifier is part of thousands of keys in the database. It would require to disable the mirror, replace all matching keys and take it back online. Another option would be to use an intermediate table but that would require a breaking database format change. Your best option here is to remove and add the mirror back but with a different name.

@kib
Copy link
Contributor Author

kib commented Aug 1, 2015

@etix I see, well than we just must be careful not to make mistakes 👍

@etix
Copy link
Owner

etix commented Aug 1, 2015

It's definitely on my TODO-breaking list, I just want to do all breaking changes at the same time, most certainly just before 1.0-stable.

@kib
Copy link
Contributor Author

kib commented Aug 1, 2015

patch for editing names confirmed working, just tested adding a mirror with subsetname, was able to edit and remove it no problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants