Bug 252640

Summary: net-mgmt/librenms: poller broken by patch
Product: Ports & Packages Reporter: geoffroy desvernay <dgeo>
Component: Individual Port(s)Assignee: Dan Langille <dvl>
Status: Closed FIXED    
Severity: Affects Only Me Flags: bugzilla: maintainer-feedback? (dvl)
Priority: ---    
Version: Latest   
Hardware: Any   
OS: Any   

Description geoffroy desvernay 2021-01-13 13:26:06 UTC
the port's patch files/patch-poller-wrapper.py breaks poller-wrapper.py script (using os before importing it)

Traceback (most recent call last):
  File "/usr/local/www/librenms/poller-wrapper.py", line 30, in <module>
    os.environ['PATH'] += ':/usr/local/sbin:/usr/local/bin'
NameError: name 'os' is not defined

Just removing the patch fixes the port
Comment 1 Dan Langille freebsd_committer freebsd_triage 2021-01-14 02:20:25 UTC
Oh, people are still using the poller wrapper? I thought that was deprecated in favor of librenms-service.py
Comment 2 Dan Langille freebsd_committer freebsd_triage 2021-01-14 02:30:54 UTC
I see that I munged up this patch back with https://svnweb.freebsd.org/ports/head/net-mgmt/librenms/files/patch-poller-wrapper.py?r1=459372&r2=478715

Note the introduction of /usr/local
Comment 3 Dan Langille freebsd_committer freebsd_triage 2021-01-14 02:37:14 UTC
I am hesitant to remove the patch, but what about patching the patch?

How are things if you using this patch instead?  By that, I mean move the os line down just above the APP_NAME

Thank you.

[dan@pkg01:~/ports/head/net-mgmt/librenms] $ cat files/patch-poller-wrapper.py 
--- poller-wrapper.py.orig	2021-01-14 02:21:36 UTC
+++ poller-wrapper.py
@@ -44,6 +44,8 @@ except ImportError as exc:
     print('ERROR: %s' % exc)
     sys.exit(2)
 
+os.environ['PATH'] += ':/usr/local/sbin:/usr/local/bin'
+
 
 APP_NAME = "poller_wrapper"
 LOG_FILE = "logs/" + APP_NAME + ".log"
Comment 4 Dan Langille freebsd_committer freebsd_triage 2021-02-25 23:18:31 UTC
Hey Geoffroy,

Is that new page working OK
Comment 5 geoffroy desvernay 2021-02-26 14:34:07 UTC
I won't be able to test this before zone week... But as long as python doesn't break it's OK for me (if this line appears after 'import os').
Thank you and sorry for the delay !

And yes, I switched to using the service since, so no harm here :)
Comment 6 Dan Langille freebsd_committer freebsd_triage 2021-03-17 00:10:17 UTC
Were you able to test?
Comment 7 commit-hook freebsd_committer freebsd_triage 2021-03-29 14:42:24 UTC
A commit references this bug:

Author: dvl
Date: Mon Mar 29 14:41:31 UTC 2021
New revision: 569472
URL: https://svnweb.freebsd.org/changeset/ports/569472

Log:
  Update to 21.3.0

  Upstream has changed their release number, but I don't think that will affect
  us at all. It appears to follow year.month

  I have sent some newly added patches upstream
  (https://github.com/librenms/librenms/pull/12647) and they will be removed
  from here on the next release.

  This update jumps over 21.20, 21.1.0, & 17.0.1 for no reason.

  While here, include a patch from an outstanding PR

  PR:		252640
  Submitted by:	geoffroy desvernay <dgeo@centrale-marseille.fr>

Changes:
  head/net-mgmt/librenms/Makefile
  head/net-mgmt/librenms/distinfo
  head/net-mgmt/librenms/files/patch-LibreNMS_Validations_System.php
  head/net-mgmt/librenms/files/patch-poller-wrapper.py
Comment 8 geoffroy desvernay 2021-03-30 08:48:22 UTC
sorry for the delay… tested and approved here :)