Commit f169062a authored by Francesc Guasch's avatar Francesc Guasch
Browse files

Fixed request result done

parent 8c4b97bb
...@@ -6,7 +6,6 @@ use strict; ...@@ -6,7 +6,6 @@ use strict;
use Carp qw(carp); use Carp qw(carp);
use Data::Dumper; use Data::Dumper;
use DBIx::Connector; use DBIx::Connector;
use JSON::XS;
use Moose; use Moose;
use YAML; use YAML;
...@@ -490,7 +489,6 @@ sub list_vm_types { ...@@ -490,7 +489,6 @@ sub list_vm_types {
my %type; my %type;
for my $vm (@{$self->vm}) { for my $vm (@{$self->vm}) {
warn $vm;
my ($name) = ref($vm) =~ /.*::(.*)/; my ($name) = ref($vm) =~ /.*::(.*)/;
$type{$name}++; $type{$name}++;
} }
...@@ -591,7 +589,7 @@ sub _cmd_list_vm_types { ...@@ -591,7 +589,7 @@ sub _cmd_list_vm_types {
my $request = shift; my $request = shift;
$request->status('working'); $request->status('working');
my @list_types = $self->list_vm_types(); my @list_types = $self->list_vm_types();
$request->result(encode_json( \@list_types)); $request->result(\@list_types);
$request->status('done'); $request->status('done');
} }
......
...@@ -319,13 +319,14 @@ sub result { ...@@ -319,13 +319,14 @@ sub result {
if (defined $value ) { if (defined $value ) {
my $sth = $$CONNECTOR->dbh->prepare("UPDATE requests set result=? " my $sth = $$CONNECTOR->dbh->prepare("UPDATE requests set result=? "
." WHERE id=?"); ." WHERE id=?");
$sth->execute($value, $self->{id}); $sth->execute(encode_json($value), $self->{id});
$sth->finish; $sth->finish;
} else { } else {
my $sth = $$CONNECTOR->dbh->prepare("SELECT result FROM requests where id=? "); my $sth = $$CONNECTOR->dbh->prepare("SELECT result FROM requests where id=? ");
$sth->execute($self->{id}); $sth->execute($self->{id});
($value) = $sth->fetchrow; ($value) = $sth->fetchrow;
$value = decode_json($value);
$sth->finish; $sth->finish;
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment