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

Fixed IPv6 host renaming #7275

Merged
merged 4 commits into from Sep 2, 2017

Conversation

Projects
None yet
4 participants
@Zmegolaz
Member

Zmegolaz commented Aug 31, 2017

DO NOT DELETE THIS TEXT

Please note

Please read this information carefully. You can run ./scripts/pre-commit.php to check your code before submitting.

Testers

If you would like to test this pull request then please run: ./scripts/github-apply <pr_id>, i.e ./scripts/github-apply 5926

Renaming a host which contains an IPv6 address fails, as it tries to move a directory with the exact hostname. The actual directory name has some characters escaped.
This commit updates the renamehost() function to trim [] and replace : with _, in the same way as rrd_name() in includes/rrdtool.inc.php does.


This change is Reviewable

@murrant

This comment has been minimized.

Show comment
Hide comment
@murrant

murrant Aug 31, 2017

Member

Thanks for the fix.

I just checked and there are other areas of the code that would be affected by the sanitized ipv6 address directories.

I think the best fix would be to implement a new funciton get_rrd_dir($hostname) or something.

Member

murrant commented Aug 31, 2017

Thanks for the fix.

I just checked and there are other areas of the code that would be affected by the sanitized ipv6 address directories.

I think the best fix would be to implement a new funciton get_rrd_dir($hostname) or something.

@Zmegolaz

This comment has been minimized.

Show comment
Hide comment
@Zmegolaz

Zmegolaz Aug 31, 2017

Member

I was afraid of that. Just to be clear, the directories are already sanitized in the current code when first adding a device, this patch makes it possible to rename to/from that.

Would you like me to try to find all other places? I'm very new to LibreNMS, but I can give it a shot.

Member

Zmegolaz commented Aug 31, 2017

I was afraid of that. Just to be clear, the directories are already sanitized in the current code when first adding a device, this patch makes it possible to rename to/from that.

Would you like me to try to find all other places? I'm very new to LibreNMS, but I can give it a shot.

@murrant

This comment has been minimized.

Show comment
Hide comment
@murrant

murrant Aug 31, 2017

Member

That would be great.

Basically, you are looking for $config['rrd_dir'] . $hostname the second variable could be a lot of things but should be the hostname.

Member

murrant commented Aug 31, 2017

That would be great.

Basically, you are looking for $config['rrd_dir'] . $hostname the second variable could be a lot of things but should be the hostname.

@Zmegolaz

This comment has been minimized.

Show comment
Hide comment
@Zmegolaz

Zmegolaz Sep 1, 2017

Member

I think I've found all places now. I haven't been able to test every thing I changed, since I don't have any place to add all applications. But all automatic tests passed at least. :)

Please let me know if you find anything weird.

Member

Zmegolaz commented Sep 1, 2017

I think I've found all places now. I haven't been able to test every thing I changed, since I don't have any place to add all applications. But all automatic tests passed at least. :)

Please let me know if you find anything weird.

@laf

laf approved these changes Sep 1, 2017

lgtm

@scrutinizer-notifier

This comment has been minimized.

Show comment
Hide comment
@scrutinizer-notifier

scrutinizer-notifier Sep 2, 2017

The inspection completed: No new issues

scrutinizer-notifier commented Sep 2, 2017

The inspection completed: No new issues

@murrant

This comment has been minimized.

Show comment
Hide comment
@murrant

murrant Sep 2, 2017

Member

Looks great, thanks @Zmegolaz

Member

murrant commented Sep 2, 2017

Looks great, thanks @Zmegolaz

@murrant murrant merged commit 5441baf into librenms:master Sep 2, 2017

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
license/cla Contributor License Agreement is signed.
Details

@Zmegolaz Zmegolaz deleted the Zmegolaz:rename_ipv6_host branch Sep 4, 2017

@lock

This comment has been minimized.

Show comment
Hide comment
@lock

lock bot May 17, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed.

lock bot commented May 17, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed.

@lock lock bot locked as resolved and limited conversation to collaborators May 17, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.