docs: man oLschema2ldif: Add missing meta data.
[Samba.git] / source4 / selftest / win / vm_get_ip.pl
blob9657a34790f59e1d6b156dd5579e509827b1becf
1 #!/usr/bin/perl -w
3 # A perl script to connect to a VMware server and get the IP address of a VM.
4 # Copyright Brad Henry <brad@samba.org> 2006
5 # Released under the GNU GPL version 3 or later.
7 use VMHost;
9 sub check_error {
10 my $vm = VMHost;
11 my $custom_err_str = "";
12 ($vm, $custom_err_str) = @_;
14 my ($err_code, $err_str) = $vm->error;
15 if ($err_code != 0) {
16 undef $vm;
17 die $custom_err_str . "Returned $err_code: $err_str.\n";
21 # Read in parameters from environment.
22 my $vm_cfg_path = $ENV{"$ARGV[0]"};
23 my $host_server_name = $ENV{'HOST_SERVER_NAME'};
24 my $host_server_port = $ENV{'HOST_SERVER_PORT'};
25 if (!defined($host_server_port)) {
26 $host_server_port = 902;
29 my $host_username = $ENV{'HOST_USERNAME'};
30 my $host_password = $ENV{'HOST_PASSWORD'};
31 my $guest_admin_username = $ENV{'GUEST_ADMIN_USERNAME'};
32 my $guest_admin_password = $ENV{'GUEST_ADMIN_PASSWORD'};
34 my $vm = VMHost;
36 $vm->host_connect($host_server_name, $host_server_port, $host_username,
37 $host_password, $vm_cfg_path, $guest_admin_username,
38 $guest_admin_password);
39 check_error($vm, "Error in \$vm->host_connect().\n");
41 my $guest_ip = $vm->get_guest_ip();
42 check_error($vm, "Error in \$vm->get_guest_ip().\n");
44 print $guest_ip;
46 undef $vm;
48 exit 0;