Uploaded image for project: 'OpenNMS'
  1. OpenNMS
  2. NMS-9267

The upgrade task for magic-users.properties fails because of the read-only attribute



    • Horizon - August 22nd 2018


      In NMS-9109, a few problems have been fixed due to .rpmnew and its Debian sibling.

      I've created a VM with 18.0.4, started OpenNMS, added some users, and also updated magic-users.properties to add some of those new users to different roles.

      Then, I stopped OpenNMS, and upgraded to 19.0.1.

      Here is what I found:

      - Running execution phase
        Moving security roles into users.xml...
        Warning: can't perform the upgrade operation because: Can't fix configuration because The attribute 'read-only' appears illegally on element 'user'.

      Indeed, the read-only attribute was removed from the XSD as part of the magic-users refactoring. The problem is that because this attribute exist on older versions of OpenNMS, it has to be removed prior trying to parse users.xml using JAXB with the new code.

      This doesn't seem to be the case, as the error wouldn't exist. For this reason, the upgrade task needs a pre-parser to remove that attribute, in other words, the equivalent of:

      sed -i 's/ read-only="[^"]*"//' users.xml

      And, then it can continue with its operation.

      Now, the actual use case should be, pre-parse without JAXB the XML to see which users have read-only="true", and assign ROLE_READONLY accordingly.

      Interestingly, it seems that the upgrade task has code to do what I've described above as part of the work for HZN-871, but for some reason it is still failing, so the current implementation has to be revisited.




            ranger Benjamin Reed
            agalue Alejandro Galue
            0 Vote for this issue
            1 Start watching this issue



              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.