fix(cgi-bin): handle get_networks input

main
Tsu-ba-me 4 years ago
parent d2f34ea5a9
commit b9f9d07362
  1. 41
      cgi-bin/get_networks

@ -20,6 +20,24 @@ if (($running_directory =~ /^\./) && ($ENV{PWD}))
my $anvil = Anvil::Tools->new();
sub handle_invalid_uuid
{
my $parameters = shift;
my $name = $parameters->{name};
my $uuid = $parameters->{uuid};
$anvil->Log->entry({
source => $THIS_FILE,
line => __LINE__,
level => 0,
'print' => 1,
priority => "err",
key => "error_0160",
variables => { name => $name, uuid => $uuid }
});
$anvil->nice_exit({ exit_code => 1 });
}
$anvil->Get->switches;
# Temporary; for debugging
@ -42,6 +60,29 @@ $anvil->Database->get_anvils();
print $anvil->Template->get({file => "shared.html", name => "json_headers", show_name => 0})."\n";
my $anvil_uuid = $anvil->data->{cgi}{anvil_uuid}{value};
my $anvil_uuid_variable_name = "anvil UUID";
my $response_body = {};
if ($anvil_uuid)
{
if (exists $anvil->data->{anvils}{anvil_uuid}{$anvil_uuid})
{
}
else
{
handle_invalid_uuid({ name => $anvil_uuid_variable_name, uuid => $anvil_uuid });
}
}
else
{
handle_invalid_uuid({ name => $anvil_uuid_variable_name, uuid => $anvil_uuid });
}
my @host_uuids = (
$anvil->data->{anvils}{anvil_uuid}{}
)
print JSON->new->utf8->encode($response_body)."\n";

Loading…
Cancel
Save