s::Run;
use Rex::Commands::Service;
use namespace::clean;
use Rex::Resource::firewall;
use JSON qw(decode_json);
has is_arbiter => (is => 'ro', init_arg => 'arbiter', default => sub {0});
sub init {
al',
'var s = rs.status(); printjson([s.ok, s.set])'
];
return if $?;
my $json = eval { decode_json($out) } or warn $@, return;
my ($ok, $rs) = @$json;
return 1 if $ok && defined $rs
: <%= ($index++) %>, host: "<%= $host->dsn %>" },
<% } %>
]
}
);
sleep(10000);
<% if($c->is_primary) { %>
rs.addArb("<%= $c->parent->arbiter->dsn %>");
<% } %>
printjson(rs.status());
@end
Service;
use Rex::Commands::Pkg;
use Rex::Commands::Host;
use Rex::Resource::firewall;
use JSON qw(decode_json);
sub init {
my $self = shift;
return unless $self->is_primary;
return if $self->
--eval',
'var s = rs.status(); printjson([s.ok, s.set])'
];
return if $?;
my $json = eval { decode_json($out) } or return;
my ($ok, $rs) = @$json;
return 1 if $ok && defined $rs && $r
configsvr: true,
members: [
<% foreach my $host (@{$c->siblings}) { %>
{ _id : <%= ($index++) %>, host: "<%= $host->dsn %>" },
<% } %>
]
}
)
printjson(rs.status());
@end