[GUIDE] DIY Plugin Development Part 1-3

  • Hi


    I need help, I am trying to migrate fail2ban plugin for omv3, almost everything works but i have an error :


    JavaScript
    TypeError: vtypes[vtype] is not a function
    if (!vtypes[vtype](value, me)) {


    See : https://github.com/prbond/openmediavault-fail2ban.git branch master-omv3

  • Get rid of all of the vtype entries in your jails.js. Most (all) of those vtypes don't exist. port is the only one I see that actually exists.

    omv 5.5.2 usul | 64 bit | 5.4 proxmox kernel | omvextrasorg 5.3.3
    omv-extras.org plugins source code and issue tracker - github


    Please read this before posting a question.
    Please don't PM for support... Too many PMs!

  • BIG THANKS, it's been days that I have a hard time ...


    PS: where i could find list of vtype allowed ?

  • Some vtypes are built-in into extjs and others are here. You don't have to use them. It just helps formatting the field and only allowing certain types of entry.

    omv 5.5.2 usul | 64 bit | 5.4 proxmox kernel | omvextrasorg 5.3.3
    omv-extras.org plugins source code and issue tracker - github


    Please read this before posting a question.
    Please don't PM for support... Too many PMs!

  • I have read your post about building a plugin and it is quite helpful. Unfortunately it is not mentioned anywhere how you can survive to the inevitable mistakes that one makes when coding.


    Perhaps this is the not right place to ask such a dumb novice question but I am sure you have already resolved this time ago. Sorry if thi is not the right place to do this. Please tell me where I must go if this is the case.


    So, how do you debug the plugin? I mean, how dou you 'print_r' or whatever the value of a variable or object? May be it is evident but I have not been able to figure it out so far.



    I am extending the borg plugin. One of the things that I am now with is executing a call to an external program and getting (supposedly) a result back in JSON format. Then I decode it with


    $output = json_decode($output,true);


    Now I expect to have an array with the values returned in $output. The same call by hand from the shell return this JSON result:


    root@openmediavault:~# borg info --json xxxxx@xxxxxxxxxx.repo.borgbase.com:repo
    {
    "cache": {
    "path": "/root/.cache/borg/bla-bla-bla",
    "stats": {
    "total_chunks": 27260,
    "total_csize": 9056317707,
    "total_size": 10897350512,
    "total_unique_chunks": 2921,
    "unique_csize": 975903007,
    "unique_size": 1180942311
    }
    },
    "encryption": {
    "keyfile": "/root/.config/borg/keys/xxxxx_borgbase_com__repo",
    "mode": "keyfile"
    },
    "repository": {
    "id": "e7b91xxxxxx",
    "last_modified": "2019-11-09T03:38:40.000000",
    "location": "ssh://xxxxx@xxxxxxx.repo.borgbase.com/./repo"
    },
    "security_dir": "/root/.config/borg/security/exxxxxxxxxxxxxxxx"
    }



    Now I need to check if I have something returned because I am noy getting anything when I use $output["cache"]["stats"]["total_csize"] to send the data to the front-end. If I use a constant of rand() function I get the value so it is not the renderer itself so it must be the content of $output variable.


    Something is going bad but I do not know what is so I need a way to show the contents of the variables to be able to fix it.


    Any ideas?


    Thanks in advance.

  • So, how do you debug the plugin? I mean, how dou you 'print_r' or whatever the value of a variable or object?

    Put engined in debug mode:: by stopping it monit stop omv-engined and then starting it in debug mode omv-engined -df

    I am extending the borg plugin.

    Any ideas?

    I appreciate the effort and learning is good but you may want to wait until I have finished porting it. I was going to add the columns you are trying to add.

    omv 5.5.2 usul | 64 bit | 5.4 proxmox kernel | omvextrasorg 5.3.3
    omv-extras.org plugins source code and issue tracker - github


    Please read this before posting a question.
    Please don't PM for support... Too many PMs!

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!