Permalink
Browse files

list host will list its backends

  • Loading branch information...
1 parent 19c3d0a commit 4b5272f03bef1ec647c4092de6953bd5be8ebf3e @shelling committed Jan 14, 2013
Showing with 9 additions and 0 deletions.
  1. +3 −0 lib/HTTP/Balancer/Command/List/Host.pm
  2. +6 −0 lib/HTTP/Balancer/Model/Host.pm
@@ -7,6 +7,9 @@ sub run {
my ($self, ) = @_;
map {
say $_->name;
+ for my $backend ($_->backends) {
+ say " ", $backend->address;
+ }
} $self->model("Host")->all;
}
@@ -19,4 +19,10 @@ has name => (
isa => "Str",
);
+sub backends {
+ my ($self, ) = @_;
+ $self->model("Backend")
+ ->where(host_id => $self->id);
+}
+
1;

0 comments on commit 4b5272f

Please sign in to comment.