Search By IP

Would like the ability for api commands to be able to reference a server by its ip as well as its hostname.

A ton of our vps's have a dummy hostname of vps.server.com due to solusvm, so its near to impossible to pick a single one out if a owner has more than 1. I was looking to check the status of a server, and some other commands, but am being impacted due to this.

I am really needing a solution to this as soon as possible too.

Status: 
Closed (fixed)

Comments

Your code that calls the API could use the list-systems call with the multiline flag to get a list of all VMs, which includes all their IP addresses. Being able to specify a system by IP is a good idea though... I will look into allowing this in the next release.

sub find_managed_servers

foreach my $s (&list_managed_servers_sorted(undef, 1)) { my ($ingroup) = grep { $wantgroups{lc($_)} } split(/\t/, $s->{'group'}); my $p = @$hostedon ? &get_parent_server($s) : undef; if (($all && &can_action($s)) || $ingroup || &indexoflc($s->{'host'}, @$hosts) >= 0 || &indexoflc($s->{'ip'}, @$hosts) >= 0 || &indexoflc($s->{'manager'}, @$managers) >= 0 || &indexoflc($s->{'type'}, @$types) >= 0 || &indexoflc($s->{'status'}, @$expstatuses) >= 0 || $wantowned{$s->{'id'}} || $p && $wanthost{$p->{'id'}}) { &complete_managed_server($s); push(@rv, $s); } }

Added - &indexoflc($s->{'ip'}, @$hosts) >= 0 ||

Since find_managed_servers is used everywhere, it just added global support.

Though I can say the mechanism to convert plaintext to json/xml isnt extremely good. An example is the refresh-systems, the status is all one string and would require text manipulation/regex to parse.

Thanks, I will apply that patch (with some modifications) in the next release.

It seems other commands are using get_managed_server_by(), so I changed passwd-system.pl

$server = &get_managed_server_by("host", $host);

to

$server = &get_managed_server_by("host", $host) || &get_managed_server_by("ip", $host);

You need to do it across all API's.

Yeah, I'll fix those up too.

Can you provide a patch so I can ensure our API calls work as intended?

I have my own hackups presently.

Sure. Actually it may make more sense for me to provide a complete new version once I'm implemented all your suggestions.

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