Developing for OMV3

  • Are these directions up-to-date for developing for OMV3? I am trying to build a simple plugin for OMV3 but when I installed it in my test environment, the UI stopped responding to anything and kept throwing errors. After I uninstalled the plugin however, everything went back to normal and the UI is functional again.

    • Offizieller Beitrag

    Are these directions up-to-date for developing for OMV3?

    Nope. Those are very old. Do you have the source code on github? I could point out problems.

    omv 7.0.5-1 sandworm | 64 bit | 6.8 proxmox kernel

    plugins :: omvextrasorg 7.0 | kvm 7.0.13 | compose 7.1.4 | k8s 7.1.0-3 | cputemp 7.0.1 | mergerfs 7.0.4


    omv-extras.org plugins source code and issue tracker - github - changelogs


    Please try ctrl-shift-R and read this before posting a question.

    Please put your OMV system details in your signature.
    Please don't PM for support... Too many PMs!

  • Nope. Those are very old. Do you have the source code on github? I could point out problems.

    No I don't have it on GitHub right now but I can put something up. The problem may very well be that I was trying to use the openmediavault-minidlna plugin in conjunction with the tutorial that I linked to in order to figure out how things are supposed to work. I didn't really start writing any code for my plugin, but I was trying to strip everything except the core code from the plugin. I will try again but this time, I will just create the skeleton based on the instructions on that page and then pass it along to you.

  • Nope. Those are very old. Do you have the source code on github? I could point out problems.

    @ryecoaaron My template is now available on GitHub here: https://github.com/DavidB-OMV/OMV3-Plugin-Template


    I have also added you to the repository as a collaborator so if you want to push changes you can do so. I was able to install this without an issue this time, but when I open the plugin's settings page, I get an error message saying "RPC service 'Example' not found."


    Code
    Error #0:
    exception 'OMV\Rpc\Exception' with message 'RPC service 'Example' not found.' in /usr/share/php/openmediavault/rpc/rpc.inc:99
    Stack trace:
    #0 /usr/sbin/omv-engined(536): OMV\Rpc\Rpc::call('Example', 'getSettings', NULL, Array, 1)
    #1 {main}
    • Offizieller Beitrag

    Made a few changes :) The changes I made took the plugin from code that worked on OMV 2.x to code that works on OMV 3.x.

    omv 7.0.5-1 sandworm | 64 bit | 6.8 proxmox kernel

    plugins :: omvextrasorg 7.0 | kvm 7.0.13 | compose 7.1.4 | k8s 7.1.0-3 | cputemp 7.0.1 | mergerfs 7.0.4


    omv-extras.org plugins source code and issue tracker - github - changelogs


    Please try ctrl-shift-R and read this before posting a question.

    Please put your OMV system details in your signature.
    Please don't PM for support... Too many PMs!

  • Made a few changes :) The changes I made took the plugin from code that worked on OMV 2.x to code that works on OMV 3.x.

    Thanks @ryecoaaron! I am still having an issue with it though. Whenever I load the plugin settings page now, everything works fine, but whenever I click on "Apply" on the yellow "The configuration has been changed..." bar, I get this error:


    Failed to execute command 'export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin; export LANG=C; systemctl stop example 2>&1' with exit code '5': Failed to stop example.service: Unit example.service not loaded.


    Would you happen to know what is wrong now?

    Einmal editiert, zuletzt von David B () aus folgendem Grund: added more info

  • @ryecoaaron, thank you for your help so far. I have a question for you though. How can I remove the Service for the plugin? The plugin creates an "Example" entry in the service table but I do not know how to remove it. You do not need to make the change to the template repository, as I am not developing what I am working on in there (that was just so that I had something to work off of that I did not find confusing), but I would like you to tell me how to get rid of this.


    • Offizieller Beitrag

    How can I remove the Service for the plugin?

    Remove the /usr/share/openmediavault/engined/module/example.inc file.

  • Remove the /usr/share/openmediavault/engined/module/example.inc file.

    Do I need the service in order to modify files that are not directly a part of my plugin? Whenever I save the changes now that I've removed the service, I'm not getting the "You must apply your changes..." bar at the top. Does that mean that the changes that have been made to my plugin are not actually being applied?

    • Offizieller Beitrag

    Updated the github repo to do what I think you want.

  • I've started playing with plugin development again, and I've made some progress, but I am running in to an error when I try to open the plugin's settings page. It says the following:


    Failed to execute XPath query '//services/themechanger'.


    Could anyone give suggestions on where I might have screwed up?


    Update: I found the problem. I forgot to change the SERVICE_XPATH_NAME variable in "postinst."

    • Offizieller Beitrag

    Do you create that element in the postinst? If so, did you look to see if that element exists in config.xml?

    omv 7.0.5-1 sandworm | 64 bit | 6.8 proxmox kernel

    plugins :: omvextrasorg 7.0 | kvm 7.0.13 | compose 7.1.4 | k8s 7.1.0-3 | cputemp 7.0.1 | mergerfs 7.0.4


    omv-extras.org plugins source code and issue tracker - github - changelogs


    Please try ctrl-shift-R and read this before posting a question.

    Please put your OMV system details in your signature.
    Please don't PM for support... Too many PMs!

  • Do you create that element in the postinst? If so, did you look to see if that element exists in config.xml?

    Yes, I forgot to change the "SERVICE_XPATH_NAME" in postinst and postrm. After doing that, I was able to the plugin working. It just so happens that I found the problem minutes before you responded. Thanks for the help!

  • I'm having a hard time adding options to the settings for the plugin. I added several things to the Settings.js file, but when I install the plugin on OMV and try to click on my plugin's tab to open it, all that happens is that it gets highlighted yellow.

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!