Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-17772

Redmine webhook: does not recognize project by id as specified

XMLWordPrintable

    • Team INT
    • Sprint 64 (May 2020), Sprint 65 (Jun 2020), Sprint 66 (Jul 2020), Sprint 67 (Aug 2020), Sprint 68 (Sep 2020), Sprint 69 (Oct 2020), Sprint 70 (Nov 2020), Sprint 71 (Dec 2020), Sprint 72 (Jan 2021), Sprint 73 (Feb 2021), Sprint 74 (Mar 2021)
    • 0.125

      The retrieval of the redmine project should either be working with the id or project name as specified in the placeholder and documentation.

      Documentation: https://git.zabbix.com/projects/ZBX/repos/zabbix/browse/templates/media/redmine

      Template https://git.zabbix.com/projects/ZBX/repos/zabbix/browse/templates/media/redmine/media_redmine.xml

      The code does only compare the name and gets the id if matching. IMO it should first try to match the id and match the name only if it does not match the id.

          getProjectID: function(name) {
              var result = Redmine.request('get', 'projects.json'),
                  project_id;
      
              if (result.response) {
                  var projects = result.response.projects || [];
      
                  for (var i in projects) {
                      if (projects[i].name === name) {
                          project_id = projects[i].id;
                          break;
                      }
                  }
              }
              else {
                  Zabbix.Log(4, '[ Redmine Webhook ] Failed to retrieve project data.');
              }
      
              if (typeof project_id === 'undefined') {
                  throw 'Cannot find project with name: ' + name;
              }
      
              return project_id;
          },
      

            tuskov Tikhon Uskov (Inactive)
            mbrohl Michael Brohl
            Team INT
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: