host should be and normal -- option

Hi,

I have just tried to get a breif status informantion from virtualmin via the remote.cgi interface. I wanted to call the "info" command with the "host" option to limit the output.

Example taken from documentation:

 [root@fudu ~]# virtualmin info host
  host:
      hostname: fudu.home
      module root: /usr/local/webadmin/virtual-server
      os: Redhat Linux Fedora 9
      root: /usr/local/webadmin
      theme version: 6.6
      virtualmin version: 3.65
      webmin version: 1.449  

Call of the info command work ok but when I append the host option I only get "Exit status: 0" as output.

When reviewing the remote.cgi script I realized that the script prepend all options with "--" before calling the relevant perl script. However, the info command only accepts the host option without "--"

I made a workaround by changing the remote.cgi to check whether the option is "host". If so, the script doesn't prepend the "--" and it works!

However, I suggest the the correct fix would be to change info.pl to accept host with "--" as an option.

Regards, Rolf

Example:

 [root@fudu ~]# virtualmin info --host
  host:
      hostname: fudu.home
      module root: /usr/local/webadmin/virtual-server
      os: Redhat Linux Fedora 9
      root: /usr/local/webadmin
      theme version: 6.6
      virtualmin version: 3.65
      webmin version: 1.449  
Status: 
Closed (fixed)

Comments

Actually, there is already a proper way to get the information you want with the -- flag, like so :

virtualmin info --search host

This is poorly documented though, so I will make it clearer in the next release.

Ups

virtualmin info --search host

gives nothing

However, without "--" I get the output:

fangio:~# virtualmin info search host
host: 
    hostname: fangio.openusource.com
    module root: /usr/share/webmin/virtual-server
    os: Debian Linux 5.0
    root: /usr/share/webmin
    theme version: 7.4
    virtualmin version: 3.73
    webmin version: 1.490

... back to square one :-(

First of all, I'm not an Perl expert :-)

However, when studying the info.pl file I noticed that the search option is implemented by pushing the search value on to the @searches array in line 47:

elsif ($a eq "--search") {
    push(@searches, shift(@ARGV));
    }

But the shift never happens so what is pushed in the @searches array is "--search". Strange is it that if the @ARGV is shifted before the push is called, like this:

elsif ($a eq "--search") {
    shift(@ARGV);
    push(@searches, @ARGV);
    }

, everything is fine! And "host" (in my example) is pushed in the @searches array.

My perl version is 5.010000.

// Rolf

Doh, you are correct .. I will include this fix in the next Virtualmin release.

Automatically closed -- issue fixed for 2 weeks with no activity.