fix(cgi-bin): add functions to insert and delete vnc pipes

main
Tsu-ba-me 4 years ago
parent ac6f7e3898
commit ad01ed75ec
  1. 46
      cgi-bin/manage_vnc_ports

@ -104,13 +104,55 @@ CREATE TABLE IF NOT EXISTS public.vnc_pipes (
ssh_tunnel_pid uuid not null,
modified_date timestamp with time zone not null
);";
my $results = $anvil->Database->write({ query => $query, source => $THIS_FILE, line => __LINE__ });
$anvil->Database->write({ query => $query, source => $THIS_FILE, line => __LINE__ });
}
sub drop_vnc_pipes_table
{
my $query = "DROP TABLE IF EXISTS public.vnc_pipes;";
my $results = $anvil->Database->write({ query => $query, source => $THIS_FILE, line => __LINE__ });
$anvil->Database->write({ query => $query, source => $THIS_FILE, line => __LINE__ });
}
sub insert_vnc_pipe
{
my $parameters = shift;
my $server_uuid = $parameters->{server_uuid};
my $ws_host_uuid = $parameters->{ws_host_uuid};
my $ws_pid = $parameters->{ws_pid};
my $ssh_tunnel_host_uuid = $parameters->{ssh_tunnel_host_uuid};
my $ssh_tunnel_pid = $parameters->{ssh_tunnel_pid};
my $query = "
INSERT INTO public.vnc_pipes (
server_uuid, ws_host_uuid, ws_pid, ssh_tunnel_host_uuid, ssh_tunnel_pid
) VALUES (
".$anvil->Database->quote($server_uuid).",
".$anvil->Database->quote($ws_host_uuid).",
".$anvil->Database->quote($ws_pid).",
".$anvil->Database->quote($ssh_tunnel_host_uuid).",
".$anvil->Database->quote($ssh_tunnel_pid)."
);";
$anvil->Database->write({ query => $query, source => $THIS_FILE, line => __LINE__ });
}
sub delete_vnc_pipe
{
my $parameters = shift;
my $server_uuid = $parameters->{server_uuid};
my $ssh_tunnel_host_uuid = $parameters->{ssh_tunnel_host_uuid};
my $query = "
DELETE FROM public.vnc_pipes
WHERE
server_uuid = ".$anvil->Database->quote($server_uuid)."
AND
ssh_tunnel_host_uuid = ".$anvil->Database->quote($ssh_tunnel_host_uuid)."
;";
$anvil->Database->write({ query => $query, source => $THIS_FILE, line => __LINE__ });
}
$anvil->Get->switches;

Loading…
Cancel
Save