-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathJBoss.pm
58 lines (40 loc) · 1012 Bytes
/
JBoss.pm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#
# (c)
#
# vim: set ts=2 sw=2 tw=0:
# vim: set expandtab:
package Application::JBoss;
use Moose;
use File::Spec;
use Rex::Commands::Fs;
use Rex::Commands::Run;
use Application::JBoss::Instance;
extends qw(Application::Base);
override get_instances => sub {
my ($self) = @_;
my $jboss_path = File::Spec->catdir($self->project->project_path, "jboss");
if(!is_dir($jboss_path)) {
return ();
}
my @jbosses = grep {
is_dir(File::Spec->catdir($jboss_path, $_))
&& is_dir(File::Spec->catdir($jboss_path, $_, "deployments"))
} list_files $jboss_path;
my @ret;
for my $j_instance (@jbosses) {
push @ret, Application::JBoss::Instance->new(
app => $self,
instance => $j_instance,
instance_path => File::Spec->catdir($jboss_path, $j_instance),
);
}
return @ret;
};
Project->register_app_type(100, __PACKAGE__, sub {
my @jboss_out = run "rpm -qa | grep jboss";
if(scalar @jboss_out >= 1) {
return 1;
}
return 0;
});
1;