Custom Webmin Module - How to Control Category Display

1.7k views Asked by At

I need to create a simple custom webmin module, which will be one button click to run a perl script I've created.

I read about the webmin module development at: http://doxfer.webmin.com/Webmin/ModuleDevelopment which gave me a general overview. But I didn't find it to be a clear on how to actually create an item in the menu/categories.

I've looked at my /etc/webmin/miniserv.conf file, which shows my root at /usr/libexec/webmin. I then copied one of the subfolders to a test subfolder and modified its module.info file to try to a copy of an existing module to display in webmin. Just copying the folder and editing the file did not get things to display in the menu, which makes me think the menu/category layout is controlled somewhere else. If I go to Webmin -> Webmin Configuration -> Webmin Modules -> Delete I can see the copy of the module I made by the new name.

If I do Webmin -> Webmin Configuration -> Webmin Modules -> Clone then I can clone an existing item and there is an option for Assign to Category, which allows the clone to show up in the menu. However the directory /usr/libexec/webmin folder doesn't give the clone a new name, it just uses the existing directory and adds a number to the end of the directory:

drwxr-xr-x.   5 root root   4096 Oct  9 08:21 backup-config
lrwxrwxrwx    1 root root     13 Oct  9 08:20 backup-config2 -> backup-config
lrwxrwxrwx    1 root root     13 Oct  9 08:53 backup-config3 -> backup-config

The clones also don't show up under the Delete Tab... e.g. They don't seem to be real modules, more like aliases.

I've tried to google examples, tutorials, and how to do simple setups, but there doesn't seem to be anything that gives a simple example on creating a new module and linking it into the menu/category. I believe my first approach of copying the subfolder from /usr/libexec/webmin and then editing the module.info is close to what really needs to happen, but I don't see how to link it into the menu. I looked at Webmin -> Webmin Configuration -> Reassign Modules and this shows my subfolder copy assigned to the Webmin category but doesn't seem to be showing up, or I'm not looking in the correct location.

What am I doing wrong? Specifically, what do I need to update or do to see the copied module in the menu?

Update

I've tried the tutorial shown at: http://www.ehow.com/how_12048470_create-custom-webmin-module.html

I followed the example and made the module's name foobar. After making the new module, I deleted my /etc/webmin/module.infos.cache and refreshed by web browser, to make sure cache wasn't an issue. The example shows we categorize the module under Servers but its not showing up in my list. Below is a screenshot showing no foobar.

enter image description here

1

There are 1 answers

1
James Oravec On

Seems I found my missing piece...

The examples work but were missing one key piece of information. You need to give your user permissions to view the module after you set them up. To do so, I did:

Webmin -> Webmin Users -> root -> Available Webmin modules
Check the new unchecked modules
Save

After I did this, they displayed properly under each category.